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

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

Issue 1680503002: Tidy up inclusion of WebScheduler.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 "platform/scheduler/CancellableTaskFactory.h" 5 #include "platform/scheduler/CancellableTaskFactory.h"
6 6
7 #include "public/platform/Platform.h" 7 #include "public/platform/Platform.h"
8 #include "wtf/InstanceCounter.h"
9 8
10 namespace blink { 9 namespace blink {
11 10
12 void CancellableTaskFactory::cancel() 11 void CancellableTaskFactory::cancel()
13 { 12 {
14 m_weakPtrFactory.revokeAll(); 13 m_weakPtrFactory.revokeAll();
15 } 14 }
16 15
17 WebTaskRunner::Task* CancellableTaskFactory::cancelAndCreate() 16 WebTaskRunner::Task* CancellableTaskFactory::cancelAndCreate()
18 { 17 {
19 cancel(); 18 cancel();
20 return new CancellableTask(m_weakPtrFactory.createWeakPtr()); 19 return new CancellableTask(m_weakPtrFactory.createWeakPtr());
21 } 20 }
22 21
23 void CancellableTaskFactory::CancellableTask::run() 22 void CancellableTaskFactory::CancellableTask::run()
24 { 23 {
25 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) { 24 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) {
26 Closure* closure = taskFactory->m_closure.get(); 25 Closure* closure = taskFactory->m_closure.get();
27 taskFactory->m_weakPtrFactory.revokeAll(); 26 taskFactory->m_weakPtrFactory.revokeAll();
28 (*closure)(); 27 (*closure)();
29 } 28 }
30 } 29 }
31 30
32 } // namespace blink 31 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698