diff options
author | alph <alph@chromium.org> | 2015-12-11 23:49:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-12 07:50:42 +0000 |
commit | b41f3cfb371039ad925a5e778e3addddd8d8b2b5 (patch) | |
tree | cf54355699a72a9e36a6e8fcfc8d64a11cf1ce91 | |
parent | 49eb643afcbe40a28ddb1a5948387c1b2a16dc80 (diff) | |
download | chromium_src-b41f3cfb371039ad925a5e778e3addddd8d8b2b5.zip chromium_src-b41f3cfb371039ad925a5e778e3addddd8d8b2b5.tar.gz chromium_src-b41f3cfb371039ad925a5e778e3addddd8d8b2b5.tar.bz2 |
DevTools: Initial implementation of slow CPU emulation.
CPU throttling uses SIGUSR2 signal handler to pause the thread.
Current limitations are:
- throttles renderer thread only
- POSIX only supported.
BUG=436111
Review URL: https://codereview.chromium.org/1521113002
Cr-Commit-Position: refs/heads/master@{#364923}
15 files changed, 356 insertions, 11 deletions
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index 27f82f45..fd83a43 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc @@ -322,6 +322,6 @@ Response NetworkHandler::ShowCertificateViewer(int certificate_id) { return Response::OK(); } -} // namespace dom +} // namespace network } // namespace devtools } // namespace content diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 90c328f..0dd79c6 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -164,6 +164,8 @@ 'renderer/devtools/devtools_agent_filter.h', 'renderer/devtools/devtools_client.cc', 'renderer/devtools/devtools_client.h', + 'renderer/devtools/devtools_cpu_throttler.cc', + 'renderer/devtools/devtools_cpu_throttler.h', 'renderer/devtools/lock_free_circular_queue.h', 'renderer/devtools/v8_sampling_profiler.cc', 'renderer/devtools/v8_sampling_profiler.h', diff --git a/content/renderer/devtools/devtools_agent.cc b/content/renderer/devtools/devtools_agent.cc index 55b4c6b..0b9af90 100644 --- a/content/renderer/devtools/devtools_agent.cc +++ b/content/renderer/devtools/devtools_agent.cc @@ -13,6 +13,7 @@ #include "content/common/devtools_messages.h" #include "content/common/frame_messages.h" #include "content/renderer/devtools/devtools_client.h" +#include "content/renderer/devtools/devtools_cpu_throttler.h" #include "content/renderer/render_frame_impl.h" #include "content/renderer/render_widget.h" #include "ipc/ipc_channel.h" @@ -68,7 +69,8 @@ DevToolsAgent::DevToolsAgent(RenderFrameImpl* frame) is_devtools_client_(false), paused_in_mouse_move_(false), paused_(false), - frame_(frame) { + frame_(frame), + cpu_throttler_(new DevToolsCPUThrottler()) { g_agent_for_routing_id.Get()[routing_id()] = this; frame_->GetWebFrame()->setDevToolsAgentClient(this); } @@ -147,6 +149,10 @@ void DevToolsAgent::disableTracing() { TraceLog::GetInstance()->SetDisabled(); } +void DevToolsAgent::setCPUThrottlingRate(double rate) { + cpu_throttler_->SetThrottlingRate(rate); +} + // static DevToolsAgent* DevToolsAgent::FromRoutingId(int routing_id) { IdToAgentMap::iterator it = g_agent_for_routing_id.Get().find(routing_id); diff --git a/content/renderer/devtools/devtools_agent.h b/content/renderer/devtools/devtools_agent.h index f4163d7..4ad9696 100644 --- a/content/renderer/devtools/devtools_agent.h +++ b/content/renderer/devtools/devtools_agent.h @@ -7,6 +7,7 @@ #include <string> +#include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" #include "content/public/common/console_message_level.h" #include "content/public/renderer/render_frame_observer.h" @@ -18,6 +19,7 @@ class WebDevToolsAgent; namespace content { +class DevToolsCPUThrottler; class RenderFrameImpl; // DevToolsAgent belongs to the inspectable RenderFrameImpl and communicates @@ -67,6 +69,8 @@ class CONTENT_EXPORT DevToolsAgent void enableTracing(const blink::WebString& category_filter) override; void disableTracing() override; + void setCPUThrottlingRate(double rate) override; + void OnAttach(const std::string& host_id, int session_id); void OnReattach(const std::string& host_id, int session_id, @@ -82,6 +86,7 @@ class CONTENT_EXPORT DevToolsAgent bool paused_in_mouse_move_; bool paused_; RenderFrameImpl* frame_; + scoped_ptr<DevToolsCPUThrottler> cpu_throttler_; DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); }; diff --git a/content/renderer/devtools/devtools_cpu_throttler.cc b/content/renderer/devtools/devtools_cpu_throttler.cc new file mode 100644 index 0000000..9aa56dc --- /dev/null +++ b/content/renderer/devtools/devtools_cpu_throttler.cc @@ -0,0 +1,185 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/renderer/devtools/devtools_cpu_throttler.h" + +#if defined(OS_POSIX) +#include <signal.h> +#define USE_SIGNALS +#endif + +#include "base/atomicops.h" +#include "base/synchronization/cancellation_flag.h" +#include "base/threading/platform_thread.h" + +using base::subtle::Atomic32; +using base::subtle::Acquire_Load; +using base::subtle::Release_Store; + +namespace content { + +class CPUThrottlingThread final : public base::PlatformThread::Delegate { + public: + explicit CPUThrottlingThread(double rate); + ~CPUThrottlingThread() override; + + void SetThrottlingRate(double rate); + + private: + void ThreadMain() override; + + void Start(); + void Stop(); + void Throttle(); + + static void SuspendThread(base::PlatformThreadHandle thread_handle); + static void ResumeThread(base::PlatformThreadHandle thread_handle); + +#ifdef USE_SIGNALS + void InstallSignalHandler(); + void RestoreSignalHandler(); + static void HandleSignal(int signal); + + static bool signal_handler_installed_; + static struct sigaction old_signal_handler_; + static Atomic32 suspended_; +#endif + static Atomic32 thread_exists_; + + base::PlatformThreadHandle throttled_thread_handle_; + base::PlatformThreadHandle throttling_thread_handle_; + base::CancellationFlag cancellation_flag_; + Atomic32 throttling_rate_percent_; + + DISALLOW_COPY_AND_ASSIGN(CPUThrottlingThread); +}; + +#ifdef USE_SIGNALS +bool CPUThrottlingThread::signal_handler_installed_; +struct sigaction CPUThrottlingThread::old_signal_handler_; +Atomic32 CPUThrottlingThread::suspended_; +#endif +Atomic32 CPUThrottlingThread::thread_exists_; + +CPUThrottlingThread::CPUThrottlingThread(double rate) + : throttled_thread_handle_(base::PlatformThread::CurrentHandle()), + throttling_rate_percent_(static_cast<Atomic32>(rate * 100)) { + CHECK(base::subtle::NoBarrier_AtomicExchange(&thread_exists_, 1) == 0); + Start(); +} + +CPUThrottlingThread::~CPUThrottlingThread() { + Stop(); + CHECK(base::subtle::NoBarrier_AtomicExchange(&thread_exists_, 0) == 1); +} + +void CPUThrottlingThread::SetThrottlingRate(double rate) { + Release_Store(&throttling_rate_percent_, static_cast<Atomic32>(rate * 100)); +} + +void CPUThrottlingThread::ThreadMain() { + base::PlatformThread::SetName("DevToolsCPUThrottlingThread"); + while (!cancellation_flag_.IsSet()) { + Throttle(); + } +} + +#ifdef USE_SIGNALS + +// static +void CPUThrottlingThread::InstallSignalHandler() { + // There must be the only one! + DCHECK(!signal_handler_installed_); + struct sigaction sa; + sa.sa_handler = &HandleSignal; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + signal_handler_installed_ = + (sigaction(SIGUSR2, &sa, &old_signal_handler_) == 0); +} + +// static +void CPUThrottlingThread::RestoreSignalHandler() { + if (!signal_handler_installed_) + return; + sigaction(SIGUSR2, &old_signal_handler_, 0); + signal_handler_installed_ = false; +} + +// static +void CPUThrottlingThread::HandleSignal(int signal) { + if (signal != SIGUSR2) + return; + while (Acquire_Load(&suspended_)) { + } +} + +#endif // USE_SIGNALS + +// static +void CPUThrottlingThread::SuspendThread( + base::PlatformThreadHandle thread_handle) { +#ifdef USE_SIGNALS + Release_Store(&suspended_, 1); + pthread_kill(thread_handle.platform_handle(), SIGUSR2); +#endif +} + +// static +void CPUThrottlingThread::ResumeThread( + base::PlatformThreadHandle thread_handle) { +#ifdef USE_SIGNALS + Release_Store(&suspended_, 0); +#endif +} + +void CPUThrottlingThread::Start() { +#ifdef USE_SIGNALS + InstallSignalHandler(); +#endif + if (!base::PlatformThread::Create(0, this, &throttling_thread_handle_)) { + LOG(ERROR) << "Failed to create throttling thread."; + } +} + +void CPUThrottlingThread::Stop() { + cancellation_flag_.Set(); + base::PlatformThread::Join(throttling_thread_handle_); +#ifdef USE_SIGNALS + RestoreSignalHandler(); +#endif +} + +void CPUThrottlingThread::Throttle() { + const int quant_time_us = 200; + double rate = Acquire_Load(&throttling_rate_percent_) / 100.; + base::TimeDelta run_duration = + base::TimeDelta::FromMicroseconds(static_cast<int>(quant_time_us / rate)); + base::TimeDelta sleep_duration = + base::TimeDelta::FromMicroseconds(quant_time_us) - run_duration; + base::PlatformThread::Sleep(run_duration); + SuspendThread(throttled_thread_handle_); + base::PlatformThread::Sleep(sleep_duration); + ResumeThread(throttled_thread_handle_); +} + +DevToolsCPUThrottler::DevToolsCPUThrottler() {} + +DevToolsCPUThrottler::~DevToolsCPUThrottler() {} + +void DevToolsCPUThrottler::SetThrottlingRate(double rate) { + if (rate <= 1) { + if (throttling_thread_) { + throttling_thread_.reset(); + } + return; + } + if (throttling_thread_) { + throttling_thread_->SetThrottlingRate(rate); + } else { + throttling_thread_.reset(new CPUThrottlingThread(rate)); + } +} + +} // namespace content diff --git a/content/renderer/devtools/devtools_cpu_throttler.h b/content/renderer/devtools/devtools_cpu_throttler.h new file mode 100644 index 0000000..34a9e83 --- /dev/null +++ b/content/renderer/devtools/devtools_cpu_throttler.h @@ -0,0 +1,30 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CPU_THROTTLER_H_ +#define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CPU_THROTTLER_H_ + +#include "base/memory/scoped_ptr.h" +#include "content/common/content_export.h" + +namespace content { + +class CPUThrottlingThread; + +class CONTENT_EXPORT DevToolsCPUThrottler final { + public: + DevToolsCPUThrottler(); + ~DevToolsCPUThrottler(); + + void SetThrottlingRate(double rate); + + private: + scoped_ptr<CPUThrottlingThread> throttling_thread_; + + DISALLOW_COPY_AND_ASSIGN(DevToolsCPUThrottler); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CPU_THROTTLER_H_ diff --git a/content/renderer/devtools/v8_sampling_profiler.cc b/content/renderer/devtools/v8_sampling_profiler.cc index 1d68652..59d824c 100644 --- a/content/renderer/devtools/v8_sampling_profiler.cc +++ b/content/renderer/devtools/v8_sampling_profiler.cc @@ -637,4 +637,4 @@ void V8SamplingProfiler::WaitSamplingEventForTesting() { waitable_event_for_testing_->Wait(); } -} // namespace blink +} // namespace content diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js index 8fd9bbd..75c5f43 100644 --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js @@ -106,6 +106,7 @@ WebInspector.Main.prototype = { Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI themes"); Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox JavaScript frames on Timeline", true); Runtime.experiments.register("colorContrastRatio", "Contrast ratio line in color picker", true); + Runtime.experiments.register("cpuThrottling", "CPU throttling", true); Runtime.experiments.register("deviceMode", "Device mode", true); Runtime.experiments.register("emptySourceMapAutoStepping", "Empty sourcemap auto-stepping"); Runtime.experiments.register("fileSystemInspection", "FileSystem inspection"); diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js index 72fd737..1d34cf2 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js @@ -61,6 +61,9 @@ WebInspector.TimelinePanel = function() this._model.addEventListener(WebInspector.TimelineModel.Events.BufferUsage, this._onTracingBufferUsage, this); this._model.addEventListener(WebInspector.TimelineModel.Events.RetrieveEventsProgress, this._onRetrieveEventsProgress, this); + if (Runtime.experiments.isEnabled("cpuThrottling")) + this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager(); + this._waterfallFilters = [new WebInspector.TimelineStaticFilter()]; if (!Runtime.experiments.isEnabled("timelineEventsTreeView")) { this._filtersControl = new WebInspector.TimelineFilters(); @@ -393,6 +396,27 @@ WebInspector.TimelinePanel.prototype = { this._captureFilmStripSetting, WebInspector.UIString("Capture screenshots while recording. (Has performance overhead)"))); + if (Runtime.experiments.isEnabled("cpuThrottling")) { + this._panelToolbar.appendSeparator(); + this._cpuThrottlingCombobox = new WebInspector.ToolbarComboBox(this._onCPUThrottlingChanged.bind(this)); + /** + * @param {string} name + * @param {number} value + * @this {WebInspector.TimelinePanel} + */ + function addGroupingOption(name, value) + { + var option = this._cpuThrottlingCombobox.createOption(name, "", String(value)); + this._cpuThrottlingCombobox.addOption(option); + if (value === this._cpuThrottlingManager.rate()) + this._cpuThrottlingCombobox.select(option); + } + addGroupingOption.call(this, WebInspector.UIString("No CPU throttling"), 1); + for (var rate of [1.2, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50]) + addGroupingOption.call(this, WebInspector.UIString("%fx slowdown", rate), rate); + this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); + } + this._progressToolbarItem = new WebInspector.ToolbarItem(createElement("div")); this._progressToolbarItem.setVisible(false); this._panelToolbar.appendToolbarItem(this._progressToolbarItem); @@ -567,6 +591,14 @@ WebInspector.TimelinePanel.prototype = { this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true); }, + _onCPUThrottlingChanged: function() + { + if (!this._cpuThrottlingManager) + return; + var value = Number.parseFloat(this._cpuThrottlingCombobox.selectedOption().value); + this._cpuThrottlingManager.setRate(value); + }, + /** * @param {boolean} enabled */ @@ -2037,3 +2069,55 @@ WebInspector.TimelineFilters.prototype = { __proto__: WebInspector.Object.prototype }; + +/** + * @constructor + * @extends {WebInspector.Object} + * @implements {WebInspector.TargetManager.Observer} + */ +WebInspector.CPUThrottlingManager = function() +{ + this._targets = []; + this._throttlingRate = 1.; // No throttling + WebInspector.targetManager.observeTargets(this); +} + +WebInspector.CPUThrottlingManager.prototype = { + /** + * @param {number} value + */ + setRate: function(value) + { + this._throttlingRate = value; + this._targets.forEach(target => target.emulationAgent().setCPUThrottlingRate(value)); + }, + + /** + * @return {number} + */ + rate: function() + { + return this._throttlingRate; + }, + + /** + * @override + * @param {!WebInspector.Target} target + */ + targetAdded: function(target) + { + this._targets.push(target); + target.emulationAgent().setCPUThrottlingRate(this._throttlingRate); + }, + + /** + * @override + * @param {!WebInspector.Target} target + */ + targetRemoved: function(target) + { + this._targets.remove(target, true); + }, + + __proto__: WebInspector.Object.prototype +} diff --git a/third_party/WebKit/Source/devtools/protocol.json b/third_party/WebKit/Source/devtools/protocol.json index 7314906..eb12b96 100644 --- a/third_party/WebKit/Source/devtools/protocol.json +++ b/third_party/WebKit/Source/devtools/protocol.json @@ -715,6 +715,13 @@ "description": "Emulates the given media for CSS media queries." }, { + "name": "setCPUThrottlingRate", + "parameters": [ + { "name": "rate", "type": "number", "description": "Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc)." } + ], + "description": "Enables CPU throttling to emulate slow CPUs." + }, + { "name": "canEmulate", "description": "Tells whether emulation is supported.", "returns": [ diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp index b879e21..3d5a278 100644 --- a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp +++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp @@ -23,14 +23,15 @@ static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; static const char emulatedMedia[] = "emulatedMedia"; } -PassOwnPtrWillBeRawPtr<InspectorEmulationAgent> InspectorEmulationAgent::create(WebLocalFrameImpl* webLocalFrameImpl) +PassOwnPtrWillBeRawPtr<InspectorEmulationAgent> InspectorEmulationAgent::create(WebLocalFrameImpl* webLocalFrameImpl, Client* client) { - return adoptPtrWillBeNoop(new InspectorEmulationAgent(webLocalFrameImpl)); + return adoptPtrWillBeNoop(new InspectorEmulationAgent(webLocalFrameImpl, client)); } -InspectorEmulationAgent::InspectorEmulationAgent(WebLocalFrameImpl* webLocalFrameImpl) +InspectorEmulationAgent::InspectorEmulationAgent(WebLocalFrameImpl* webLocalFrameImpl, Client* client) : InspectorBaseAgent<InspectorEmulationAgent, InspectorFrontend::Emulation>("Emulation") , m_webLocalFrameImpl(webLocalFrameImpl) + , m_client(client) { webViewImpl()->devToolsEmulator()->setEmulationAgent(this); } @@ -99,6 +100,11 @@ void InspectorEmulationAgent::setEmulatedMedia(ErrorString*, const String& media webViewImpl()->page()->settings().setMediaTypeOverride(media); } +void InspectorEmulationAgent::setCPUThrottlingRate(ErrorString*, double throttlingRate) +{ + m_client->setCPUThrottlingRate(throttlingRate); +} + void InspectorEmulationAgent::viewportChanged() { if (!webViewImpl()->devToolsEmulator()->deviceEmulationEnabled() || !frontend()) diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.h b/third_party/WebKit/Source/web/InspectorEmulationAgent.h index 4e87a7d..b25ba84 100644 --- a/third_party/WebKit/Source/web/InspectorEmulationAgent.h +++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.h @@ -18,7 +18,14 @@ using ErrorString = String; class InspectorEmulationAgent final : public InspectorBaseAgent<InspectorEmulationAgent, InspectorFrontend::Emulation>, public InspectorBackendDispatcher::EmulationCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent); public: - static PassOwnPtrWillBeRawPtr<InspectorEmulationAgent> create(WebLocalFrameImpl*); + class Client { + public: + virtual ~Client() {} + + virtual void setCPUThrottlingRate(double rate) {} + }; + + static PassOwnPtrWillBeRawPtr<InspectorEmulationAgent> create(WebLocalFrameImpl*, Client*); ~InspectorEmulationAgent() override; void viewportChanged(); @@ -29,6 +36,7 @@ public: void setScriptExecutionDisabled(ErrorString*, bool) override; void setTouchEmulationEnabled(ErrorString*, bool enabled, const String* configuration) override; void setEmulatedMedia(ErrorString*, const String&) override; + void setCPUThrottlingRate(ErrorString*, double rate) override; // InspectorBaseAgent overrides. void disable(ErrorString*) override; @@ -39,14 +47,13 @@ public: DECLARE_VIRTUAL_TRACE(); private: - explicit InspectorEmulationAgent(WebLocalFrameImpl*); + InspectorEmulationAgent(WebLocalFrameImpl*, Client*); WebViewImpl* webViewImpl(); RawPtrWillBeMember<WebLocalFrameImpl> m_webLocalFrameImpl; + Client* m_client; }; - } // namespace blink - #endif // !defined(InspectorEmulationAgent_h) diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp index 7eef062..676b7a4 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp @@ -296,7 +296,7 @@ PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLoc // remote->local transition we cannot access mainFrameImpl() yet, so we have to store the // frame which will become the main frame later. agent->registerAgent(InspectorRenderingAgent::create(frame)); - agent->registerAgent(InspectorEmulationAgent::create(frame)); + agent->registerAgent(InspectorEmulationAgent::create(frame, agent)); // TODO(dgozman): migrate each of the following agents to frame once module is ready. agent->registerAgent(InspectorDatabaseAgent::create(view->page())); agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page())); @@ -604,6 +604,11 @@ void WebDevToolsAgentImpl::disableTracing() m_client->disableTracing(); } +void WebDevToolsAgentImpl::setCPUThrottlingRate(double rate) +{ + m_client->setCPUThrottlingRate(rate); +} + void WebDevToolsAgentImpl::dispatchOnInspectorBackend(int sessionId, const WebString& message) { if (!m_attached) diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h index 2e7f8e3..44849ad 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h @@ -39,6 +39,7 @@ #include "public/platform/WebSize.h" #include "public/platform/WebThread.h" #include "public/web/WebDevToolsAgent.h" +#include "web/InspectorEmulationAgent.h" #include "wtf/Forward.h" #include "wtf/OwnPtr.h" #include "wtf/Vector.h" @@ -71,6 +72,7 @@ class WebDevToolsAgentImpl final : public NoBaseWillBeGarbageCollectedFinalized<WebDevToolsAgentImpl> , public WebDevToolsAgent , public InspectorStateClient + , public InspectorEmulationAgent::Client , public InspectorTracingAgent::Client , public InspectorRuntimeAgent::Client , public InspectorFrontendChannel @@ -117,6 +119,9 @@ private: void enableTracing(const WTF::String& categoryFilter) override; void disableTracing() override; + // InspectorEmulationAgent::Client implementation. + void setCPUThrottlingRate(double) override; + // InspectorRuntimeAgent::Client implementation. void resumeStartup() override; diff --git a/third_party/WebKit/public/web/WebDevToolsAgentClient.h b/third_party/WebKit/public/web/WebDevToolsAgentClient.h index fa8c9b7..15ae1c3 100644 --- a/third_party/WebKit/public/web/WebDevToolsAgentClient.h +++ b/third_party/WebKit/public/web/WebDevToolsAgentClient.h @@ -68,6 +68,8 @@ public: virtual void enableTracing(const WebString& categoryFilter) { } virtual void disableTracing() { } + virtual void setCPUThrottlingRate(double rate) {} + protected: ~WebDevToolsAgentClient() { } }; |