Title: [132788] trunk/Source
Revision
132788
Author
[email protected]
Date
2012-10-29 05:40:05 -0700 (Mon, 29 Oct 2012)

Log Message

Web Inspector: Timeline: make cpu-monitoring feature available only on capable browsers
https://bugs.webkit.org/show_bug.cgi?id=100530

Patch by Eugene Klyuchnikov <[email protected]> on 2012-10-29
Reviewed by Yury Semikhatsky.

Motivation: cpu-monitoring feature looks like a glitch,
when it is not supported by browser.

Source/WebCore:

* inspector/Inspector.json: Added capability getter to protocol.
* inspector/InspectorClient.h: Added capability getter.
* inspector/InspectorTimelineAgent.cpp: Proxy to request to client.
* inspector/InspectorTimelineAgent.h: Added capability getter.
* inspector/front-end/Settings.js: Added capability field.
* inspector/front-end/TimelinePanel.js: Check capability.
* inspector/front-end/inspector.js: Forward capability value.

Source/WebKit/chromium:

* src/InspectorClientImpl.cpp: Implemented capability getter.
* src/InspectorClientImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132787 => 132788)


--- trunk/Source/WebCore/ChangeLog	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/ChangeLog	2012-10-29 12:40:05 UTC (rev 132788)
@@ -1,3 +1,21 @@
+2012-10-29  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: Timeline: make cpu-monitoring feature available only on capable browsers
+        https://bugs.webkit.org/show_bug.cgi?id=100530
+
+        Reviewed by Yury Semikhatsky.
+
+        Motivation: cpu-monitoring feature looks like a glitch,
+        when it is not supported by browser.
+
+        * inspector/Inspector.json: Added capability getter to protocol.
+        * inspector/InspectorClient.h: Added capability getter.
+        * inspector/InspectorTimelineAgent.cpp: Proxy to request to client.
+        * inspector/InspectorTimelineAgent.h: Added capability getter.
+        * inspector/front-end/Settings.js: Added capability field.
+        * inspector/front-end/TimelinePanel.js: Check capability.
+        * inspector/front-end/inspector.js: Forward capability value.
+
 2012-10-29  Antti Koivisto  <[email protected]>
 
         Move seamless stylesheet collecting to DocumentStyleSheetCollection

Modified: trunk/Source/WebCore/inspector/Inspector.json (132787 => 132788)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-10-29 12:40:05 UTC (rev 132788)
@@ -2478,6 +2478,14 @@
                 ],
                 "hidden": true,
                 "description": "Tells whether timeline agent supports frame instrumentation."
+            },
+            {
+                "name": "canMonitorMainThread",
+                "returns": [
+                    { "name": "result", "type": "boolean", "description": "True if timeline supports main thread CPU utilization instrumentation." }
+                ],
+                "hidden": true,
+                "description": "Tells whether timeline agent supports main thread CPU utilization instrumentation."
             }
         ],
         "events": [

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (132787 => 132788)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2012-10-29 12:40:05 UTC (rev 132788)
@@ -57,6 +57,7 @@
     virtual void clearBrowserCache() { }
     virtual bool canClearBrowserCookies() { return false; }
     virtual void clearBrowserCookies() { }
+    virtual bool canMonitorMainThread() { return false; }
     virtual void startMainThreadMonitoring() { }
     virtual void stopMainThreadMonitoring() { }
 

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (132787 => 132788)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-10-29 12:40:05 UTC (rev 132788)
@@ -198,6 +198,11 @@
     m_state->setBoolean(TimelineAgentState::includeMemoryDetails, value);
 }
 
