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

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

Issue 946163003: Prevent GCs when constructing GC mixin objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improve naming + optimize allocateOnHeapIndex() usage Created 5 years, 10 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/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 09f8b613f08e67fd420b0943ab0d366c912195a0..c918e95976fc1c1147cd5d8e9281508b6c242b9d 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -923,6 +923,23 @@ private:
#define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(TYPE)
#endif
+// Template to determine if a class is a GarbageCollectedMixin by checking if it
+// has IsGarbageCollectedMixinMarker
+template<typename T>
+struct IsGarbageCollectedMixin {
+private:
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename U> static YesType checkMarker(typename U::IsGarbageCollectedMixinMarker*);
+ template <typename U> static NoType checkMarker(...);
+
+public:
+ static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType);
+};
+
#if ENABLE(GC_PROFILING)
template<typename T>
struct TypenameStringTrait {
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698