Make the Web Inspector use a separate web process.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 19:58:08 +0000 (19:58 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 19:58:08 +0000 (19:58 +0000)
commitae594aa1abda7f8263ff72bf6ca50b857e24d03f
treedca6988fc5fbe0becf3aaa34d61099a3de0e0bd1
parent49869426f3e99fc01e904ffd0f4fdd82dab6c111
Make the Web Inspector use a separate web process.

https://bugs.webkit.org/show_bug.cgi?id=135120

Reviewed by Anders Carlsson.

Source/WebCore:

* English.lproj/Localizable.strings: Updated.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/ScriptGlobalObject.h:
* bindings/js/ScriptState.h:
* inspector/InspectorFrontendHost.h:
* inspector/InspectorPageAgent.h:
* page/Chrome.h:
Exported a few functions and private headers.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::setInspectorFrontendClient):
(WebCore::InspectorController::hasInspectorFrontendClient):
(WebCore::InspectorController::show):
* inspector/InspectorController.h:
Make InspectorFrontendClient a pointer instead of a std::unique_ptr.
This makes it easier to implement InspectorFrontendClient as
part of an existing object that is externally owned.

* testing/Internals.cpp:
(WebCore::Internals::openDummyInspectorFrontend):
(WebCore::Internals::closeDummyInspectorFrontend):
* testing/Internals.h:
Change InspectorFrontendClientDummy from being moved to owned.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js: Updated.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
(WebInspector.contentLoaded):
Move InspectorFrontendHost.loaded to later in the load.
Calling it early just shows the window before we have
a user interface to show.

* UserInterface/Base/Test.js:
(WebInspector.loaded):
(WebInspector.contentLoaded):
Match the changes in Main.js.

* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.savedURL): Change comment.
(InspectorFrontendAPI.appendedToURL): Change comment.
(InspectorFrontendAPI.dispatch): Add an assert and early
return to be safe from unknown commands.
(InspectorFrontendAPI.loadCompleted): Delete _pendingCommands,
no need to keep an empty array around a one time use.

Source/WebKit/ios:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorClient::WebInspectorClient):
Removed m_frontendClient initialization since it is
now a std::unique_ptr that defaults to nullptr.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::openInspectorFrontend):
(WebInspectorClient::releaseFrontend):
Own WebInspectorFrontendClient instead of moving it.

Source/WebKit/win:

* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::openInspectorFrontend):
* WebCoreSupport/WebInspectorClient.h:
(WebInspectorClient::frontendClient):
Own WebInspectorFrontendClient instead of moving it.

Source/WebKit2:

* CMakeLists.txt:
* DerivedSources.make:
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* WebKit2.xcodeproj/project.pbxproj:
Added new WebInspectorUI files and removed WebInspectorFrontendClient.cpp.

* Shared/APIObject.h: Added BundleInspectorUI.

* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm:
(WebKit::ChildProcessMainDelegate::getExtraInitializationData):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
Add support for "inspector-process" data, a boolean that is used by
WebProcess::initializeProcessName.

* UIProcess/API/C/WKInspector.cpp:
(WKInspectorIsDebuggingJavaScript):
(WKInspectorToggleJavaScriptDebugging):
(WKInspectorIsProfilingJavaScript):
(WKInspectorToggleJavaScriptProfiling):
* UIProcess/API/C/WKInspector.h:
Stub out functions we don't support but need to keep for nightly compatibility.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorPageGroups::createInspectorPageGroup):
(WebKit::WebInspectorProxy::WebInspectorProxy):
(WebKit::WebInspectorProxy::invalidate):
(WebKit::WebInspectorProxy::connect):
(WebKit::WebInspectorProxy::showConsole):
(WebKit::WebInspectorProxy::showResources):
(WebKit::WebInspectorProxy::showMainResourceForFrame):
(WebKit::WebInspectorProxy::attach):
(WebKit::WebInspectorProxy::detach):
(WebKit::WebInspectorProxy::inspectorContext):
(WebKit::WebInspectorProxy::dispatchMessageFromRemoteFrontend):
(WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
(WebKit::WebInspectorProxy::createInspectorPage):
(WebKit::WebInspectorProxy::open):
(WebKit::WebInspectorProxy::didClose):
(WebKit::WebInspectorProxy::attachAvailabilityChanged):
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::isConnected):
(WebKit::WebInspectorProxy::canAttach):
* UIProcess/WebInspectorProxy.messages.in:
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformAttach):
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorProxyObjCAdapter close]):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformDidClose):
(WebKit::WebInspectorProxy::platformHide):
(WebKit::WebInspectorProxy::platformSave):
(WebKit::WebInspectorProxy::platformAppend):
(WebKit::WebInspectorProxy::platformAttach):
Changed how the Inspector page is created by making it in a new WebContext for
the Inspector. This removes us from the main process pool and guarantees no process
sharing for our user interface. Also send new WebInspectorUI messages to the Inspector
page and not the inspected page when appropriate.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions): Add "inspector-process" to extraInitializationData
if the context is the Inspector context. This is used by WebProcess::initializeProcessName.

* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::openInspectorFrontend):
(WebKit::WebInspectorClient::closeInspectorFrontend):
(WebKit::WebInspectorClient::bringFrontendToFront):
* WebProcess/WebCoreSupport/WebInspectorClient.h:
Remove the InspectorFrontendChannel class from WebInspectorClient and clean up a little.
InspectorFrontendChannel implementation moved to WebInspector.

* WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: Removed. Superseded by WebInspectorUI.

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::create):
(WebKit::WebInspector::WebInspector):
(WebKit::WebInspector::createInspectorPage):
(WebKit::WebInspector::closeFrontend):
(WebKit::WebInspector::openInNewTab):
(WebKit::WebInspector::showConsole):
(WebKit::WebInspector::showResources):
(WebKit::WebInspector::showMainResourceForFrame):
(WebKit::WebInspector::startPageProfiling):
(WebKit::WebInspector::stopPageProfiling):
(WebKit::WebInspector::canAttachWindow):
(WebKit::WebInspector::updateDockingAvailability):
(WebKit::WebInspector::sendMessageToBackend):
(WebKit::WebInspector::sendMessageToFrontend):
(WebKit::WebInspector::remoteFrontendConnected):
(WebKit::WebInspector::remoteFrontendDisconnected):
* WebProcess/WebPage/WebInspector.h:
(WebKit::WebInspector::didClose):
(WebKit::WebInspector::didReceiveInvalidMessage):
(WebKit::WebInspector::setAttached):
* WebProcess/WebPage/WebInspector.messages.in:
Stop taking an optional InspectorFrontendChannel and inherit it instead. Create a connection that
can be passed to the other web process for WebInspectorUI to use. Stop referencing Inspector's page
directly, since it is in another process now.

* WebProcess/WebPage/WebInspectorUI.cpp: Added.
(WebKit::WebInspectorUI::create):
(WebKit::WebInspectorUI::WebInspectorUI):
(WebKit::WebInspectorUI::establishConnection):
(WebKit::WebInspectorUI::windowObjectCleared):
(WebKit::WebInspectorUI::frontendLoaded):
(WebKit::WebInspectorUI::moveWindowBy):
(WebKit::WebInspectorUI::bringToFront):
(WebKit::WebInspectorUI::closeWindow):
(WebKit::WebInspectorUI::requestSetDockSide):
(WebKit::WebInspectorUI::setDockSide):
(WebKit::WebInspectorUI::changeAttachedWindowHeight):
(WebKit::WebInspectorUI::changeAttachedWindowWidth):
(WebKit::WebInspectorUI::setToolbarHeight):
(WebKit::WebInspectorUI::openInNewTab):
(WebKit::WebInspectorUI::save):
(WebKit::WebInspectorUI::append):
(WebKit::WebInspectorUI::inspectedURLChanged):
(WebKit::WebInspectorUI::showConsole):
(WebKit::WebInspectorUI::showResources):
(WebKit::WebInspectorUI::showMainResourceForFrame):
(WebKit::WebInspectorUI::startPageProfiling):
(WebKit::WebInspectorUI::stopPageProfiling):
(WebKit::WebInspectorUI::didSave):
(WebKit::WebInspectorUI::didAppend):
(WebKit::WebInspectorUI::sendMessageToFrontend):
(WebKit::WebInspectorUI::sendMessageToBackend):
(WebKit::WebInspectorUI::evaluateCommandOnLoad):
(WebKit::WebInspectorUI::evaluateExpressionOnLoad):
(WebKit::WebInspectorUI::evaluatePendingExpressions):
* WebProcess/WebPage/WebInspectorUI.h: Added.
(WebKit::WebInspectorUI::page):
(WebKit::WebInspectorUI::didClose):
(WebKit::WebInspectorUI::didReceiveInvalidMessage):
(WebKit::WebInspectorUI::attachedBottom):
(WebKit::WebInspectorUI::attachedRight):
(WebKit::WebInspectorUI::detached):
(WebKit::WebInspectorUI::evaluateCommandOnLoad):
* WebProcess/WebPage/WebInspectorUI.messages.in: Added.
* WebProcess/WebPage/efl/WebInspectorUIEfl.cpp: Added.
(WebKit::WebInspectorUI::canSave):
(WebKit::WebInspectorUI::localizedStringsURL):
* WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp: Added.
(WebKit::WebInspectorUI::canSave):
(WebKit::WebInspectorUI::localizedStringsURL):
* WebProcess/WebPage/mac/WebInspectorUIMac.mm: Added.
(WebKit::WebInspectorUI::canSave):
(WebKit::WebInspectorUI::localizedStringsURL):
Implement the InspectorFrontendClient and handle a connection to the inspected page's WebInspector.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::~WebPage):
(WebKit::WebPage::inspector):
(WebKit::WebPage::inspectorUI):
(WebKit::WebPage::didReceiveMessage):
Setup as a listener for WebInspectorUI messages.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isInspectorPage): It is an Inspector page if we have a m_inspectorUI.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::initializeProcessName):
Name the process "%@ Web Inspector" if it is an Inspector content process. Processes in that
context are not shared with multiple pages.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
60 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/ScriptGlobalObject.h
Source/WebCore/bindings/js/ScriptState.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/page/Chrome.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Base/Test.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/DerivedSources.make
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/Shared/APIObject.h
Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.mm
Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm
Source/WebKit2/UIProcess/API/C/WKInspector.cpp
Source/WebKit2/UIProcess/API/C/WKInspector.h
Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Source/WebKit2/UIProcess/WebInspectorProxy.h
Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp [deleted file]
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.h
Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in
Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/efl/WebInspectorUIEfl.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/mac/WebInspectorUIMac.mm [new file with mode: 0644]
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm