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

Side by Side Diff: runtime/vm/isolate.cc

Issue 1665773004: Add necessary support functions so that embedders can implemented pause on start and exit (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « runtime/vm/isolate.h ('k') | runtime/vm/message_handler.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 MutexLocker ml(mutex_); 1062 MutexLocker ml(mutex_);
1063 // Check if we are in a valid state to make the isolate runnable. 1063 // Check if we are in a valid state to make the isolate runnable.
1064 if (is_runnable() == true) { 1064 if (is_runnable() == true) {
1065 return false; // Already runnable. 1065 return false; // Already runnable.
1066 } 1066 }
1067 // Set the isolate as runnable and if we are being spawned schedule 1067 // Set the isolate as runnable and if we are being spawned schedule
1068 // isolate on thread pool for execution. 1068 // isolate on thread pool for execution.
1069 ASSERT(object_store()->root_library() != Library::null()); 1069 ASSERT(object_store()->root_library() != Library::null());
1070 set_is_runnable(true); 1070 set_is_runnable(true);
1071 if (!ServiceIsolate::IsServiceIsolate(this)) { 1071 if (!ServiceIsolate::IsServiceIsolate(this)) {
1072 message_handler()->set_pause_on_start(FLAG_pause_isolates_on_start);
1073 message_handler()->set_pause_on_exit(FLAG_pause_isolates_on_exit);
1074 if (FLAG_pause_isolates_on_unhandled_exceptions) { 1072 if (FLAG_pause_isolates_on_unhandled_exceptions) {
1075 debugger()->SetExceptionPauseInfo(kPauseOnUnhandledExceptions); 1073 debugger()->SetExceptionPauseInfo(kPauseOnUnhandledExceptions);
1076 } 1074 }
1077 } 1075 }
1078 IsolateSpawnState* state = spawn_state(); 1076 IsolateSpawnState* state = spawn_state();
1079 if (state != NULL) { 1077 if (state != NULL) {
1080 ASSERT(this == state->isolate()); 1078 ASSERT(this == state->isolate());
1081 Run(); 1079 Run();
1082 } 1080 }
1083 TimelineStream* stream = GetIsolateStream(); 1081 TimelineStream* stream = GetIsolateStream();
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 static_cast<int64_t>(origin_id())); 1809 static_cast<int64_t>(origin_id()));
1812 int64_t start_time_millis = start_time() / kMicrosecondsPerMillisecond; 1810 int64_t start_time_millis = start_time() / kMicrosecondsPerMillisecond;
1813 jsobj.AddPropertyTimeMillis("startTime", start_time_millis); 1811 jsobj.AddPropertyTimeMillis("startTime", start_time_millis);
1814 { 1812 {
1815 JSONObject jsheap(&jsobj, "_heaps"); 1813 JSONObject jsheap(&jsobj, "_heaps");
1816 heap()->PrintToJSONObject(Heap::kNew, &jsheap); 1814 heap()->PrintToJSONObject(Heap::kNew, &jsheap);
1817 heap()->PrintToJSONObject(Heap::kOld, &jsheap); 1815 heap()->PrintToJSONObject(Heap::kOld, &jsheap);
1818 } 1816 }
1819 1817
1820 jsobj.AddProperty("livePorts", message_handler()->live_ports()); 1818 jsobj.AddProperty("livePorts", message_handler()->live_ports());
1821 jsobj.AddProperty("pauseOnExit", message_handler()->pause_on_exit()); 1819 jsobj.AddProperty("pauseOnExit", message_handler()->should_pause_on_exit());
1822 1820
1823 if (message_handler()->paused_on_start()) { 1821 if (message_handler()->is_paused_on_start()) {
1824 ASSERT(debugger()->PauseEvent() == NULL); 1822 ASSERT(debugger()->PauseEvent() == NULL);
1825 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); 1823 ServiceEvent pause_event(this, ServiceEvent::kPauseStart);
1826 jsobj.AddProperty("pauseEvent", &pause_event); 1824 jsobj.AddProperty("pauseEvent", &pause_event);
1827 } else if (message_handler()->paused_on_exit()) { 1825 } else if (message_handler()->is_paused_on_exit()) {
1828 ASSERT(debugger()->PauseEvent() == NULL); 1826 ASSERT(debugger()->PauseEvent() == NULL);
1829 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); 1827 ServiceEvent pause_event(this, ServiceEvent::kPauseExit);
1830 jsobj.AddProperty("pauseEvent", &pause_event); 1828 jsobj.AddProperty("pauseEvent", &pause_event);
1831 } else if (debugger()->PauseEvent() != NULL && !resume_request_) { 1829 } else if (debugger()->PauseEvent() != NULL && !resume_request_) {
1832 ServiceEvent pause_event(debugger()->PauseEvent()); 1830 ServiceEvent pause_event(debugger()->PauseEvent());
1833 jsobj.AddProperty("pauseEvent", &pause_event); 1831 jsobj.AddProperty("pauseEvent", &pause_event);
1834 } else { 1832 } else {
1835 ServiceEvent pause_event(this, ServiceEvent::kResume); 1833 ServiceEvent pause_event(this, ServiceEvent::kResume);
1836 1834
1837 // TODO(turnidge): Don't compute a full stack trace. 1835 // TODO(turnidge): Don't compute a full stack trace.
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 void IsolateSpawnState::DecrementSpawnCount() { 2630 void IsolateSpawnState::DecrementSpawnCount() {
2633 ASSERT(spawn_count_monitor_ != NULL); 2631 ASSERT(spawn_count_monitor_ != NULL);
2634 ASSERT(spawn_count_ != NULL); 2632 ASSERT(spawn_count_ != NULL);
2635 MonitorLocker ml(spawn_count_monitor_); 2633 MonitorLocker ml(spawn_count_monitor_);
2636 ASSERT(*spawn_count_ > 0); 2634 ASSERT(*spawn_count_ > 0);
2637 *spawn_count_ = *spawn_count_ - 1; 2635 *spawn_count_ = *spawn_count_ - 1;
2638 ml.Notify(); 2636 ml.Notify();
2639 } 2637 }
2640 2638
2641 } // namespace dart 2639 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698