Diff
Modified: trunk/Source/WebKit2/ChangeLog (146517 => 146518)
--- trunk/Source/WebKit2/ChangeLog 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/ChangeLog 2013-03-21 21:16:41 UTC (rev 146518)
@@ -1,3 +1,79 @@
+2013-03-21 Timothy Hatcher <timo...@apple.com>
+
+ Support connecting the Web Inspector without showing it.
+
+ This allows you to get the debugger attached in the background. When a breakpoint is hit
+ the Inspector will open. This change also reduces some WebProcess messaging by removing
+ the DidLoadInspectorPage message and stops sending the SetAttachedWindow message on close.
+
+ https://bugs.webkit.org/show_bug.cgi?id=112445
+
+ Reviewed by Sam Weinig.
+
+ * UIProcess/API/C/WKInspector.cpp:
+ (WKInspectorIsConnected): Added.
+ (WKInspectorConnect): Added.
+ (WKInspectorHide): Added.
+
+ * UIProcess/API/C/WKInspector.h:
+ Added new APIs.
+
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::WebInspectorProxy):
+ Initialize new state booleans.
+
+ (WebKit::WebInspectorProxy::invalidate):
+ Don't set state booleans that didClose already resets.
+
+ (WebKit::WebInspectorProxy::connect): Added.
+ (WebKit::WebInspectorProxy::show):
+ Open if we are already connected. Call connect().
+
+ (WebKit::WebInspectorProxy::hide): Added.
+
+ (WebKit::WebInspectorProxy::close):
+ Call didClose we can detach or close the window immediately instead of waiting for a
+ message from the WebProcess.
+
+ (WebKit::WebInspectorProxy::attach):
+ (WebKit::WebInspectorProxy::detach):
+ Check for !m_page to match other functions.
+
+ (WebKit::WebInspectorProxy::createInspectorPage):
+ (WebKit::WebInspectorProxy::didLoadInspectorPage):
+ Removed. Moved logic to open().
+
+ (WebKit::WebInspectorProxy::open): Added.
+
+ (WebKit::WebInspectorProxy::didClose):
+ Clear new state booleans. Don't perform work again if already closed. Use platformDetach()
+ instead of detach() to avoid sending the SetAttachedWindow message.
+
+ (WebKit::WebInspectorProxy::bringToFront):
+ Call open() if we are not visible yet, otherwise platformBringToFront.
+
+ * UIProcess/WebInspectorProxy.h:
+ (WebKit::WebInspectorProxy::isConnected): Added.
+
+ * UIProcess/WebInspectorProxy.messages.in: Removed DidLoadInspectorPage.
+
+ * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+ (WebKit::WebInspectorProxy::platformHide): Added stub.
+
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::platformHide): Added.
+
+ * UIProcess/qt/WebInspectorProxyQt.cpp:
+ (WebKit::WebInspectorProxy::platformHide): Added stub.
+
+ * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
+ * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h:
+ Removed frontendLoaded().
+
+ * WebProcess/WebPage/WebInspector.cpp:
+ * WebProcess/WebPage/WebInspector.h:
+ Removed didLoadInspectorPage().
+
2013-03-21 Alexey Proskuryakov <a...@apple.com>
Build fix.
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -51,6 +51,16 @@
#endif
}
+bool WKInspectorIsConnected(WKInspectorRef inspectorRef)
+{
+#if ENABLE(INSPECTOR)
+ return toImpl(inspectorRef)->isConnected();
+#else
+ UNUSED_PARAM(inspectorRef);
+ return false;
+#endif
+}
+
bool WKInspectorIsVisible(WKInspectorRef inspectorRef)
{
#if ENABLE(INSPECTOR)
@@ -71,6 +81,15 @@
#endif
}
+void WKInspectorConnect(WKInspectorRef inspectorRef)
+{
+#if ENABLE(INSPECTOR)
+ toImpl(inspectorRef)->connect();
+#else
+ UNUSED_PARAM(inspectorRef);
+#endif
+}
+
void WKInspectorShow(WKInspectorRef inspectorRef)
{
#if ENABLE(INSPECTOR)
@@ -80,6 +99,15 @@
#endif
}
+void WKInspectorHide(WKInspectorRef inspectorRef)
+{
+#if ENABLE(INSPECTOR)
+ toImpl(inspectorRef)->hide();
+#else
+ UNUSED_PARAM(inspectorRef);
+#endif
+}
+
void WKInspectorClose(WKInspectorRef inspectorRef)
{
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h 2013-03-21 21:16:41 UTC (rev 146518)
@@ -40,9 +40,14 @@
WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector);
+WK_EXPORT bool WKInspectorIsConnected(WKInspectorRef inspector);
WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector);
WK_EXPORT bool WKInspectorIsFront(WKInspectorRef inspector);
+
+WK_EXPORT void WKInspectorConnect(WKInspectorRef inspector);
+
WK_EXPORT void WKInspectorShow(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorHide(WKInspectorRef inspector);
WK_EXPORT void WKInspectorClose(WKInspectorRef inspector);
WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector);
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -88,6 +88,9 @@
, m_isDebuggingJavaScript(false)
, m_isProfilingJavaScript(false)
, m_isProfilingPage(false)
+ , m_showMessageSent(false)
+ , m_createdInspectorPage(false)
+ , m_ignoreFirstBringToFront(false)
#if PLATFORM(GTK) || PLATFORM(EFL)
, m_inspectorView(0)
, m_inspectorWindow(0)
@@ -113,14 +116,10 @@
m_page->process()->removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page->pageID());
m_page->close();
+
didClose();
m_page = 0;
-
- m_isVisible = false;
- m_isDebuggingJavaScript = false;
- m_isProfilingJavaScript = false;
- m_isProfilingPage = false;
}
// Public APIs
@@ -132,20 +131,54 @@
return platformIsFront();
}
-void WebInspectorProxy::show()
+void WebInspectorProxy::connect()
{
if (!m_page)
return;
+ if (m_showMessageSent)
+ return;
+
+ m_showMessageSent = true;
+ m_ignoreFirstBringToFront = true;
+
m_page->process()->send(Messages::WebInspector::Show(), m_page->pageID());
}
+void WebInspectorProxy::show()
+{
+ if (!m_page)
+ return;
+
+ if (isConnected()) {
+ open();
+ return;
+ }
+
+ connect();
+
+ // Don't ignore the first bringToFront so it opens the Inspector.
+ m_ignoreFirstBringToFront = false;
+}
+
+void WebInspectorProxy::hide()
+{
+ if (!m_page)
+ return;
+
+ m_isVisible = false;
+
+ platformHide();
+}
+
void WebInspectorProxy::close()
{
if (!m_page)
return;
m_page->process()->send(Messages::WebInspector::Close(), m_page->pageID());
+
+ didClose();
}
void WebInspectorProxy::showConsole()
@@ -168,13 +201,13 @@
{
if (!m_page)
return;
-
+
m_page->process()->send(Messages::WebInspector::ShowMainResourceForFrame(frame->frameID()), m_page->pageID());
}
void WebInspectorProxy::attach()
{
- if (!canAttach())
+ if (!m_page || !canAttach())
return;
m_isAttached = true;
@@ -189,8 +222,11 @@
void WebInspectorProxy::detach()
{
+ if (!m_page)
+ return;
+
m_isAttached = false;
-
+
if (m_isVisible)
inspectorPageGroup()->preferences()->setInspectorStartsAttached(false);
@@ -341,35 +377,53 @@
m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL());
inspectorPage->loadURL(url);
+
+ m_createdInspectorPage = true;
}
-void WebInspectorProxy::didLoadInspectorPage()
+void WebInspectorProxy::open()
{
+ ASSERT(m_createdInspectorPage);
+
m_isVisible = true;
- // platformOpen is responsible for rendering attached mode depending on m_isAttached.
platformOpen();
}
void WebInspectorProxy::didClose()
{
+ if (!m_createdInspectorPage)
+ return;
+
m_isVisible = false;
m_isDebuggingJavaScript = false;
m_isProfilingJavaScript = false;
m_isProfilingPage = false;
+ m_createdInspectorPage = false;
+ m_showMessageSent = false;
+ m_ignoreFirstBringToFront = false;
- if (m_isAttached) {
- // Detach here so we only need to have one code path that is responsible for cleaning up the inspector
- // state.
- detach();
- }
+ if (m_isAttached)
+ platformDetach();
+ m_isAttached = false;
platformDidClose();
}
void WebInspectorProxy::bringToFront()
{
- platformBringToFront();
+ // WebCore::InspectorFrontendClientLocal tells us to do this on load. We want to
+ // ignore it once if we only wanted to connect. This allows the Inspector to later
+ // request to be brought to the front when a breakpoint is hit or some other action.
+ if (m_ignoreFirstBringToFront) {
+ m_ignoreFirstBringToFront = false;
+ return;
+ }
+
+ if (m_isVisible)
+ platformBringToFront();
+ else
+ open();
}
void WebInspectorProxy::attachAvailabilityChanged(bool available)
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2013-03-21 21:16:41 UTC (rev 146518)
@@ -78,10 +78,14 @@
// Public APIs
WebPageProxy* page() const { return m_page; }
+ bool isConnected() const { return m_createdInspectorPage; }
bool isVisible() const { return m_isVisible; }
bool isFront();
+ void connect();
+
void show();
+ void hide();
void close();
#if PLATFORM(MAC)
@@ -144,6 +148,7 @@
void platformOpen();
void platformDidClose();
void platformBringToFront();
+ void platformHide();
bool platformIsFront();
void platformAttachAvailabilityChanged(bool);
void platformInspectedURLChanged(const String&);
@@ -154,7 +159,6 @@
// Called by WebInspectorProxy messages
void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
- void didLoadInspectorPage();
void didClose();
void bringToFront();
void attachAvailabilityChanged(bool);
@@ -167,6 +171,8 @@
bool canAttach();
bool shouldOpenAttached();
+ void open();
+
static WebPageGroup* inspectorPageGroup();
#if PLATFORM(GTK) || PLATFORM(EFL)
@@ -189,6 +195,9 @@
bool m_isDebuggingJavaScript;
bool m_isProfilingJavaScript;
bool m_isProfilingPage;
+ bool m_showMessageSent;
+ bool m_createdInspectorPage;
+ bool m_ignoreFirstBringToFront;
#if PLATFORM(MAC)
RetainPtr<WKWebInspectorWKView> m_inspectorView;
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in 2013-03-21 21:16:41 UTC (rev 146518)
@@ -24,7 +24,6 @@
messages -> WebInspectorProxy {
CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
- DidLoadInspectorPage()
DidClose()
BringToFront()
InspectedURLChanged(WTF::String urlString)
Modified: trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -142,6 +142,11 @@
}
}
+void WebInspectorProxy::platformHide()
+{
+ notImplemented();
+}
+
void WebInspectorProxy::platformBringToFront()
{
notImplemented();
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -125,6 +125,11 @@
m_inspectorView = 0;
}
+void WebInspectorProxy::platformHide()
+{
+ notImplemented();
+}
+
void WebInspectorProxy::platformBringToFront()
{
if (m_client.bringToFront(this))
Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2013-03-21 21:16:41 UTC (rev 146518)
@@ -419,6 +419,20 @@
m_inspectorProxyObjCAdapter = 0;
}
+void WebInspectorProxy::platformHide()
+{
+ if (m_isAttached) {
+ platformDetach();
+ return;
+ }
+
+ if (m_inspectorWindow) {
+ [m_inspectorWindow.get() setDelegate:nil];
+ [m_inspectorWindow.get() orderOut:nil];
+ m_inspectorWindow = 0;
+ }
+}
+
void WebInspectorProxy::platformBringToFront()
{
// FIXME <rdar://problem/10937688>: this will not bring a background tab in Safari to the front, only its window.
Modified: trunk/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp (146517 => 146518)
--- trunk/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -49,6 +49,11 @@
notImplemented();
}
+void WebInspectorProxy::platformHide()
+{
+ notImplemented();
+}
+
void WebInspectorProxy::platformBringToFront()
{
notImplemented();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp (146517 => 146518)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -45,13 +45,6 @@
{
}
-void WebInspectorFrontendClient::frontendLoaded()
-{
- InspectorFrontendClientLocal::frontendLoaded();
-
- m_page->inspector()->didLoadInspectorPage();
-}
-
String WebInspectorFrontendClient::localizedStringsURL()
{
return m_page->inspector()->localizedStringsURL();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h (146517 => 146518)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h 2013-03-21 21:16:41 UTC (rev 146518)
@@ -39,8 +39,6 @@
WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage);
private:
- virtual void frontendLoaded() OVERRIDE;
-
virtual String localizedStringsURL() OVERRIDE;
virtual void bringToFront() OVERRIDE;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (146517 => 146518)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2013-03-21 21:16:41 UTC (rev 146518)
@@ -100,11 +100,6 @@
}
// Called from WebInspectorFrontendClient
-void WebInspector::didLoadInspectorPage()
-{
- WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(), m_page->pageID());
-}
-
void WebInspector::didClose()
{
WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID());
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (146517 => 146518)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2013-03-21 21:02:57 UTC (rev 146517)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2013-03-21 21:16:41 UTC (rev 146518)
@@ -92,7 +92,6 @@
void destroyInspectorPage();
// Called from WebInspectorFrontendClient
- void didLoadInspectorPage();
void didClose();
void bringToFront();
void inspectedURLChanged(const String&);