+void InspectorTimelineAgent::canMonitorMainThread(ErrorString*, bool* result)
+{
+    *result = m_client && m_client->canMonitorMainThread();
+}
+
 void InspectorTimelineAgent::supportsFrameInstrumentation(ErrorString*, bool* result)
 {
     *result = m_client && m_client->supportsFrameInstrumentation();

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (132787 => 132788)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-10-29 12:40:05 UTC (rev 132788)
@@ -81,6 +81,7 @@
     virtual void start(ErrorString*, const int* maxCallStackDepth);
     virtual void stop(ErrorString*);
     virtual void setIncludeMemoryDetails(ErrorString*, bool);
+    virtual void canMonitorMainThread(ErrorString*, bool*);
     virtual void supportsFrameInstrumentation(ErrorString*, bool*);
 
     int id() const { return m_id; }

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (132787 => 132788)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-10-29 12:40:05 UTC (rev 132788)
@@ -55,6 +55,7 @@
     heapProfilerPresent: false,
     canOverrideDeviceMetrics: false,
     timelineSupportsFrameInstrumentation: false,
+    canMonitorMainThread: false,
     canOverrideGeolocation: false,
     canOverrideDeviceOrientation: false,
 }

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (132787 => 132788)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-10-29 12:40:05 UTC (rev 132788)
@@ -133,7 +133,7 @@
 
     this._mainThreadTasks = [];
     this._mainThreadMonitoringEnabled = false;
-    if (WebInspector.experimentsSettings.mainThreadMonitoring.isEnabled())
+    if (WebInspector.experimentsSettings.mainThreadMonitoring.isEnabled() && Capabilities.timelineCanMonitorMainThread)
         this._enableMainThreadMonitoring();
 
     this._createFileSelector();

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (132787 => 132788)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-10-29 12:40:05 UTC (rev 132788)
@@ -369,6 +369,7 @@
     ProfilerAgent.isSampling(WebInspector._initializeCapability.bind(WebInspector, "samplingCPUProfiler", null));
     ProfilerAgent.hasHeapProfiler(WebInspector._initializeCapability.bind(WebInspector, "heapProfilerPresent", null));
     TimelineAgent.supportsFrameInstrumentation(WebInspector._initializeCapability.bind(WebInspector, "timelineSupportsFrameInstrumentation", null));
+    TimelineAgent.canMonitorMainThread(WebInspector._initializeCapability.bind(WebInspector, "timelineCanMonitorMainThread", null));
     PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null));
     PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", null));
     PageAgent.canOverrideDeviceOrientation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceOrientation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));

Modified: trunk/Source/WebKit/chromium/ChangeLog (132787 => 132788)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-10-29 12:40:05 UTC (rev 132788)
@@ -1,3 +1,16 @@
+2012-10-29  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: Timeline: make cpu-monitoring feature available only on capable browsers
+        https://bugs.webkit.org/show_bug.cgi?id=100530
+
+        Reviewed by Yury Semikhatsky.
+
+        Motivation: cpu-monitoring feature looks like a glitch,
+        when it is not supported by browser.
+
+        * src/InspectorClientImpl.cpp: Implemented capability getter.
+        * src/InspectorClientImpl.h:
+
 2012-10-29  Kent Tamura  <[email protected]>
 
         [Chromium] Merge LocalizedNumberICUTest into LocaleICUTest

Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp (132787 => 132788)


--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp	2012-10-29 12:40:05 UTC (rev 132788)
@@ -131,6 +131,11 @@
         agent->clearBrowserCookies();
 }
 
+bool InspectorClientImpl::canMonitorMainThread()
+{
+    return true;
+}
+
 void InspectorClientImpl::startMainThreadMonitoring()
 {
     WebKit::Platform::current()->currentThread()->addTaskObserver(this);

Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.h (132787 => 132788)


--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.h	2012-10-29 12:37:57 UTC (rev 132787)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.h	2012-10-29 12:40:05 UTC (rev 132788)
@@ -69,6 +69,7 @@
     virtual bool canClearBrowserCookies();
     virtual void clearBrowserCookies();
 
+    virtual bool canMonitorMainThread();
     virtual void startMainThreadMonitoring();
     virtual void stopMainThreadMonitoring();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to