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

Unified Diff: Source/platform/heap/Handle.h

Issue 1312843009: Improve CancellableTaskFactory handling and Oilpan usage. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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 | « Source/core/html/parser/HTMLParserScheduler.cpp ('k') | Source/platform/scheduler/CancellableTaskFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index 39046ada559b1e6a46e7c7d15ea4baa19a7743dc..5c7c4c68cbd111828faf1d926a5ee22bece309ad 100644
--- a/Source/platform/heap/Handle.h
+++ b/Source/platform/heap/Handle.h
@@ -991,6 +991,16 @@ private:
OwnPtr<Persistent<Self>> m_keepAlive;
};
+template<typename T>
+class AllowCrossThreadWeakPersistent {
+ STACK_ALLOCATED();
+public:
+ explicit AllowCrossThreadWeakPersistent(T* value) : m_value(value) { }
+ CrossThreadWeakPersistent<T> value() const { return m_value; }
haraken 2015/09/03 23:39:33 Just to confirm: All call sites of value() are wri
sof 2015/09/04 05:21:04 No, doing so would require teaching wtf/Functional
haraken 2015/09/04 05:23:38 Makes sense.
sof 2015/09/04 06:50:20 Added a comment + TODO next to the relevant unwrap
+private:
+ CrossThreadWeakPersistent<T> m_value;
+};
+
} // namespace blink
namespace WTF {
@@ -1182,6 +1192,15 @@ struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
};
template<typename T>
+struct ParamStorageTraits<blink::AllowCrossThreadWeakPersistent<T>> {
+ static_assert(sizeof(T), "T must be fully defined");
+ using StorageType = blink::CrossThreadWeakPersistent<T>;
+
+ static StorageType wrap(const blink::AllowCrossThreadWeakPersistent<T>& value) { return value.value(); }
+ static T* unwrap(const StorageType& value) { return value.get(); }
+};
+
+template<typename T>
PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete;
} // namespace WTF
« no previous file with comments | « Source/core/html/parser/HTMLParserScheduler.cpp ('k') | Source/platform/scheduler/CancellableTaskFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698