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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.cpp

Issue 2514733002: Scheduler: Deprecate CancellableTaskFactory in favor of WebTaskRunner::postCancellableTask (3) (Closed)
Patch Set: rebase Created 4 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "platform/scheduler/CancellableTaskFactory.h"
6
7 #include "public/platform/Platform.h"
8
9 namespace blink {
10
11 void CancellableTaskFactory::cancel() {
12 m_weakPtrFactory.revokeAll();
13 }
14
15 WebTaskRunner::Task* CancellableTaskFactory::cancelAndCreate() {
16 cancel();
17 return new CancellableTask(m_weakPtrFactory.createWeakPtr());
18 }
19
20 void CancellableTaskFactory::CancellableTask::run() {
21 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) {
22 WTF::Closure* closure = taskFactory->m_closure.get();
23 taskFactory->m_weakPtrFactory.revokeAll();
24 (*closure)();
25 }
26 }
27
28 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698