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

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

Issue 2841463003: scheduler: Make virtual time expiration deterministic (Closed)
Patch Set: Rebased Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/web/InspectorEmulationAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/exported/WebViewBase.h" 7 #include "core/exported/WebViewBase.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/inspector/protocol/DOM.h" 10 #include "core/inspector/protocol/DOM.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy( 162 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy(
163 WebViewScheduler::VirtualTimePolicy::PAUSE); 163 WebViewScheduler::VirtualTimePolicy::PAUSE);
164 } else if (protocol::Emulation::VirtualTimePolicyEnum:: 164 } else if (protocol::Emulation::VirtualTimePolicyEnum::
165 PauseIfNetworkFetchesPending == policy) { 165 PauseIfNetworkFetchesPending == policy) {
166 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy( 166 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy(
167 WebViewScheduler::VirtualTimePolicy::DETERMINISTIC_LOADING); 167 WebViewScheduler::VirtualTimePolicy::DETERMINISTIC_LOADING);
168 } 168 }
169 web_local_frame_impl_->View()->Scheduler()->EnableVirtualTime(); 169 web_local_frame_impl_->View()->Scheduler()->EnableVirtualTime();
170 170
171 if (budget.isJust()) { 171 if (budget.isJust()) {
172 RefPtr<WebTaskRunner> task_runner = 172 base::TimeDelta budget_amount =
173 Platform::Current()->CurrentThread()->GetWebTaskRunner(); 173 base::TimeDelta::FromMilliseconds(budget.fromJust());
174 long long delay_millis = static_cast<long long>(budget.fromJust()); 174 web_local_frame_impl_->View()->Scheduler()->GrantVirtualTimeBudget(
175 virtual_time_budget_expired_task_handle_ = 175 budget_amount,
176 task_runner->PostDelayedCancellableTask( 176 WTF::Bind(&InspectorEmulationAgent::VirtualTimeBudgetExpired,
177 BLINK_FROM_HERE, 177 WrapWeakPersistent(this)));
178 WTF::Bind(&InspectorEmulationAgent::VirtualTimeBudgetExpired,
179 WrapWeakPersistent(this)),
180 delay_millis);
181 } 178 }
182 return Response::OK(); 179 return Response::OK();
183 } 180 }
184 181
185 void InspectorEmulationAgent::VirtualTimeBudgetExpired() { 182 void InspectorEmulationAgent::VirtualTimeBudgetExpired() {
186 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy( 183 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy(
187 WebViewScheduler::VirtualTimePolicy::PAUSE); 184 WebViewScheduler::VirtualTimePolicy::PAUSE);
188 GetFrontend()->virtualTimeBudgetExpired(); 185 GetFrontend()->virtualTimeBudgetExpired();
189 } 186 }
190 187
(...skipping 15 matching lines...) Expand all
206 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).Rgb()); 203 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).Rgb());
207 return Response::OK(); 204 return Response::OK();
208 } 205 }
209 206
210 DEFINE_TRACE(InspectorEmulationAgent) { 207 DEFINE_TRACE(InspectorEmulationAgent) {
211 visitor->Trace(web_local_frame_impl_); 208 visitor->Trace(web_local_frame_impl_);
212 InspectorBaseAgent::Trace(visitor); 209 InspectorBaseAgent::Trace(visitor);
213 } 210 }
214 211
215 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/InspectorEmulationAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698