Title: [200959] trunk/Source/WebKit2
Revision
200959
Author
[email protected]
Date
2016-05-16 12:53:00 -0700 (Mon, 16 May 2016)

Log Message

Web Automation: Automation.inspectBrowsingContext should automatically start page profiling
https://bugs.webkit.org/show_bug.cgi?id=157739

Reviewed by Timothy Hatcher.

* UIProcess/API/C/WKInspector.cpp:
(WKInspectorTogglePageProfiling):
Implicitly show the Web Inspector in the C API command to preserve existing behavior.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::inspectorFrontendLoaded):
If the frontend loaded, it was either because the user opened Web Inspector (and
turning on page profiling is harmless), or it was loaded but not shown by the
inspectBrowsingContext command. For the latter, we want to start page profiling
before processing any additional commands so subsequent execution is captured.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::togglePageProfiling):
Send the start/stop profiling messages directly to the WebInspectorUI process instead of
bouncing through the inspected page's process, which does an implicit show() we don't want.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::inspector): Make it const.
* UIProcess/WebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (200958 => 200959)


--- trunk/Source/WebKit2/ChangeLog	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-16 19:53:00 UTC (rev 200959)
@@ -1,3 +1,30 @@
+2016-05-16  Brian Burg  <[email protected]>
+
+        Web Automation: Automation.inspectBrowsingContext should automatically start page profiling
+        https://bugs.webkit.org/show_bug.cgi?id=157739
+
+        Reviewed by Timothy Hatcher.
+
+        * UIProcess/API/C/WKInspector.cpp:
+        (WKInspectorTogglePageProfiling):
+        Implicitly show the Web Inspector in the C API command to preserve existing behavior.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::inspectorFrontendLoaded):
+        If the frontend loaded, it was either because the user opened Web Inspector (and
+        turning on page profiling is harmless), or it was loaded but not shown by the
+        inspectBrowsingContext command. For the latter, we want to start page profiling
+        before processing any additional commands so subsequent execution is captured.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::togglePageProfiling):
+        Send the start/stop profiling messages directly to the WebInspectorUI process instead of
+        bouncing through the inspected page's process, which does an implicit show() we don't want.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::inspector): Make it const.
+        * UIProcess/WebPageProxy.h:
+
 2016-05-16  Conrad Shultz  <[email protected]>
 
         Fix some deprecation warnings.

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp (200958 => 200959)


--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp	2016-05-16 19:53:00 UTC (rev 200959)
@@ -117,6 +117,7 @@
 
 void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef)
 {
+    toImpl(inspectorRef)->show();
     toImpl(inspectorRef)->togglePageProfiling();
 }
 

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (200958 => 200959)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-05-16 19:53:00 UTC (rev 200959)
@@ -459,6 +459,9 @@
 {
     if (auto callback = m_pendingInspectorCallbacksPerPage.take(page.pageID()))
         callback->sendSuccess(InspectorObject::create());
+
+    // Start collecting profile information immediately so the entire session is captured.
+    page.inspector()->togglePageProfiling();
 }
 
 void WebAutomationSession::evaluateJavaScriptFunction(Inspector::ErrorString& errorString, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<EvaluateJavaScriptFunctionCallback>&& callback)

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (200958 => 200959)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2016-05-16 19:53:00 UTC (rev 200959)
@@ -296,9 +296,9 @@
         return;
 
     if (m_isProfilingPage)
-        m_inspectedPage->process().send(Messages::WebInspector::StopPageProfiling(), m_inspectedPage->pageID());
+        m_inspectorPage->process().send(Messages::WebInspectorUI::StopPageProfiling(), m_inspectorPage->pageID());
     else
-        m_inspectedPage->process().send(Messages::WebInspector::StartPageProfiling(), m_inspectedPage->pageID());
+        m_inspectorPage->process().send(Messages::WebInspectorUI::StartPageProfiling(), m_inspectorPage->pageID());
 
     // FIXME: have the WebProcess notify us on state changes.
     m_isProfilingPage = !m_isProfilingPage;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (200958 => 200959)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-05-16 19:53:00 UTC (rev 200959)
@@ -4034,7 +4034,7 @@
 #endif
 
 // Inspector
-WebInspectorProxy* WebPageProxy::inspector()
+WebInspectorProxy* WebPageProxy::inspector() const
 {
     if (isClosed() || !isValid())
         return 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (200958 => 200959)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-05-16 19:41:01 UTC (rev 200958)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-05-16 19:53:00 UTC (rev 200959)
@@ -310,7 +310,7 @@
     void didEnterFullscreen();
     void didExitFullscreen();
 
-    WebInspectorProxy* inspector();
+    WebInspectorProxy* inspector() const;
 
     bool isControlledByAutomation() const { return m_controlledByAutomation; }
     void setControlledByAutomation(bool);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to