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

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

Issue 1143783003: Add the streamListen and streamCancel rpcs to the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: before commit Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/service_event.cc ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_isolate.h" 5 #include "vm/service_isolate.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 289 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
290 Isolate* isolate = arguments->isolate(); 290 Isolate* isolate = arguments->isolate();
291 StackZone zone(isolate); 291 StackZone zone(isolate);
292 HANDLESCOPE(isolate); 292 HANDLESCOPE(isolate);
293 { 293 {
294 if (FLAG_trace_service) { 294 if (FLAG_trace_service) {
295 OS::Print("vm-service: processed exit message.\n"); 295 OS::Print("vm-service: processed exit message.\n");
296 } 296 }
297 } 297 }
298 } 298 }
299
300 static void ListenStream(Dart_NativeArguments args) {
301 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
302 Isolate* isolate = arguments->isolate();
303 StackZone stack_zone(isolate);
304 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT.
305 HANDLESCOPE(isolate);
306 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0));
307 Service::ListenStream(stream_id.ToCString());
308 }
309
310 static void CancelStream(Dart_NativeArguments args) {
311 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
312 Isolate* isolate = arguments->isolate();
313 StackZone stack_zone(isolate);
314 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT.
315 HANDLESCOPE(isolate);
316 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0));
317 Service::CancelStream(stream_id.ToCString());
318 }
299 }; 319 };
300 320
301 321
302 struct ServiceNativeEntry { 322 struct ServiceNativeEntry {
303 const char* name; 323 const char* name;
304 int num_arguments; 324 int num_arguments;
305 Dart_NativeFunction function; 325 Dart_NativeFunction function;
306 }; 326 };
307 327
308 328
309 static ServiceNativeEntry _ServiceNativeEntries[] = { 329 static ServiceNativeEntry _ServiceNativeEntries[] = {
310 {"VMService_SendIsolateServiceMessage", 2, 330 {"VMService_SendIsolateServiceMessage", 2,
311 ServiceIsolateNatives::SendIsolateServiceMessage}, 331 ServiceIsolateNatives::SendIsolateServiceMessage},
312 {"VMService_SendRootServiceMessage", 1, 332 {"VMService_SendRootServiceMessage", 1,
313 ServiceIsolateNatives::SendRootServiceMessage}, 333 ServiceIsolateNatives::SendRootServiceMessage},
314 {"VMService_OnStart", 0, 334 {"VMService_OnStart", 0,
315 ServiceIsolateNatives::OnStart }, 335 ServiceIsolateNatives::OnStart },
316 {"VMService_OnExit", 0, 336 {"VMService_OnExit", 0,
317 ServiceIsolateNatives::OnExit }, 337 ServiceIsolateNatives::OnExit },
338 {"VMService_ListenStream", 1,
339 ServiceIsolateNatives::ListenStream },
340 {"VMService_CancelStream", 1,
341 ServiceIsolateNatives::CancelStream },
318 }; 342 };
319 343
320 344
321 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name, 345 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name,
322 int num_arguments, 346 int num_arguments,
323 bool* auto_setup_scope) { 347 bool* auto_setup_scope) {
324 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); 348 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
325 if (!obj.IsString()) { 349 if (!obj.IsString()) {
326 return NULL; 350 return NULL;
327 } 351 }
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return result; 799 return result;
776 } 800 }
777 Dart_Handle source = GetSource(url_string); 801 Dart_Handle source = GetSource(url_string);
778 if (Dart_IsError(source)) { 802 if (Dart_IsError(source)) {
779 return source; 803 return source;
780 } 804 }
781 return Dart_LoadSource(library, url, source, 0, 0); 805 return Dart_LoadSource(library, url, source, 0, 0);
782 } 806 }
783 807
784 } // namespace dart 808 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698