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

Unified Diff: Source/platform/scheduler/CancellableTaskFactory.h

Issue 1320023009: Limit stack-allocated uses of CancellableTaskFactory(PassOwnPtr<Closure>). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/scheduler/CancellableTaskFactoryTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scheduler/CancellableTaskFactory.h
diff --git a/Source/platform/scheduler/CancellableTaskFactory.h b/Source/platform/scheduler/CancellableTaskFactory.h
index 932963a6d452b8496c09f94c4e29110396474339..dc378d3a4927a7e3bfa55892313a1d67e2f64704 100644
--- a/Source/platform/scheduler/CancellableTaskFactory.h
+++ b/Source/platform/scheduler/CancellableTaskFactory.h
@@ -48,13 +48,6 @@ public:
return adoptPtr(new CancellableTaskFactory(WTF::bind(method, thisObject)));
}
- // Only intended used by unit tests. Please use leak safe create() factory method, if possible.
- explicit CancellableTaskFactory(PassOwnPtr<Closure> closure)
- : m_closure(closure)
- , m_weakPtrFactory(this)
- {
- }
-
bool isPending() const
{
return m_weakPtrFactory.hasWeakPtrs();
@@ -66,6 +59,15 @@ public:
// ownership of the task. Creating a new task cancels any previous ones.
WebTaskRunner::Task* cancelAndCreate();
+protected:
+ // Only intended used by unit tests wanting to stack allocate and/or pass in a closure value.
+ // Please use the create() factory method elsewhere.
+ explicit CancellableTaskFactory(PassOwnPtr<Closure> closure)
+ : m_closure(closure)
+ , m_weakPtrFactory(this)
+ {
+ }
+
private:
class CancellableTask : public WebTaskRunner::Task {
WTF_MAKE_NONCOPYABLE(CancellableTask);
« no previous file with comments | « no previous file | Source/platform/scheduler/CancellableTaskFactoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698