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

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

Issue 2093603002: Wrap non-GCed raw pointer parameters of WTF::bind with WTF::unretained (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unretained_wrapper
Patch Set: rebase Created 4 years, 6 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 "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "public/platform/WebTaskRunner.h" 10 #include "public/platform/WebTaskRunner.h"
(...skipping 27 matching lines...) Expand all
38 // 38 //
39 template<typename T> 39 template<typename T>
40 static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T ::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr) 40 static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T ::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr)
41 { 41 {
42 return wrapUnique(new CancellableTaskFactory(WTF::bind(method, CrossThre adWeakPersistentThisPointer<T>(thisObject)))); 42 return wrapUnique(new CancellableTaskFactory(WTF::bind(method, CrossThre adWeakPersistentThisPointer<T>(thisObject))));
43 } 43 }
44 44
45 template<typename T> 45 template<typename T>
46 static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T ::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr) 46 static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T ::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr)
47 { 47 {
48 return wrapUnique(new CancellableTaskFactory(WTF::bind(method, thisObjec t))); 48 return wrapUnique(new CancellableTaskFactory(WTF::bind(method, WTF::unre tained(thisObject))));
49 } 49 }
50 50
51 bool isPending() const 51 bool isPending() const
52 { 52 {
53 return m_weakPtrFactory.hasWeakPtrs(); 53 return m_weakPtrFactory.hasWeakPtrs();
54 } 54 }
55 55
56 void cancel(); 56 void cancel();
57 57
58 // Returns a task that can be disabled by calling cancel(). The user takes 58 // Returns a task that can be disabled by calling cancel(). The user takes
(...skipping 26 matching lines...) Expand all
85 WeakPtr<CancellableTaskFactory> m_weakPtr; 85 WeakPtr<CancellableTaskFactory> m_weakPtr;
86 }; 86 };
87 87
88 std::unique_ptr<SameThreadClosure> m_closure; 88 std::unique_ptr<SameThreadClosure> m_closure;
89 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; 89 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory;
90 }; 90 };
91 91
92 } // namespace blink 92 } // namespace blink
93 93
94 #endif // CancellableTaskFactory_h 94 #endif // CancellableTaskFactory_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698