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

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

Issue 1541073002: Implement safepointing of threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-typo 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/scavenger.cc ('k') | runtime/vm/snapshot_test.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/service.h" 5 #include "vm/service.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/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 intptr_t num_streams = sizeof(streams_) / 136 intptr_t num_streams = sizeof(streams_) /
137 sizeof(streams_[0]); 137 sizeof(streams_[0]);
138 for (intptr_t i = 0; i < num_streams; i++) { 138 for (intptr_t i = 0; i < num_streams; i++) {
139 if (strcmp(stream_id, streams_[i]->id()) == 0) { 139 if (strcmp(stream_id, streams_[i]->id()) == 0) {
140 streams_[i]->set_enabled(true); 140 streams_[i]->set_enabled(true);
141 return true; 141 return true;
142 } 142 }
143 } 143 }
144 if (stream_listen_callback_) { 144 if (stream_listen_callback_) {
145 Thread* T = Thread::Current();
146 TransitionVMToNative transition(T);
145 return (*stream_listen_callback_)(stream_id); 147 return (*stream_listen_callback_)(stream_id);
146 } 148 }
147 return false; 149 return false;
148 } 150 }
149 151
150 152
151 void Service::CancelStream(const char* stream_id) { 153 void Service::CancelStream(const char* stream_id) {
152 if (FLAG_trace_service) { 154 if (FLAG_trace_service) {
153 OS::Print("vm-service: stopping stream '%s'\n", 155 OS::Print("vm-service: stopping stream '%s'\n",
154 stream_id); 156 stream_id);
155 } 157 }
156 intptr_t num_streams = sizeof(streams_) / 158 intptr_t num_streams = sizeof(streams_) /
157 sizeof(streams_[0]); 159 sizeof(streams_[0]);
158 for (intptr_t i = 0; i < num_streams; i++) { 160 for (intptr_t i = 0; i < num_streams; i++) {
159 if (strcmp(stream_id, streams_[i]->id()) == 0) { 161 if (strcmp(stream_id, streams_[i]->id()) == 0) {
160 streams_[i]->set_enabled(false); 162 streams_[i]->set_enabled(false);
161 return; 163 return;
162 } 164 }
163 } 165 }
164 if (stream_cancel_callback_) { 166 if (stream_cancel_callback_) {
167 Thread* T = Thread::Current();
168 TransitionVMToNative transition(T);
165 return (*stream_cancel_callback_)(stream_id); 169 return (*stream_cancel_callback_)(stream_id);
166 } 170 }
167 } 171 }
168 172
169 RawObject* Service::RequestAssets() { 173 RawObject* Service::RequestAssets() {
170 Thread* T = Thread::Current(); 174 Thread* T = Thread::Current();
175 TransitionVMToNative transition(T);
171 Api::Scope api_scope(T); 176 Api::Scope api_scope(T);
172 if (get_service_assets_callback_ == NULL) { 177 if (get_service_assets_callback_ == NULL) {
173 return Object::null(); 178 return Object::null();
174 } 179 }
175 Dart_Handle handle = get_service_assets_callback_(); 180 Dart_Handle handle = get_service_assets_callback_();
176 if (Dart_IsError(handle)) { 181 if (Dart_IsError(handle)) {
177 Dart_PropagateError(handle); 182 Dart_PropagateError(handle);
178 } 183 }
179 const Object& object = Object::Handle(Api::UnwrapHandle(handle)); 184 const Object& object = Object::Handle(Api::UnwrapHandle(handle));
180 if (object.IsNull()) { 185 if (object.IsNull()) {
(...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3866 const ServiceMethodDescriptor& method = service_methods_[i]; 3871 const ServiceMethodDescriptor& method = service_methods_[i];
3867 if (strcmp(method_name, method.name) == 0) { 3872 if (strcmp(method_name, method.name) == 0) {
3868 return &method; 3873 return &method;
3869 } 3874 }
3870 } 3875 }
3871 return NULL; 3876 return NULL;
3872 } 3877 }
3873 3878
3874 3879
3875 } // namespace dart 3880 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698