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

Side by Side Diff: src/v8threads.h

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 8 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 | « src/v8.gyp ('k') | src/v8threads.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 V8_V8THREADS_H_ 5 #ifndef V8_V8THREADS_H_
6 #define V8_V8THREADS_H_ 6 #define V8_V8THREADS_H_
7 7
8 #include "src/isolate.h" 8 #include "src/isolate.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 class RootVisitor;
14 class ThreadLocalTop;
13 15
14 class ThreadState { 16 class ThreadState {
15 public: 17 public:
16 // Returns NULL after the last one. 18 // Returns NULL after the last one.
17 ThreadState* Next(); 19 ThreadState* Next();
18 20
19 enum List {FREE_LIST, IN_USE_LIST}; 21 enum List {FREE_LIST, IN_USE_LIST};
20 22
21 void LinkInto(List list); 23 void LinkInto(List list);
22 void Unlink(); 24 void Unlink();
(...skipping 21 matching lines...) Expand all
44 bool terminate_on_restore_; 46 bool terminate_on_restore_;
45 char* data_; 47 char* data_;
46 ThreadState* next_; 48 ThreadState* next_;
47 ThreadState* previous_; 49 ThreadState* previous_;
48 50
49 ThreadManager* thread_manager_; 51 ThreadManager* thread_manager_;
50 52
51 friend class ThreadManager; 53 friend class ThreadManager;
52 }; 54 };
53 55
54
55 // Defined in isolate.h.
56 class ThreadLocalTop;
57
58
59 class ThreadVisitor { 56 class ThreadVisitor {
60 public: 57 public:
61 // ThreadLocalTop may be only available during this call. 58 // ThreadLocalTop may be only available during this call.
62 virtual void VisitThread(Isolate* isolate, ThreadLocalTop* top) = 0; 59 virtual void VisitThread(Isolate* isolate, ThreadLocalTop* top) = 0;
63 60
64 protected: 61 protected:
65 virtual ~ThreadVisitor() {} 62 virtual ~ThreadVisitor() {}
66 }; 63 };
67 64
68
69 class ThreadManager { 65 class ThreadManager {
70 public: 66 public:
71 void Lock(); 67 void Lock();
72 void Unlock(); 68 void Unlock();
73 69
74 void ArchiveThread(); 70 void ArchiveThread();
75 bool RestoreThread(); 71 bool RestoreThread();
76 void FreeThreadResources(); 72 void FreeThreadResources();
77 bool IsArchived(); 73 bool IsArchived();
78 74
79 void Iterate(ObjectVisitor* v); 75 void Iterate(RootVisitor* v);
80 void IterateArchivedThreads(ThreadVisitor* v); 76 void IterateArchivedThreads(ThreadVisitor* v);
81 bool IsLockedByCurrentThread() { 77 bool IsLockedByCurrentThread() {
82 return mutex_owner_.Equals(ThreadId::Current()); 78 return mutex_owner_.Equals(ThreadId::Current());
83 } 79 }
84 80
85 ThreadId CurrentId(); 81 ThreadId CurrentId();
86 82
87 void TerminateExecution(ThreadId thread_id); 83 void TerminateExecution(ThreadId thread_id);
88 84
89 // Iterate over in-use states. 85 // Iterate over in-use states.
(...skipping 25 matching lines...) Expand all
115 111
116 friend class Isolate; 112 friend class Isolate;
117 friend class ThreadState; 113 friend class ThreadState;
118 }; 114 };
119 115
120 116
121 } // namespace internal 117 } // namespace internal
122 } // namespace v8 118 } // namespace v8
123 119
124 #endif // V8_V8THREADS_H_ 120 #endif // V8_V8THREADS_H_
OLDNEW
« no previous file with comments | « src/v8.gyp ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698