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

Side by Side Diff: third_party/WebKit/Source/platform/WebThreadSupportingGC.h

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 WebThreadSupportingGC_h 5 #ifndef WebThreadSupportingGC_h
6 #define WebThreadSupportingGC_h 6 #define WebThreadSupportingGC_h
7 7
8 #include "platform/heap/GCTaskRunner.h" 8 #include "platform/heap/GCTaskRunner.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "public/platform/WebTaskRunner.h" 10 #include "public/platform/WebTaskRunner.h"
(...skipping 11 matching lines...) Expand all
22 // thread allocates any objects managed by the Blink GC. The shutdown 22 // thread allocates any objects managed by the Blink GC. The shutdown
23 // method must be called on the WebThread during shutdown when the thread 23 // method must be called on the WebThread during shutdown when the thread
24 // no longer needs to access objects managed by the Blink GC. 24 // no longer needs to access objects managed by the Blink GC.
25 // 25 //
26 // WebThreadSupportingGC usually internally creates and owns WebThread unless 26 // WebThreadSupportingGC usually internally creates and owns WebThread unless
27 // an existing WebThread is given via createForThread. 27 // an existing WebThread is given via createForThread.
28 class PLATFORM_EXPORT WebThreadSupportingGC final { 28 class PLATFORM_EXPORT WebThreadSupportingGC final {
29 USING_FAST_MALLOC(WebThreadSupportingGC); 29 USING_FAST_MALLOC(WebThreadSupportingGC);
30 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); 30 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC);
31 public: 31 public:
32 static PassOwnPtr<WebThreadSupportingGC> create(const char* name); 32 static PassOwnPtr<WebThreadSupportingGC> create(const char* name, ThreadStat e::PerThreadHeapState);
33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*); 33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*, ThreadS tate::PerThreadHeapState);
34 ~WebThreadSupportingGC(); 34 ~WebThreadSupportingGC();
35 35
36 void postTask(const WebTraceLocation& location, WebTaskRunner::Task* task) 36 void postTask(const WebTraceLocation& location, WebTaskRunner::Task* task)
37 { 37 {
38 m_thread->taskRunner()->postTask(location, task); 38 m_thread->taskRunner()->postTask(location, task);
39 } 39 }
40 40
41 void postDelayedTask(const WebTraceLocation& location, WebTaskRunner::Task* task, long long delayMs) 41 void postDelayedTask(const WebTraceLocation& location, WebTaskRunner::Task* task, long long delayMs)
42 { 42 {
43 m_thread->taskRunner()->postDelayedTask(location, task, delayMs); 43 m_thread->taskRunner()->postDelayedTask(location, task, delayMs);
(...skipping 17 matching lines...) Expand all
61 void initialize(); 61 void initialize();
62 void shutdown(); 62 void shutdown();
63 63
64 WebThread& platformThread() const 64 WebThread& platformThread() const
65 { 65 {
66 ASSERT(m_thread); 66 ASSERT(m_thread);
67 return *m_thread; 67 return *m_thread;
68 } 68 }
69 69
70 private: 70 private:
71 WebThreadSupportingGC(const char* name, WebThread*); 71 WebThreadSupportingGC(const char* name, WebThread*, ThreadState::PerThreadHe apState);
72 72
73 OwnPtr<GCTaskRunner> m_gcTaskRunner; 73 OwnPtr<GCTaskRunner> m_gcTaskRunner;
74 74
75 // m_thread is guaranteed to be non-null after this instance is constructed. 75 // m_thread is guaranteed to be non-null after this instance is constructed.
76 // m_owningThread is non-null unless this instance is constructed for an 76 // m_owningThread is non-null unless this instance is constructed for an
77 // existing thread via createForThread(). 77 // existing thread via createForThread().
78 WebThread* m_thread = nullptr; 78 WebThread* m_thread = nullptr;
79 OwnPtr<WebThread> m_owningThread; 79 OwnPtr<WebThread> m_owningThread;
80 bool m_perThreadHeapEnabled;
80 }; 81 };
81 82
82 } 83 }
83 84
84 #endif 85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698