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

Unified Diff: runtime/vm/thread.h

Issue 850183005: Introduce simple Thread class to support gradual refactoring of interfaces. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
===================================================================
--- runtime/vm/thread.h (revision 0)
+++ runtime/vm/thread.h (working copy)
@@ -0,0 +1,40 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef VM_THREAD_H_
+#define VM_THREAD_H_
+
+#include "vm/isolate.h"
+
+namespace dart {
+
+// A VM thread; may be executing Dart code or performing helper tasks like
+// garbage collection.
+class Thread {
+ public:
+ static Thread* Current() {
+ // For now, there is still just one thread per isolate, and the Thread
+ // class just aliases the Isolate*. Once all interfaces and uses have been
+ // updated to distinguish between isolates and threads, Thread will get its
+ // own thread-local storage key.
+ return reinterpret_cast<Thread*>(Isolate::Current());
+ }
+
+ // The topmost zone used for allocation in this thread.
+ Zone* zone() {
+ return reinterpret_cast<BaseIsolate*>(this)->current_zone();
+ }
+
+ // The isolate that this thread is operating on.
+ Isolate* isolate() {
+ return reinterpret_cast<Isolate*>(this);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Thread);
+};
+
+} // namespace dart
+
+#endif // VM_THREAD_H_
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698