| Index: third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
|
| diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
|
| index ba8f31b71d66cf75371e9b2a69a84c72ef71fe77..279a96c5d4af8cf827f6fa27f7730905d5426789 100644
|
| --- a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
|
| +++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "core/frame/Settings.h"
|
| #include "core/page/Page.h"
|
| #include "platform/geometry/DoubleRect.h"
|
| +#include "public/platform/WebViewScheduler.h"
|
| #include "web/DevToolsEmulator.h"
|
| #include "web/WebLocalFrameImpl.h"
|
| #include "web/WebViewImpl.h"
|
| @@ -92,6 +93,33 @@ void InspectorEmulationAgent::setCPUThrottlingRate(ErrorString*, double throttli
|
| m_client->setCPUThrottlingRate(throttlingRate);
|
| }
|
|
|
| +void InspectorEmulationAgent::enableVirtualTime(ErrorString*)
|
| +{
|
| + for (WebLocalFrame* frame = m_webLocalFrameImpl; frame; frame = frame->traverseNextLocal(false)) {
|
| + frame->view()->scheduler()->enableVirtualTime();
|
| + }
|
| +}
|
| +
|
| +namespace {
|
| +void setVirtualTimePolicyForEachFrame(WebLocalFrameImpl* mainFrame, WebViewScheduler::VirtualTimePolicy policy)
|
| +{
|
| + for (WebLocalFrame* frame = mainFrame; frame; frame = frame->traverseNextLocal(false)) {
|
| + frame->view()->scheduler()->setVirtualTimePolicy(policy);
|
| + }
|
| +}
|
| +}
|
| +
|
| +void InspectorEmulationAgent::setVirtualTimePolicy(ErrorString*, const String& in_policy)
|
| +{
|
| + if (protocol::Emulation::VirtualTimePolicyEnum::Advance == in_policy) {
|
| + setVirtualTimePolicyForEachFrame(m_webLocalFrameImpl, WebViewScheduler::VirtualTimePolicy::ADVANCE);
|
| + } else if (protocol::Emulation::VirtualTimePolicyEnum::Pause == in_policy) {
|
| + setVirtualTimePolicyForEachFrame(m_webLocalFrameImpl, WebViewScheduler::VirtualTimePolicy::PAUSE);
|
| + } else if (protocol::Emulation::VirtualTimePolicyEnum::PauseIfNetworkFetchesPending == in_policy) {
|
| + setVirtualTimePolicyForEachFrame(m_webLocalFrameImpl, WebViewScheduler::VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING);
|
| + }
|
| +}
|
| +
|
| DEFINE_TRACE(InspectorEmulationAgent)
|
| {
|
| visitor->trace(m_webLocalFrameImpl);
|
|
|