Index: runtime/vm/service_isolate.cc |
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc |
index 98cbeb957f7b42abdc8278494681b91bb35100f9..6f16f4190f9bd32fb3e349ded3074841000873cc 100644 |
--- a/runtime/vm/service_isolate.cc |
+++ b/runtime/vm/service_isolate.cc |
@@ -255,7 +255,6 @@ void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) { |
void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) { |
// Construct and cache exit message here so we can send it without needing an |
// isolate. |
- StartIsolateScope iso_scope(I); |
Thread* T = Thread::Current(); |
ASSERT(I == T->isolate()); |
ASSERT(I != NULL); |
@@ -324,12 +323,12 @@ class RunServiceTask : public ThreadPool::Task { |
return; |
} |
- |
- Thread::ExitIsolate(); |
- |
- ServiceIsolate::ConstructExitMessageAndCache(isolate); |
- |
- RunMain(isolate); |
+ { |
+ ASSERT(Isolate::Current() == NULL); |
+ StartIsolateScope start_scope(isolate); |
+ ServiceIsolate::ConstructExitMessageAndCache(isolate); |
+ RunMain(isolate); |
+ } |
ServiceIsolate::FinishedInitializing(); |
@@ -348,6 +347,7 @@ class RunServiceTask : public ThreadPool::Task { |
{ |
// Print the error if there is one. This may execute dart code to |
// print the exception object, so we need to use a StartIsolateScope. |
+ ASSERT(Isolate::Current() == NULL); |
StartIsolateScope start_scope(I); |
Thread* T = Thread::Current(); |
ASSERT(I == T->isolate()); |
@@ -359,10 +359,8 @@ class RunServiceTask : public ThreadPool::Task { |
OS::PrintErr("vm-service: Error: %s\n", error.ToErrorCString()); |
} |
Dart::RunShutdownCallback(); |
- } |
- { |
+ |
// Shut the isolate down. |
- SwitchIsolateScope switch_scope(I); |
Dart::ShutdownIsolate(); |
} |
if (FLAG_trace_service) { |
@@ -376,8 +374,6 @@ class RunServiceTask : public ThreadPool::Task { |
// TODO(24651): Remove this. |
return; |
} |
- |
- StartIsolateScope iso_scope(I); |
Thread* T = Thread::Current(); |
ASSERT(I == T->isolate()); |
StackZone zone(T); |