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

Side by Side Diff: lib/src/isolate.dart

Issue 1670283002: add sendRequest to VMIsolateRef Base URL: git@github.com:yjbanov/vm_service_client.git@master
Patch Set: rename to invokeExtension; enforce ext. prefix 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 | « no previous file | test/isolate_test.dart » ('j') | test/isolate_test.dart » ('J')
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 import 'package:async/async.dart'; 8 import 'package:async/async.dart';
9 import 'package:crypto/crypto.dart'; 9 import 'package:crypto/crypto.dart';
10 import 'package:json_rpc_2/json_rpc_2.dart' as rpc; 10 import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 var response = await _scope.sendRequest( 257 var response = await _scope.sendRequest(
258 "addBreakpointWithScriptUri", params); 258 "addBreakpointWithScriptUri", params);
259 return newVMBreakpoint(_scope, response); 259 return newVMBreakpoint(_scope, response);
260 } on rpc.RpcException catch (error) { 260 } on rpc.RpcException catch (error) {
261 // Error 102 indicates that the breakpoint couldn't be created. 261 // Error 102 indicates that the breakpoint couldn't be created.
262 if (error.code == 102) return null; 262 if (error.code == 102) return null;
263 rethrow; 263 rethrow;
264 } 264 }
265 } 265 }
266 266
267 /// Makes a raw RPC to a VM service extension registered in the isolate
268 /// corresponding to the ID [number].
nweiz 2016/02/10 22:17:11 "the isolate ..." -> "this isolate."
269 ///
270 /// [method] must correspond to a VM service extension installed on the VM
271 /// isolate and it must begin with prefix "ext.".
nweiz 2016/02/10 21:28:28 It sort of feels like this should just automatical
yjbanov 2016/02/10 22:06:06 I think there's value in having `invokeExtension`
nweiz 2016/02/10 22:17:11 SGTM
272 ///
273 /// [params] are passed to the extension handler and must be serializable to
274 /// a JSON string.
275 Future<Map> invokeExtension(String method, [Map<String, Object> params]) {
nweiz 2016/02/10 21:28:28 Based on the ServiceExtensionHandler API, I think
yjbanov 2016/02/10 22:06:06 I thought so too initially, but turns out the JSON
nweiz 2016/02/10 22:17:11 I think we should only allow strings here. We defi
276 if (!method.startsWith('ext.')) {
277 throw new ArgumentError('Extension method names must begin with "ext." pre fix: ${method}');
nweiz 2016/02/10 21:28:28 Long line. Also, you can make this a little more
yjbanov 2016/02/10 22:06:06 Done.
278 }
279 return _scope.sendRequest(method, params);
280 }
281
267 bool operator ==(other) => other is VMIsolateRef && 282 bool operator ==(other) => other is VMIsolateRef &&
268 other._scope.isolateId == _scope.isolateId; 283 other._scope.isolateId == _scope.isolateId;
269 284
270 int get hashCode => _scope.isolateId.hashCode; 285 int get hashCode => _scope.isolateId.hashCode;
271 286
272 String toString() => name; 287 String toString() => name;
273 } 288 }
274 289
275 /// A full isolate on the remote VM. 290 /// A full isolate on the remote VM.
276 class VMIsolate extends VMIsolateRef { 291 class VMIsolate extends VMIsolateRef {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 373
359 /// The isolate continues until it exits the current function. 374 /// The isolate continues until it exits the current function.
360 static const out = const VMStep._("Out"); 375 static const out = const VMStep._("Out");
361 376
362 /// The string name of the step type. 377 /// The string name of the step type.
363 final String _value; 378 final String _value;
364 379
365 const VMStep._(this._value); 380 const VMStep._(this._value);
366 381
367 String toString() => _value; 382 String toString() => _value;
368 } 383 }
OLDNEW
« no previous file with comments | « no previous file | test/isolate_test.dart » ('j') | test/isolate_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698