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

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

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 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
« no previous file with comments | « Source/platform/WebThread.cpp ('k') | Source/platform/WebThreadSupportingGC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/glue/MessageLoopInterruptor.h" 8 #include "platform/heap/glue/MessageLoopInterruptor.h"
9 #include "platform/heap/glue/PendingGCRunner.h" 9 #include "platform/heap/glue/PendingGCRunner.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
11 #include "public/platform/WebTaskRunner.h"
11 #include "public/platform/WebThread.h" 12 #include "public/platform/WebThread.h"
12 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
13 #include "wtf/OwnPtr.h" 14 #include "wtf/OwnPtr.h"
14 #include "wtf/PassOwnPtr.h" 15 #include "wtf/PassOwnPtr.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 // WebThreadSupportingGC wraps a WebThread and adds support for attaching 19 // WebThreadSupportingGC wraps a WebThread and adds support for attaching
19 // to and detaching from the Blink GC infrastructure. The initialize method 20 // to and detaching from the Blink GC infrastructure. The initialize method
20 // must be called during initialization on the WebThread and before the 21 // must be called during initialization on the WebThread and before the
21 // thread allocates any objects managed by the Blink GC. The shutdown 22 // thread allocates any objects managed by the Blink GC. The shutdown
22 // 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
23 // no longer needs to access objects managed by the Blink GC. 24 // no longer needs to access objects managed by the Blink GC.
24 // 25 //
25 // WebThreadSupportingGC usually internally creates and owns WebThread unless 26 // WebThreadSupportingGC usually internally creates and owns WebThread unless
26 // an existing WebThread is given via createForThread. 27 // an existing WebThread is given via createForThread.
27 class PLATFORM_EXPORT WebThreadSupportingGC final { 28 class PLATFORM_EXPORT WebThreadSupportingGC final {
28 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); 29 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC);
29 public: 30 public:
30 static PassOwnPtr<WebThreadSupportingGC> create(const char* name); 31 static PassOwnPtr<WebThreadSupportingGC> create(const char* name);
31 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*); 32 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*);
32 ~WebThreadSupportingGC(); 33 ~WebThreadSupportingGC();
33 34
34 void postTask(const WebTraceLocation& location, WebThread::Task* task) 35 void postTask(const WebTraceLocation& location, WebTaskRunner::Task* task)
35 { 36 {
36 m_thread->postTask(location, task); 37 m_thread->taskRunner()->postTask(location, task);
37 } 38 }
38 39
39 void postDelayedTask(const WebTraceLocation& location, WebThread::Task* task , long long delayMs) 40 void postDelayedTask(const WebTraceLocation& location, WebTaskRunner::Task* task, long long delayMs)
40 { 41 {
41 m_thread->postDelayedTask(location, task, delayMs); 42 m_thread->taskRunner()->postDelayedTask(location, task, delayMs);
42 } 43 }
43 44
44 bool isCurrentThread() const 45 bool isCurrentThread() const
45 { 46 {
46 return m_thread->isCurrentThread(); 47 return m_thread->isCurrentThread();
47 } 48 }
48 49
49 void addTaskObserver(WebThread::TaskObserver* observer) 50 void addTaskObserver(WebThread::TaskObserver* observer)
50 { 51 {
51 m_thread->addTaskObserver(observer); 52 m_thread->addTaskObserver(observer);
(...skipping 21 matching lines...) Expand all
73 // m_thread is guaranteed to be non-null after this instance is constructed. 74 // m_thread is guaranteed to be non-null after this instance is constructed.
74 // m_owningThread is non-null unless this instance is constructed for an 75 // m_owningThread is non-null unless this instance is constructed for an
75 // existing thread via createForThread(). 76 // existing thread via createForThread().
76 WebThread* m_thread = nullptr; 77 WebThread* m_thread = nullptr;
77 OwnPtr<WebThread> m_owningThread; 78 OwnPtr<WebThread> m_owningThread;
78 }; 79 };
79 80
80 } 81 }
81 82
82 #endif 83 #endif
OLDNEW
« no previous file with comments | « Source/platform/WebThread.cpp ('k') | Source/platform/WebThreadSupportingGC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698