Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: third_party/WebKit/Source/web/InspectorEmulationAgent.cpp

Issue 2109843003: Adds enableVirtualTime and setVirtualTimePolicy To Emulation domain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove frame iteration Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/InspectorEmulationAgent.h" 5 #include "web/InspectorEmulationAgent.h"
6 6
7 #include "core/frame/FrameHost.h" 7 #include "core/frame/FrameHost.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/page/Page.h" 10 #include "core/page/Page.h"
11 #include "platform/geometry/DoubleRect.h" 11 #include "platform/geometry/DoubleRect.h"
12 #include "public/platform/WebViewScheduler.h"
12 #include "web/DevToolsEmulator.h" 13 #include "web/DevToolsEmulator.h"
13 #include "web/WebLocalFrameImpl.h" 14 #include "web/WebLocalFrameImpl.h"
14 #include "web/WebViewImpl.h" 15 #include "web/WebViewImpl.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 namespace EmulationAgentState { 19 namespace EmulationAgentState {
19 static const char scriptExecutionDisabled[] = "scriptExecutionDisabled"; 20 static const char scriptExecutionDisabled[] = "scriptExecutionDisabled";
20 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; 21 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
21 static const char emulatedMedia[] = "emulatedMedia"; 22 static const char emulatedMedia[] = "emulatedMedia";
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 { 86 {
86 m_state->setString(EmulationAgentState::emulatedMedia, media); 87 m_state->setString(EmulationAgentState::emulatedMedia, media);
87 webViewImpl()->page()->settings().setMediaTypeOverride(media); 88 webViewImpl()->page()->settings().setMediaTypeOverride(media);
88 } 89 }
89 90
90 void InspectorEmulationAgent::setCPUThrottlingRate(ErrorString*, double throttli ngRate) 91 void InspectorEmulationAgent::setCPUThrottlingRate(ErrorString*, double throttli ngRate)
91 { 92 {
92 m_client->setCPUThrottlingRate(throttlingRate); 93 m_client->setCPUThrottlingRate(throttlingRate);
93 } 94 }
94 95
96 void InspectorEmulationAgent::setVirtualTimePolicy(ErrorString*, const String& i n_policy)
97 {
98 if (protocol::Emulation::VirtualTimePolicyEnum::Advance == in_policy) {
99 m_webLocalFrameImpl->view()->scheduler()->enableVirtualTime();
100 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy(WebViewSc heduler::VirtualTimePolicy::ADVANCE);
101 } else if (protocol::Emulation::VirtualTimePolicyEnum::Pause == in_policy) {
102 m_webLocalFrameImpl->view()->scheduler()->enableVirtualTime();
103 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy(WebViewSc heduler::VirtualTimePolicy::PAUSE);
104 } else if (protocol::Emulation::VirtualTimePolicyEnum::PauseIfNetworkFetches Pending == in_policy) {
105 m_webLocalFrameImpl->view()->scheduler()->enableVirtualTime();
106 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy(WebViewSc heduler::VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING);
107 }
108 }
109
95 DEFINE_TRACE(InspectorEmulationAgent) 110 DEFINE_TRACE(InspectorEmulationAgent)
96 { 111 {
97 visitor->trace(m_webLocalFrameImpl); 112 visitor->trace(m_webLocalFrameImpl);
98 InspectorBaseAgent::trace(visitor); 113 InspectorBaseAgent::trace(visitor);
99 } 114 }
100 115
101 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/InspectorEmulationAgent.h ('k') | third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698