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

Side by Side Diff: Source/platform/scheduler/CancellableTaskFactory.h

Issue 937883003: Rename CancellableTaskFactory::task() for clarity. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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
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 #ifndef CancellableTaskFactory_h 5 #ifndef CancellableTaskFactory_h
6 #define CancellableTaskFactory_h 6 #define CancellableTaskFactory_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "public/platform/WebScheduler.h" 9 #include "public/platform/WebScheduler.h"
10 #include "wtf/Functional.h" 10 #include "wtf/Functional.h"
(...skipping 18 matching lines...) Expand all
29 29
30 bool isPending() const 30 bool isPending() const
31 { 31 {
32 return m_weakPtrFactory.hasWeakPtrs(); 32 return m_weakPtrFactory.hasWeakPtrs();
33 } 33 }
34 34
35 void cancel(); 35 void cancel();
36 36
37 // Returns a task that can be disabled by calling cancel(). The user takes 37 // Returns a task that can be disabled by calling cancel(). The user takes
38 // ownership of the task. Creating a new task cancels any previous ones. 38 // ownership of the task. Creating a new task cancels any previous ones.
39 WebThread::Task* task(); 39 WebThread::Task* cancelAndCreate();
40 40
41 private: 41 private:
42 class CancellableTask : public WebThread::Task { 42 class CancellableTask : public WebThread::Task {
43 WTF_MAKE_NONCOPYABLE(CancellableTask); 43 WTF_MAKE_NONCOPYABLE(CancellableTask);
44 44
45 public: 45 public:
46 explicit CancellableTask(WeakPtr<CancellableTaskFactory> weakPtr) 46 explicit CancellableTask(WeakPtr<CancellableTaskFactory> weakPtr)
47 : m_weakPtr(weakPtr) { } 47 : m_weakPtr(weakPtr) { }
48 48
49 virtual ~CancellableTask() { } 49 virtual ~CancellableTask() { }
50 50
51 void run() override; 51 void run() override;
52 52
53 private: 53 private:
54 WeakPtr<CancellableTaskFactory> m_weakPtr; 54 WeakPtr<CancellableTaskFactory> m_weakPtr;
55 }; 55 };
56 56
57 OwnPtr<Closure> m_closure; 57 OwnPtr<Closure> m_closure;
58 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; 58 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory;
59 }; 59 };
60 60
61 } // namespace blink 61 } // namespace blink
62 62
63 #endif // CancellableTaskFactory_h 63 #endif // CancellableTaskFactory_h
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLParserScheduler.cpp ('k') | Source/platform/scheduler/CancellableTaskFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698