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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Visitor.h

Issue 2304023003: StackFrameDepth should be managed per ThreadHeap (Closed)
Patch Set: fix Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef Visitor_h 31 #ifndef Visitor_h
32 #define Visitor_h 32 #define Visitor_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/heap/GarbageCollected.h" 35 #include "platform/heap/GarbageCollected.h"
36 #include "platform/heap/StackFrameDepth.h"
36 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
37 #include "wtf/Assertions.h" 38 #include "wtf/Assertions.h"
38 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
39 #include "wtf/HashTraits.h" 40 #include "wtf/HashTraits.h"
40 #include "wtf/TypeTraits.h" 41 #include "wtf/TypeTraits.h"
41 #include <memory> 42 #include <memory>
42 43
43 namespace blink { 44 namespace blink {
44 45
45 template<typename T> class GarbageCollected; 46 template<typename T> class GarbageCollected;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #define DECLARE_TRACE() DECLARE_TRACE_IMPL(EMPTY_MACRO_ARGUMENT) 111 #define DECLARE_TRACE() DECLARE_TRACE_IMPL(EMPTY_MACRO_ARGUMENT)
111 #define DECLARE_VIRTUAL_TRACE() DECLARE_TRACE_IMPL(virtual) 112 #define DECLARE_VIRTUAL_TRACE() DECLARE_TRACE_IMPL(virtual)
112 #define DEFINE_INLINE_TRACE() DEFINE_INLINE_TRACE_IMPL(EMPTY_MACRO_ARGUMENT) 113 #define DEFINE_INLINE_TRACE() DEFINE_INLINE_TRACE_IMPL(EMPTY_MACRO_ARGUMENT)
113 #define DEFINE_INLINE_VIRTUAL_TRACE() DEFINE_INLINE_TRACE_IMPL(virtual) 114 #define DEFINE_INLINE_VIRTUAL_TRACE() DEFINE_INLINE_TRACE_IMPL(virtual)
114 115
115 // VisitorHelper contains common implementation of Visitor helper methods. 116 // VisitorHelper contains common implementation of Visitor helper methods.
116 // 117 //
117 // VisitorHelper avoids virtual methods by using CRTP. 118 // VisitorHelper avoids virtual methods by using CRTP.
118 // c.f. http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern 119 // c.f. http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern
119 template<typename Derived> 120 template<typename Derived>
120 class VisitorHelper { 121 class VisitorHelper : public StackFrameDepth {
haraken 2016/09/06 13:03:11 This looks like a weird class design. This is oka
121 public: 122 public:
122 VisitorHelper(ThreadState* state) : m_state(state) { } 123 VisitorHelper(ThreadState* state) : m_state(state) { }
123 124
124 // One-argument templated mark method. This uses the static type of 125 // One-argument templated mark method. This uses the static type of
125 // the argument to get the TraceTrait. By default, the mark method 126 // the argument to get the TraceTrait. By default, the mark method
126 // of the TraceTrait just calls the virtual two-argument mark method on this 127 // of the TraceTrait just calls the virtual two-argument mark method on this
127 // visitor, where the second argument is the static trace method of the trai t. 128 // visitor, where the second argument is the static trace method of the trai t.
128 template<typename T> 129 template<typename T>
129 void mark(T* t) 130 void mark(T* t)
130 { 131 {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 private: 329 private:
329 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c ast<Visitor*>(helper); } 330 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c ast<Visitor*>(helper); }
330 331
331 ThreadState* m_state; 332 ThreadState* m_state;
332 const MarkingMode m_markingMode; 333 const MarkingMode m_markingMode;
333 }; 334 };
334 335
335 } // namespace blink 336 } // namespace blink
336 337
337 #endif // Visitor_h 338 #endif // Visitor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698