haikuwebkit/Source/WebKitLegacy/cf/WebCoreSupport
Brian Burg b4bf3d5ac4 Web Inspector: move InspectorFrontendAPIDispatcher to WebCore, clean up uses
https://bugs.webkit.org/show_bug.cgi?id=217835
<rdar://problem/70384407>

Reviewed by Devin Rousso.

Source/WebCore:

Expose the dispatcher as part of the InspectorFrontendClient API so that other code
can use the dispatcher regardless of whether it's a WebInspectorUI or RemoteWebInspectorUI.

Add an InspectorFrontendAPIDispatcher instance and getter to InspectorFrontendClientLocal.

Adopt the JSONValue-based InspectorFrontendAPIDispatcher::dispatch() method
in InspectorFrontendClientLocal. Remove the redundant parallel queuing implementation.
Remove redundant public methods that are available on InspectorFrontendAPIDispatcher.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Moved files.

* inspector/InspectorFrontendAPIDispatcher.cpp: Renamed from Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp.
(WebCore::InspectorFrontendAPIDispatcher::InspectorFrontendAPIDispatcher):
(WebCore::InspectorFrontendAPIDispatcher::reset):
(WebCore::InspectorFrontendAPIDispatcher::frontendLoaded):
(WebCore::InspectorFrontendAPIDispatcher::suspend):
(WebCore::InspectorFrontendAPIDispatcher::unsuspend):
(WebCore::InspectorFrontendAPIDispatcher::dispatchCommand):
(WebCore::InspectorFrontendAPIDispatcher::dispatchMessageAsync):
(WebCore::InspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
(WebCore::InspectorFrontendAPIDispatcher::evaluateQueuedExpressions):
(WebCore::InspectorFrontendAPIDispatcher::evaluateExpression):
(WebCore::InspectorFrontendAPIDispatcher::evaluateExpressionForTesting):
Add new dispatch() method. Remove other dispatch methods that can be expressed
using the new JSON::Value-based method. If it's not possible to evaluate JS
immediately, schedule a one-shot task to try again on a different event loop turn.

* inspector/InspectorFrontendAPIDispatcher.h: Renamed from Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h.
Add new dispatch() method which takes a vector of JSON::Value objects and
serializes them into command arguments for the frontend.

* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
(WebCore::InspectorFrontendClientLocal::frontendLoaded):
(WebCore::InspectorFrontendClientLocal::pagePaused):
(WebCore::InspectorFrontendClientLocal::pageUnpaused):
(WebCore::InspectorFrontendClientLocal::setDockingUnavailable):
(WebCore::InspectorFrontendClientLocal::setAttachedWindow):
(WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
(WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
(WebCore::InspectorFrontendClientLocal::startProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::stopProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::showConsole):
(WebCore::InspectorFrontendClientLocal::showResources):
(WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
Use InspectorFrontendAPIDispatcher to dispatch commands to the frontend.

(WebCore::InspectorFrontendClientLocal::dispatch): Deleted.
(WebCore::InspectorFrontendClientLocal::dispatchMessage): Deleted.
(WebCore::InspectorFrontendClientLocal::dispatchMessageAsync): Deleted.
(WebCore::InspectorFrontendClientLocal::evaluateOnLoad): Deleted.
These are redundant with InspectorFrontendAPIDispatcher.

* testing/Internals.cpp:
(WebCore::InspectorStubFrontend::sendMessageToFrontend): Use frontend dispatcher directly.

Source/WebKit:

Adopt the JSONValue-based InspectorFrontendAPIDispatcher::dispatch() method
in WebInspectorUI and RemoteInspectorUI methods that dispatch to the frontend.

* Sources.txt:
* WebKit.xcodeproj/project.pbxproj: Move files.

* WebProcess/Inspector/RemoteWebInspectorUI.h:
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI):
(WebKit::RemoteWebInspectorUI::initialize):
(WebKit::RemoteWebInspectorUI::updateFindString):
(WebKit::RemoteWebInspectorUI::didSave):
(WebKit::RemoteWebInspectorUI::didAppend):
(WebKit::RemoteWebInspectorUI::frontendLoaded):
(WebKit::RemoteWebInspectorUI::sendMessageToFrontend):
(WebKit::RemoteWebInspectorUI::pagePaused):
(WebKit::RemoteWebInspectorUI::pageUnpaused):
(WebKit::RemoteWebInspectorUI::setDiagnosticLoggingAvailable):

* WebProcess/Inspector/WebInspectorUI.h:
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::WebInspectorUI):
(WebKit::WebInspectorUI::setDockSide):
(WebKit::WebInspectorUI::setDockingUnavailable):
(WebKit::WebInspectorUI::setIsVisible):
(WebKit::WebInspectorUI::updateFindString):
(WebKit::WebInspectorUI::setDiagnosticLoggingAvailable):
(WebKit::WebInspectorUI::showConsole):
(WebKit::WebInspectorUI::showResources):
(WebKit::WebInspectorUI::showMainResourceForFrame):
(WebKit::WebInspectorUI::startPageProfiling):
(WebKit::WebInspectorUI::stopPageProfiling):
(WebKit::WebInspectorUI::startElementSelection):
(WebKit::WebInspectorUI::stopElementSelection):
(WebKit::WebInspectorUI::didSave):
(WebKit::WebInspectorUI::didAppend):
(WebKit::WebInspectorUI::sendMessageToFrontend):
(WebKit::WebInspectorUI::evaluateInFrontendForTesting):
(WebKit::WebInspectorUI::pagePaused):
(WebKit::WebInspectorUI::pageUnpaused):

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
Add missing header includes (related to unified sources changes from r269168).

Source/WebKitLegacy/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:
(WebInspectorClient::sendMessageToFrontend):

LayoutTests:

* inspector/dom/dom-remove-events.html:
* inspector/dom/remove-multiple-nodes.html:
The order of events received has changed slightly due to the new auto-suspend behavior
in InspectorFrontendAPIDispatcher. Remove event handlers when the test is complete to
ensure that events which arrive after the test has finished do not stomp on the expected results.

* inspector/debugger/call-frame-function-name.html:
* inspector/debugger/call-frame-this-host.html:
* inspector/debugger/hit-breakpoint-from-console.html:
* inspector/debugger/setBreakpoint-autoContinue.html:
* inspector/debugger/setBreakpoint-column.html:
* inspector/debugger/setBreakpoint-condition.html:
* inspector/debugger/setBreakpoint.html:
* inspector/debugger/setBreakpointByUrl-sourceURL.html:
Some tests seem to call ProtocolTest.completeTest() from the handler of Debugger.paused, when
the debugger is still paused. This causes timeouts after this refactoring, since not resuming means that
we'll get stuck in the debugger's nested run loop and never return.


Canonical link: https://commits.webkit.org/231071@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-30 23:56:26 +00:00
..
WebInspectorClientCF.cpp