| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |