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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 1129423003: Fix reload() for VM object (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 service; 5 part of service;
6 6
7 /// An RpcException represents an exceptional event that happened 7 /// An RpcException represents an exceptional event that happened
8 /// while invoking an rpc. 8 /// while invoking an rpc.
9 abstract class RpcException implements Exception { 9 abstract class RpcException implements Exception {
10 RpcException(this.message); 10 RpcException(this.message);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 'objectId': id, 274 'objectId': id,
275 }; 275 };
276 return isolate.invokeRpcNoUpgrade('getObject', params); 276 return isolate.invokeRpcNoUpgrade('getObject', params);
277 } 277 }
278 278
279 /// Reload [this]. Returns a future which completes to [this] or 279 /// Reload [this]. Returns a future which completes to [this] or
280 /// an exception. 280 /// an exception.
281 Future<ServiceObject> reload() { 281 Future<ServiceObject> reload() {
282 // TODO(turnidge): Checking for a null id should be part of the 282 // TODO(turnidge): Checking for a null id should be part of the
283 // "immmutable" check. 283 // "immmutable" check.
284 if (id == null || id == '') { 284 bool hasId = (id != null) && (id != '');
285 return new Future.value(this); 285 bool isVM = this is VM;
286 } 286 // We should always reload the VM.
287 if (loaded && immutable) { 287 // We can't reload objects without an id.
288 // We shouldn't reload an immutable and already loaded object.
289 bool skipLoad = !isVM && (!hasId || (immutable && loaded));
290 if (skipLoad) {
288 return new Future.value(this); 291 return new Future.value(this);
289 } 292 }
290 if (_inProgressReload == null) { 293 if (_inProgressReload == null) {
291 var completer = new Completer<ServiceObject>(); 294 var completer = new Completer<ServiceObject>();
292 _inProgressReload = completer.future; 295 _inProgressReload = completer.future;
293 _fetchDirect().then((ObservableMap map) { 296 _fetchDirect().then((ObservableMap map) {
294 var mapType = _stripRef(map['type']); 297 var mapType = _stripRef(map['type']);
295 if (mapType == 'Sentinel') { 298 if (mapType == 'Sentinel') {
296 // An object may have been collected, etc. 299 // An object may have been collected, etc.
297 completer.complete(new ServiceObject._fromMap(owner, map)); 300 completer.complete(new ServiceObject._fromMap(owner, map));
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 var pattern = new RegExp("(^|[^A-Za-z0-9\.])$name[^A-Za-z0-9]"); 2365 var pattern = new RegExp("(^|[^A-Za-z0-9\.])$name[^A-Za-z0-9]");
2363 2366
2364 // Result. 2367 // Result.
2365 var r = <LocalVarLocation>[]; 2368 var r = <LocalVarLocation>[];
2366 2369
2367 // Limits. 2370 // Limits.
2368 final lastLine = tokenToLine(endTokenPos); 2371 final lastLine = tokenToLine(endTokenPos);
2369 if (lastLine == null) { 2372 if (lastLine == null) {
2370 return r; 2373 return r;
2371 } 2374 }
2372 2375
2373 final lastColumn = tokenToCol(endTokenPos); 2376 final lastColumn = tokenToCol(endTokenPos);
2374 if (lastColumn == null) { 2377 if (lastColumn == null) {
2375 return r; 2378 return r;
2376 } 2379 }
2377 // Current scan position. 2380 // Current scan position.
2378 var line = tokenToLine(tokenPos); 2381 var line = tokenToLine(tokenPos);
2379 if (line == null) { 2382 if (line == null) {
2380 return r; 2383 return r;
2381 } 2384 }
2382 var column = tokenToCol(tokenPos); 2385 var column = tokenToCol(tokenPos);
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 var v = list[i]; 3113 var v = list[i];
3111 if ((v is ObservableMap) && _isServiceMap(v)) { 3114 if ((v is ObservableMap) && _isServiceMap(v)) {
3112 list[i] = owner.getFromMap(v); 3115 list[i] = owner.getFromMap(v);
3113 } else if (v is ObservableList) { 3116 } else if (v is ObservableList) {
3114 _upgradeObservableList(v, owner); 3117 _upgradeObservableList(v, owner);
3115 } else if (v is ObservableMap) { 3118 } else if (v is ObservableMap) {
3116 _upgradeObservableMap(v, owner); 3119 _upgradeObservableMap(v, owner);
3117 } 3120 }
3118 } 3121 }
3119 } 3122 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698