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 <eustas.bug@gmail.com> 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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132788 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 169c61b0
2012-10-29 Eugene Klyuchnikov <eustas.bug@gmail.com>
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 <antti@apple.com>
Move seamless stylesheet collecting to DocumentStyleSheetCollection
......@@ -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": [
......
......@@ -57,6 +57,7 @@ public:
virtual void clearBrowserCache() { }
virtual bool canClearBrowserCookies() { return false; }
virtual void clearBrowserCookies() { }
virtual bool canMonitorMainThread() { return false; }
virtual void startMainThreadMonitoring() { }
virtual void stopMainThreadMonitoring() { }
......
......@@ -198,6 +198,11 @@ void InspectorTimelineAgent::setIncludeMemoryDetails(ErrorString*, bool value)
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();
......
......@@ -81,6 +81,7 @@ public:
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; }
......
......@@ -55,6 +55,7 @@ var Capabilities = {
heapProfilerPresent: false,
canOverrideDeviceMetrics: false,
timelineSupportsFrameInstrumentation: false,
canMonitorMainThread: false,
canOverrideGeolocation: false,
canOverrideDeviceOrientation: false,
}
......
......@@ -133,7 +133,7 @@ WebInspector.TimelinePanel = function()
this._mainThreadTasks = [];
this._mainThreadMonitoringEnabled = false;
if (WebInspector.experimentsSettings.mainThreadMonitoring.isEnabled())
if (WebInspector.experimentsSettings.mainThreadMonitoring.isEnabled() && Capabilities.timelineCanMonitorMainThread)
this._enableMainThreadMonitoring();
this._createFileSelector();
......
......@@ -369,6 +369,7 @@ WebInspector.doLoadedDone = function()
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)));
......
2012-10-29 Eugene Klyuchnikov <eustas.bug@gmail.com>
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 <tkent@chromium.org>
[Chromium] Merge LocalizedNumberICUTest into LocaleICUTest
......
......@@ -131,6 +131,11 @@ void InspectorClientImpl::clearBrowserCookies()
agent->clearBrowserCookies();
}
bool InspectorClientImpl::canMonitorMainThread()
{
return true;
}
void InspectorClientImpl::startMainThreadMonitoring()
{
WebKit::Platform::current()->currentThread()->addTaskObserver(this);
......
......@@ -69,6 +69,7 @@ public:
virtual bool canClearBrowserCookies();
virtual void clearBrowserCookies();
virtual bool canMonitorMainThread();
virtual void startMainThreadMonitoring();
virtual void stopMainThreadMonitoring();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment