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

Unified Diff: runtime/vm/isolate.h

Issue 13932024: Added a run state field to Isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.h
===================================================================
--- runtime/vm/isolate.h (revision 21380)
+++ runtime/vm/isolate.h (working copy)
@@ -273,6 +273,11 @@
kVmStatusInterrupt,
};
+ enum IsolateRunState {
+ kIsolateWaiting = 0, // The isolate is waiting for code to execute.
+ kIsolateRunning, // The isolate is executing code.
+ };
+
void ScheduleInterrupts(uword interrupt_bits);
uword GetAndClearInterrupts();
@@ -285,6 +290,9 @@
bool is_runnable() const { return is_runnable_; }
void set_is_runnable(bool value) { is_runnable_ = value; }
+ IsolateRunState running_state() const { return running_state_; }
+ void set_running_state(IsolateRunState value) { running_state_ = value; }
+
uword spawn_data() const { return spawn_data_; }
void set_spawn_data(uword value) { spawn_data_ = value; }
@@ -492,6 +500,7 @@
MessageHandler* message_handler_;
uword spawn_data_;
bool is_runnable_;
+ IsolateRunState running_state_;
GcPrologueCallbacks gc_prologue_callbacks_;
GcEpilogueCallbacks gc_epilogue_callbacks_;
@@ -607,6 +616,29 @@
char* exception_callback_name_;
};
+
+class IsolateRunStateManager : public StackResource {
+ public:
+ explicit IsolateRunStateManager()
+ : StackResource(Isolate::Current()),
+ saved_state_(Isolate::kIsolateWaiting) {
+ saved_state_ = reinterpret_cast<Isolate*>(isolate())->running_state();
+ }
+
+ virtual ~IsolateRunStateManager() {
+ reinterpret_cast<Isolate*>(isolate())->set_running_state(saved_state_);
+ }
+
+ void SetRunState(Isolate::IsolateRunState run_state) {
+ reinterpret_cast<Isolate*>(isolate())->set_running_state(run_state);
+ }
+
+ private:
+ Isolate::IsolateRunState saved_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(IsolateRunStateManager);
+};
+
} // namespace dart
#endif // VM_ISOLATE_H_
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698