Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/inspector/protocol/DOM.h" | 9 #include "core/inspector/protocol/DOM.h" |
| 10 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 RefPtr<WebTaskRunner> task_runner = |
| 173 Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 173 Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 174 long long delay_millis = static_cast<long long>(budget.fromJust()); | 174 base::TimeDelta budget_amount = base::TimeDelta::FromMilliseconds( |
| 175 virtual_time_budget_expired_task_handle_ = | 175 budget.fromJust()); |
|
dgozman
2017/04/24 17:10:30
nit: remove the field.
Sami
2017/04/24 17:33:47
Done!
| |
| 176 task_runner->PostDelayedCancellableTask( | 176 web_local_frame_impl_->View()->Scheduler()->GrantVirtualTimeBudget( |
| 177 BLINK_FROM_HERE, | 177 budget_amount, |
| 178 WTF::Bind(&InspectorEmulationAgent::VirtualTimeBudgetExpired, | 178 WTF::Bind(&InspectorEmulationAgent::VirtualTimeBudgetExpired, |
| 179 WrapWeakPersistent(this)), | 179 WrapWeakPersistent(this))); |
| 180 delay_millis); | |
| 181 } | 180 } |
| 182 return Response::OK(); | 181 return Response::OK(); |
| 183 } | 182 } |
| 184 | 183 |
| 185 void InspectorEmulationAgent::VirtualTimeBudgetExpired() { | 184 void InspectorEmulationAgent::VirtualTimeBudgetExpired() { |
| 186 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy( | 185 web_local_frame_impl_->View()->Scheduler()->SetVirtualTimePolicy( |
| 187 WebViewScheduler::VirtualTimePolicy::PAUSE); | 186 WebViewScheduler::VirtualTimePolicy::PAUSE); |
| 188 GetFrontend()->virtualTimeBudgetExpired(); | 187 GetFrontend()->virtualTimeBudgetExpired(); |
| 189 } | 188 } |
| 190 | 189 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 206 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).Rgb()); | 205 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).Rgb()); |
| 207 return Response::OK(); | 206 return Response::OK(); |
| 208 } | 207 } |
| 209 | 208 |
| 210 DEFINE_TRACE(InspectorEmulationAgent) { | 209 DEFINE_TRACE(InspectorEmulationAgent) { |
| 211 visitor->Trace(web_local_frame_impl_); | 210 visitor->Trace(web_local_frame_impl_); |
| 212 InspectorBaseAgent::Trace(visitor); | 211 InspectorBaseAgent::Trace(visitor); |
| 213 } | 212 } |
| 214 | 213 |
| 215 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |