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

Side by Side Diff: runtime/vm/service/running_isolates.dart

Issue 1347693004: getIsolate rpc now returns collected sentinel for expired isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
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 part of vmservice; 5 part of vmservice;
6 6
7 class RunningIsolates implements MessageRouter { 7 class RunningIsolates implements MessageRouter {
8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>(); 8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>();
9 int _rootPortId; 9 int _rootPortId;
10 10
(...skipping 29 matching lines...) Expand all
40 try { 40 try {
41 isolateId = int.parse(isolateParam); 41 isolateId = int.parse(isolateParam);
42 } catch (e) { 42 } catch (e) {
43 message.setErrorResponse( 43 message.setErrorResponse(
44 kInvalidParams, "invalid 'isolateId' parameter: $isolateParam"); 44 kInvalidParams, "invalid 'isolateId' parameter: $isolateParam");
45 return message.response; 45 return message.response;
46 } 46 }
47 } 47 }
48 var isolate = isolates[isolateId]; 48 var isolate = isolates[isolateId];
49 if (isolate == null) { 49 if (isolate == null) {
50 message.setErrorResponse( 50 // There is some chance that this isolate may have lived before,
51 kInvalidParams, "invalid 'isolateId' parameter: $isolateParam"); 51 // so return a sentinel rather than an error.
52 var result = {
53 'type' : 'Sentinel',
54 'kind' : 'Collected',
55 'valueAsString' : '<collected>',
56 };
57 message.setResponse(encodeResult(message, result));
52 return message.response; 58 return message.response;
53 } 59 }
54 return isolate.route(message); 60 return isolate.route(message);
55 } 61 }
56 } 62 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/get_isolate_rpc_test.dart ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698