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

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

Issue 2567193002: Added method to IsolateVisitor to check for special isolates (i.e., service / vm isolates) since th… (Closed)
Patch Set: Changed name of IsSpecialIsolate to IsVMInternalIsolate Created 4 years 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/service.cc » ('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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return new Message(dest_port, obj.raw(), Message::kNormalPriority); 121 return new Message(dest_port, obj.raw(), Message::kNormalPriority);
122 } else { 122 } else {
123 uint8_t* obj_data; 123 uint8_t* obj_data;
124 intptr_t obj_len; 124 intptr_t obj_len;
125 SerializeObject(obj, &obj_data, &obj_len, false); 125 SerializeObject(obj, &obj_data, &obj_len, false);
126 return new Message(dest_port, obj_data, obj_len, Message::kNormalPriority); 126 return new Message(dest_port, obj_data, obj_len, Message::kNormalPriority);
127 } 127 }
128 } 128 }
129 129
130 130
131 bool IsolateVisitor::IsVMInternalIsolate(Isolate* isolate) const {
132 return ((isolate == Dart::vm_isolate()) ||
133 ServiceIsolate::IsServiceIsolateDescendant(isolate));
134 }
135
136
131 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { 137 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) {
132 thread->DeferOOBMessageInterrupts(); 138 thread->DeferOOBMessageInterrupts();
133 } 139 }
134 140
135 141
136 NoOOBMessageScope::~NoOOBMessageScope() { 142 NoOOBMessageScope::~NoOOBMessageScope() {
137 thread()->RestoreOOBMessageInterrupts(); 143 thread()->RestoreOOBMessageInterrupts();
138 } 144 }
139 145
140 146
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 if (ShouldKill(isolate)) { 2572 if (ShouldKill(isolate)) {
2567 isolate->KillLocked(msg_id_); 2573 isolate->KillLocked(msg_id_);
2568 } 2574 }
2569 } 2575 }
2570 2576
2571 private: 2577 private:
2572 bool ShouldKill(Isolate* isolate) { 2578 bool ShouldKill(Isolate* isolate) {
2573 // If a target_ is specified, then only kill the target_. 2579 // If a target_ is specified, then only kill the target_.
2574 // Otherwise, don't kill the service isolate or vm isolate. 2580 // Otherwise, don't kill the service isolate or vm isolate.
2575 return (((target_ != NULL) && (isolate == target_)) || 2581 return (((target_ != NULL) && (isolate == target_)) ||
2576 ((target_ == NULL) && 2582 ((target_ == NULL) && !IsVMInternalIsolate(isolate)));
2577 !ServiceIsolate::IsServiceIsolateDescendant(isolate) &&
2578 (isolate != Dart::vm_isolate())));
2579 } 2583 }
2580 2584
2581 Isolate* target_; 2585 Isolate* target_;
2582 Isolate::LibMsgId msg_id_; 2586 Isolate::LibMsgId msg_id_;
2583 }; 2587 };
2584 2588
2585 2589
2586 void Isolate::KillAllIsolates(LibMsgId msg_id) { 2590 void Isolate::KillAllIsolates(LibMsgId msg_id) {
2587 IsolateKillerVisitor visitor(msg_id); 2591 IsolateKillerVisitor visitor(msg_id);
2588 VisitIsolates(&visitor); 2592 VisitIsolates(&visitor);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 void IsolateSpawnState::DecrementSpawnCount() { 2942 void IsolateSpawnState::DecrementSpawnCount() {
2939 ASSERT(spawn_count_monitor_ != NULL); 2943 ASSERT(spawn_count_monitor_ != NULL);
2940 ASSERT(spawn_count_ != NULL); 2944 ASSERT(spawn_count_ != NULL);
2941 MonitorLocker ml(spawn_count_monitor_); 2945 MonitorLocker ml(spawn_count_monitor_);
2942 ASSERT(*spawn_count_ > 0); 2946 ASSERT(*spawn_count_ > 0);
2943 *spawn_count_ = *spawn_count_ - 1; 2947 *spawn_count_ = *spawn_count_ - 1;
2944 ml.Notify(); 2948 ml.Notify();
2945 } 2949 }
2946 2950
2947 } // namespace dart 2951 } // namespace dart
OLDNEW
« 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