| 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 "core/dom/ScriptedIdleTaskController.h" | 5 #include "core/dom/ScriptedIdleTaskController.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
| 8 #include "core/dom/IdleRequestCallback.h" | 8 #include "core/dom/IdleRequestCallback.h" |
| 9 #include "core/dom/IdleRequestOptions.h" | 9 #include "core/dom/IdleRequestOptions.h" |
| 10 #include "core/inspector/InspectorTraceEvents.h" | 10 #include "core/inspector/InspectorTraceEvents.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 double overrunMillis = | 179 double overrunMillis = |
| 180 std::max((monotonicallyIncreasingTime() - deadlineSeconds) * 1000, 0.0); | 180 std::max((monotonicallyIncreasingTime() - deadlineSeconds) * 1000, 0.0); |
| 181 | 181 |
| 182 DEFINE_STATIC_LOCAL( | 182 DEFINE_STATIC_LOCAL( |
| 183 CustomCountHistogram, idleCallbackOverrunHistogram, | 183 CustomCountHistogram, idleCallbackOverrunHistogram, |
| 184 ("WebCore.ScriptedIdleTaskController.IdleCallbackOverrun", 0, 10000, 50)); | 184 ("WebCore.ScriptedIdleTaskController.IdleCallbackOverrun", 0, 10000, 50)); |
| 185 idleCallbackOverrunHistogram.count(overrunMillis); | 185 idleCallbackOverrunHistogram.count(overrunMillis); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void ScriptedIdleTaskController::stop() { | 188 void ScriptedIdleTaskController::contextDestroyed() { |
| 189 m_callbacks.clear(); | 189 m_callbacks.clear(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void ScriptedIdleTaskController::suspend() { | 192 void ScriptedIdleTaskController::suspend() { |
| 193 m_suspended = true; | 193 m_suspended = true; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ScriptedIdleTaskController::resume() { | 196 void ScriptedIdleTaskController::resume() { |
| 197 DCHECK(m_suspended); | 197 DCHECK(m_suspended); |
| 198 m_suspended = false; | 198 m_suspended = false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 RefPtr<internal::IdleRequestCallbackWrapper> callbackWrapper = | 209 RefPtr<internal::IdleRequestCallbackWrapper> callbackWrapper = |
| 210 internal::IdleRequestCallbackWrapper::create(callback.key, this); | 210 internal::IdleRequestCallbackWrapper::create(callback.key, this); |
| 211 m_scheduler->postIdleTask( | 211 m_scheduler->postIdleTask( |
| 212 BLINK_FROM_HERE, | 212 BLINK_FROM_HERE, |
| 213 WTF::bind(&internal::IdleRequestCallbackWrapper::idleTaskFired, | 213 WTF::bind(&internal::IdleRequestCallbackWrapper::idleTaskFired, |
| 214 callbackWrapper)); | 214 callbackWrapper)); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |