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

Side by Side Diff: runtime/vm/thread.h

Issue 8528010: Changes to pass the current isolate to all runtime and native calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/unit_test.h » ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
11 #include "vm/isolate.h"
11 12
12 // Declare the OS-specific types ahead of defining the generic classes. 13 // Declare the OS-specific types ahead of defining the generic classes.
13 #if defined(TARGET_OS_LINUX) 14 #if defined(TARGET_OS_LINUX)
14 #include "vm/thread_linux.h" 15 #include "vm/thread_linux.h"
15 #elif defined(TARGET_OS_MACOS) 16 #elif defined(TARGET_OS_MACOS)
16 #include "vm/thread_macos.h" 17 #include "vm/thread_macos.h"
17 #elif defined(TARGET_OS_WINDOWS) 18 #elif defined(TARGET_OS_WINDOWS)
18 #include "vm/thread_win.h" 19 #include "vm/thread_win.h"
19 #else 20 #else
20 #error Unknown target os. 21 #error Unknown target os.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 private: 80 private:
80 MonitorData data_; // OS-specific data. 81 MonitorData data_; // OS-specific data.
81 82
82 DISALLOW_COPY_AND_ASSIGN(Monitor); 83 DISALLOW_COPY_AND_ASSIGN(Monitor);
83 }; 84 };
84 85
85 86
86 class MutexLocker : public StackResource { 87 class MutexLocker : public StackResource {
87 public: 88 public:
88 explicit MutexLocker(Mutex* mutex) : StackResource(), mutex_(mutex) { 89 explicit MutexLocker(Mutex* mutex) :
90 StackResource(Isolate::Current()),
91 mutex_(mutex) {
89 ASSERT(mutex != NULL); 92 ASSERT(mutex != NULL);
90 // TODO(iposva): Consider adding a no GC scope here. 93 // TODO(iposva): Consider adding a no GC scope here.
91 mutex_->Lock(); 94 mutex_->Lock();
92 } 95 }
93 96
94 virtual ~MutexLocker() { 97 virtual ~MutexLocker() {
95 mutex_->Unlock(); 98 mutex_->Unlock();
96 // TODO(iposva): Consider decrementing the no GC scope here. 99 // TODO(iposva): Consider decrementing the no GC scope here.
97 } 100 }
98 101
99 private: 102 private:
100 Mutex* const mutex_; 103 Mutex* const mutex_;
101 104
102 DISALLOW_COPY_AND_ASSIGN(MutexLocker); 105 DISALLOW_COPY_AND_ASSIGN(MutexLocker);
103 }; 106 };
104 107
105 108
106 class MonitorLocker : public StackResource { 109 class MonitorLocker : public StackResource {
107 public: 110 public:
108 explicit MonitorLocker(Monitor* monitor) 111 explicit MonitorLocker(Monitor* monitor)
109 : StackResource(), 112 : StackResource(Isolate::Current()),
110 monitor_(monitor) { 113 monitor_(monitor) {
111 ASSERT(monitor != NULL); 114 ASSERT(monitor != NULL);
112 // TODO(iposva): Consider adding a no GC scope here. 115 // TODO(iposva): Consider adding a no GC scope here.
113 monitor_->Enter(); 116 monitor_->Enter();
114 } 117 }
115 118
116 virtual ~MonitorLocker() { 119 virtual ~MonitorLocker() {
117 monitor_->Exit(); 120 monitor_->Exit();
118 // TODO(iposva): Consider decrementing the no GC scope here. 121 // TODO(iposva): Consider decrementing the no GC scope here.
119 } 122 }
(...skipping 13 matching lines...) Expand all
133 private: 136 private:
134 Monitor* const monitor_; 137 Monitor* const monitor_;
135 138
136 DISALLOW_COPY_AND_ASSIGN(MonitorLocker); 139 DISALLOW_COPY_AND_ASSIGN(MonitorLocker);
137 }; 140 };
138 141
139 } // namespace dart 142 } // namespace dart
140 143
141 144
142 #endif // VM_THREAD_H_ 145 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698