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

Unified Diff: runtime/vm/isolate.cc

Issue 181503006: Add flag to pin and service command to release isolates (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 2d578a69180f119ca6ccfca032bcd170282f1b15..cee3a586161e14bf6df45bfc1c166fc647f3cca7 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -41,6 +41,8 @@ DEFINE_FLAG(bool, report_usage_count, false,
"Track function usage and report.");
DEFINE_FLAG(bool, trace_isolates, false,
"Trace isolate creation and shut down.");
+DEFINE_FLAG(bool, pin_isolates, false,
+ "Stop isolates from being destroyed automatically.");
void Isolate::RegisterClass(const Class& cls) {
@@ -282,6 +284,7 @@ Isolate::Isolate()
message_notify_callback_(NULL),
name_(NULL),
start_time_(OS::GetCurrentTimeMicros()),
+ pin_port_(0),
main_port_(0),
heap_(NULL),
object_store_(NULL),
@@ -421,6 +424,9 @@ Isolate* Isolate::Init(const char* name_prefix) {
result->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&result));
result->set_main_port(PortMap::CreatePort(result->message_handler()));
result->BuildName(name_prefix);
+ if (FLAG_pin_isolates) {
+ result->CreatePinPort();
+ }
result->debugger_ = new Debugger();
result->debugger_->Initialize(result);
@@ -436,6 +442,28 @@ Isolate* Isolate::Init(const char* name_prefix) {
}
+void Isolate::CreatePinPort() {
+ ASSERT(FLAG_pin_isolates);
+ // Only do this once.
+ ASSERT(pin_port_ == 0);
+ pin_port_ = PortMap::CreatePort(message_handler());
+ ASSERT(pin_port_ != 0);
+ PortMap::SetLive(pin_port_);
+}
+
+
+void Isolate::ClosePinPort() {
+ if (pin_port_ == 0) {
+ // Support multiple calls to close.
+ return;
+ }
+ ASSERT(pin_port_ != 0);
+ bool r = PortMap::ClosePort(pin_port_);
+ ASSERT(r);
+ pin_port_ = 0;
+}
+
+
void Isolate::BuildName(const char* name_prefix) {
ASSERT(name_ == NULL);
if (name_prefix == NULL) {
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698