Web Inspector: Do not use RunLoop when dispatching inspector GC event
https://bugs.webkit.org/show_bug.cgi?id=167683
<rdar://problem/30167791>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-02-06
Reviewed by Brian Burg.

Source/JavaScriptCore:

Move the RunLoop deferred implementation to WebCore. It is not needed
for JSContext inspection, and in JSContext inspection we are not
guarenteed a RunLoop to defer to.

* inspector/agents/InspectorHeapAgent.h:
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::InspectorHeapAgent):
(Inspector::InspectorHeapAgent::~InspectorHeapAgent):
(Inspector::InspectorHeapAgent::disable):
(Inspector::InspectorHeapAgent::didGarbageCollect):
(Inspector::SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask): Deleted.
(Inspector::SendGarbageCollectionEventsTask::addGarbageCollection): Deleted.
(Inspector::SendGarbageCollectionEventsTask::reset): Deleted.
(Inspector::SendGarbageCollectionEventsTask::timerFired): Deleted.

(Inspector::InspectorHeapAgent::dispatchGarbageCollectedEvent):
Make a virtual method so that WebCore implementations of this agent can choose
to dispatch this event asynchronously.

* inspector/agents/InspectorScriptProfilerAgent.cpp:
Remove unnecessary RunLoop include.

Source/WebCore:

Covered by existing tests.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorAllInOne.cpp:
Add new file.

* inspector/PageHeapAgent.cpp:
(WebCore::PageHeapAgent::PageHeapAgent):
(WebCore::PageHeapAgent::enable):
(WebCore::PageHeapAgent::disable):
* inspector/PageHeapAgent.h:
Extend WebHeapAgent.

* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
Use WebHeapAgent.

* inspector/WebHeapAgent.cpp: Added.
(WebCore::SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask):
(WebCore::SendGarbageCollectionEventsTask::addGarbageCollection):
(WebCore::SendGarbageCollectionEventsTask::reset):
(WebCore::SendGarbageCollectionEventsTask::timerFired):
(WebCore::WebHeapAgent::WebHeapAgent):
(WebCore::WebHeapAgent::~WebHeapAgent):
(WebCore::WebHeapAgent::disable):
(WebCore::WebHeapAgent::dispatchGarbageCollectedEvent):
(WebCore::WebHeapAgent::dispatchGarbageCollectionEventsAfterDelay):
* inspector/WebHeapAgent.h:
Move the defered event dispatch from InspectorHeapAgent here where a RunLoop is guarenteed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed