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

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

Issue 1568213002: DEFINE_STATIC_LOCAL(): assert against illegal use of GCed types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | third_party/WebKit/Source/wtf/StdLibExtras.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/Handle.h
diff --git a/third_party/WebKit/Source/platform/heap/Handle.h b/third_party/WebKit/Source/platform/heap/Handle.h
index a585ac832b03ae1955c647e43186b9f5f395c363..ee0d8d284fed630f9daa0a9abb6ec78ec81d540c 100644
--- a/third_party/WebKit/Source/platform/heap/Handle.h
+++ b/third_party/WebKit/Source/platform/heap/Handle.h
@@ -52,6 +52,14 @@
namespace blink {
+// Marker used to annotate persistent objects and collections with,
+// so as to enable reliable testing for persistent references via
+// a type trait (see TypeTraits.h's IsPersistentReferenceType<>.)
+#define IS_PERSISTENT_REFERENCE_TYPE() \
+ public: \
+ using IsPersistentReferenceTypeMarker = int; \
+ private:
+
enum WeaknessPersistentConfiguration {
NonWeakPersistentConfiguration,
WeakPersistentConfiguration
@@ -64,6 +72,7 @@ enum CrossThreadnessPersistentConfiguration {
template<typename T, WeaknessPersistentConfiguration weaknessConfiguration, CrossThreadnessPersistentConfiguration crossThreadnessConfiguration>
class PersistentBase {
+ IS_PERSISTENT_REFERENCE_TYPE();
public:
PersistentBase() : m_raw(nullptr)
{
@@ -531,6 +540,7 @@ class PersistentHeapCollectionBase : public Collection {
// heap collections are always allocated off-heap. This allows persistent collections to be used in
// DEFINE_STATIC_LOCAL et. al.
WTF_USE_ALLOCATOR(PersistentHeapCollectionBase, WTF::PartitionAllocator);
+ IS_PERSISTENT_REFERENCE_TYPE();
public:
PersistentHeapCollectionBase()
{
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/StdLibExtras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698