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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp

Issue 2876513002: Use WTF::TimeDelta to specify delays on WebTaskRunner (Closed)
Patch Set: 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 | « no previous file | third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp » ('j') | 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 "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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 probe::AsyncTaskScheduled(GetExecutionContext(), "requestIdleCallback", 106 probe::AsyncTaskScheduled(GetExecutionContext(), "requestIdleCallback",
107 callback); 107 callback);
108 108
109 RefPtr<internal::IdleRequestCallbackWrapper> callback_wrapper = 109 RefPtr<internal::IdleRequestCallbackWrapper> callback_wrapper =
110 internal::IdleRequestCallbackWrapper::Create(id, this); 110 internal::IdleRequestCallbackWrapper::Create(id, this);
111 scheduler_->PostIdleTask( 111 scheduler_->PostIdleTask(
112 BLINK_FROM_HERE, 112 BLINK_FROM_HERE,
113 WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired, 113 WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
114 callback_wrapper)); 114 callback_wrapper));
115 if (timeout_millis > 0) 115 if (timeout_millis > 0) {
116 scheduler_->TimerTaskRunner()->PostDelayedTask( 116 scheduler_->TimerTaskRunner()->PostDelayedTask(
117 BLINK_FROM_HERE, 117 BLINK_FROM_HERE,
118 WTF::Bind(&internal::IdleRequestCallbackWrapper::TimeoutFired, 118 WTF::Bind(&internal::IdleRequestCallbackWrapper::TimeoutFired,
119 callback_wrapper), 119 callback_wrapper),
120 timeout_millis); 120 WTF::TimeDelta::FromMilliseconds(timeout_millis));
haraken 2017/05/10 15:12:54 WTF:: wouldn't be needed.
tzik 2017/05/11 07:15:18 Done.
121 }
121 TRACE_EVENT_INSTANT1("devtools.timeline", "RequestIdleCallback", 122 TRACE_EVENT_INSTANT1("devtools.timeline", "RequestIdleCallback",
122 TRACE_EVENT_SCOPE_THREAD, "data", 123 TRACE_EVENT_SCOPE_THREAD, "data",
123 InspectorIdleCallbackRequestEvent::Data( 124 InspectorIdleCallbackRequestEvent::Data(
124 GetExecutionContext(), id, timeout_millis)); 125 GetExecutionContext(), id, timeout_millis));
125 return id; 126 return id;
126 } 127 }
127 128
128 void ScriptedIdleTaskController::CancelCallback(CallbackId id) { 129 void ScriptedIdleTaskController::CancelCallback(CallbackId id) {
129 TRACE_EVENT_INSTANT1( 130 TRACE_EVENT_INSTANT1(
130 "devtools.timeline", "CancelIdleCallback", TRACE_EVENT_SCOPE_THREAD, 131 "devtools.timeline", "CancelIdleCallback", TRACE_EVENT_SCOPE_THREAD,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 RefPtr<internal::IdleRequestCallbackWrapper> callback_wrapper = 218 RefPtr<internal::IdleRequestCallbackWrapper> callback_wrapper =
218 internal::IdleRequestCallbackWrapper::Create(callback.key, this); 219 internal::IdleRequestCallbackWrapper::Create(callback.key, this);
219 scheduler_->PostIdleTask( 220 scheduler_->PostIdleTask(
220 BLINK_FROM_HERE, 221 BLINK_FROM_HERE,
221 WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired, 222 WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
222 callback_wrapper)); 223 callback_wrapper));
223 } 224 }
224 } 225 }
225 226
226 } // namespace blink 227 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698