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

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

Issue 1674113002: Conditionally define PersistentNode destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PersistentNode_h 5 #ifndef PersistentNode_h
6 #define PersistentNode_h 6 #define PersistentNode_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/heap/ThreadState.h" 9 #include "platform/heap/ThreadState.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
11 #include "wtf/Assertions.h" 11 #include "wtf/Assertions.h"
12 #include "wtf/MainThread.h" 12 #include "wtf/MainThread.h"
13 #include "wtf/ThreadingPrimitives.h" 13 #include "wtf/ThreadingPrimitives.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class CrossThreadPersistentRegion; 17 class CrossThreadPersistentRegion;
18 18
19 class PersistentNode final { 19 class PersistentNode final {
20 DISALLOW_NEW(); 20 DISALLOW_NEW();
21 public: 21 public:
22 PersistentNode() 22 PersistentNode()
23 : m_self(nullptr) 23 : m_self(nullptr)
24 , m_trace(nullptr) 24 , m_trace(nullptr)
25 { 25 {
26 ASSERT(isUnused()); 26 ASSERT(isUnused());
27 } 27 }
28 28
29 #if ENABLE(ASSERT)
29 ~PersistentNode() 30 ~PersistentNode()
30 { 31 {
31 // If you hit this assert, it means that the thread finished 32 // If you hit this assert, it means that the thread finished
32 // without clearing persistent handles that the thread created. 33 // without clearing persistent handles that the thread created.
33 // We don't enable the assert for the main thread because the 34 // We don't enable the assert for the main thread because the
34 // main thread finishes without clearing all persistent handles. 35 // main thread finishes without clearing all persistent handles.
35 ASSERT(isMainThread() || isUnused()); 36 ASSERT(isMainThread() || isUnused());
36 } 37 }
38 #endif
37 39
38 // It is dangrous to copy the PersistentNode because it breaks the 40 // It is dangerous to copy the PersistentNode because it breaks the
39 // free list. 41 // free list.
40 PersistentNode& operator=(const PersistentNode& otherref) = delete; 42 PersistentNode& operator=(const PersistentNode& otherref) = delete;
41 43
42 // Ideally the trace method should be virtual and automatically dispatch 44 // Ideally the trace method should be virtual and automatically dispatch
43 // to the most specific implementation. However having a virtual method 45 // to the most specific implementation. However having a virtual method
44 // on PersistentNode leads to too eager template instantiation with MSVC 46 // on PersistentNode leads to too eager template instantiation with MSVC
45 // which leads to include cycles. 47 // which leads to include cycles.
46 // Instead we call the constructor with a TraceCallback which knows the 48 // Instead we call the constructor with a TraceCallback which knows the
47 // type of the most specific child and calls trace directly. See 49 // type of the most specific child and calls trace directly. See
48 // TraceMethodDelegate in Visitor.h for how this is done. 50 // TraceMethodDelegate in Visitor.h for how this is done.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion 193 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
192 // because we don't want to virtualize performance-sensitive methods 194 // because we don't want to virtualize performance-sensitive methods
193 // such as PersistentRegion::allocate/freePersistentNode. 195 // such as PersistentRegion::allocate/freePersistentNode.
194 OwnPtr<PersistentRegion> m_persistentRegion; 196 OwnPtr<PersistentRegion> m_persistentRegion;
195 Mutex m_mutex; 197 Mutex m_mutex;
196 }; 198 };
197 199
198 } // namespace blink 200 } // namespace blink
199 201
200 #endif 202 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698