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

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

Issue 2783933002: Fix many warnings/errors when building Observatory (Closed)
Patch Set: Created 3 years, 8 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) 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 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 size = map['size']; 434 size = map['size'];
435 } 435 }
436 } 436 }
437 437
438 class RetainingObject implements M.RetainingObject { 438 class RetainingObject implements M.RetainingObject {
439 int get retainedSize => object.retainedSize; 439 int get retainedSize => object.retainedSize;
440 final HeapObject object; 440 final HeapObject object;
441 RetainingObject(this.object); 441 RetainingObject(this.object);
442 } 442 }
443 443
444 abstract class ServiceObjectOwner extends ServiceObject { 444 abstract class ServiceObjectOwner extends ServiceObject
445 implements M.ServiceObjectOwner {
445 /// Creates an empty [ServiceObjectOwner]. 446 /// Creates an empty [ServiceObjectOwner].
446 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); 447 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
447 448
448 /// Builds a [ServiceObject] corresponding to the [id] from [map]. 449 /// Builds a [ServiceObject] corresponding to the [id] from [map].
449 /// The result may come from the cache. The result will not necessarily 450 /// The result may come from the cache. The result will not necessarily
450 /// be [loaded]. 451 /// be [loaded].
451 ServiceObject getFromMap(Map map); 452 ServiceObject getFromMap(Map map);
453
454 Future<M.Object> invokeRpc(String method, Map params);
452 } 455 }
453 456
454 abstract class Location implements M.Location { 457 abstract class Location implements M.Location {
455 Script get script; 458 Script get script;
456 int get tokenPos; 459 int get tokenPos;
457 } 460 }
458 461
459 /// A [SourceLocation] represents a location or range in the source code. 462 /// A [SourceLocation] represents a location or range in the source code.
460 class SourceLocation extends ServiceObject 463 class SourceLocation extends ServiceObject
461 implements Location, M.SourceLocation { 464 implements Location, M.SourceLocation {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 "Response is missing the 'type' field", map); 828 "Response is missing the 'type' field", map);
826 return new Future.error(exception); 829 return new Future.error(exception);
827 } 830 }
828 return new Future.value(map); 831 return new Future.value(map);
829 }).catchError((e) { 832 }).catchError((e) {
830 // Errors pass through. 833 // Errors pass through.
831 return new Future.error(e); 834 return new Future.error(e);
832 }); 835 });
833 } 836 }
834 837
835 Future<ServiceObject> invokeRpc(String method, Map params) { 838 Future<dynamic> invokeRpc(String method, Map params) {
836 return invokeRpcNoUpgrade(method, params).then((Map response) { 839 return invokeRpcNoUpgrade(method, params).then((Map response) {
837 var obj = new ServiceObject._fromMap(this, response); 840 var obj = new ServiceObject._fromMap(this, response);
838 if ((obj != null) && obj.canCache) { 841 if ((obj != null) && obj.canCache) {
839 String objId = obj.id; 842 String objId = obj.id;
840 _cache.putIfAbsent(objId, () => obj); 843 _cache.putIfAbsent(objId, () => obj);
841 } 844 }
842 return obj; 845 return obj;
843 }).catchError((e) { 846 }).catchError((e) {
844 return new Future.error(e); 847 return new Future.error(e);
845 }); 848 });
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 _cache[mapId] = obj; 1461 _cache[mapId] = obj;
1459 } 1462 }
1460 return obj; 1463 return obj;
1461 } 1464 }
1462 1465
1463 Future<Map> invokeRpcNoUpgrade(String method, Map params) { 1466 Future<Map> invokeRpcNoUpgrade(String method, Map params) {
1464 params['isolateId'] = id; 1467 params['isolateId'] = id;
1465 return vm.invokeRpcNoUpgrade(method, params); 1468 return vm.invokeRpcNoUpgrade(method, params);
1466 } 1469 }
1467 1470
1468 Future<ServiceObject> invokeRpc(String method, Map params) { 1471 Future<dynamic> invokeRpc(String method, Map params) {
1469 return invokeRpcNoUpgrade(method, params).then((Map response) { 1472 return invokeRpcNoUpgrade(method, params).then((Map response) {
1470 return getFromMap(response); 1473 return getFromMap(response);
1471 }); 1474 });
1472 } 1475 }
1473 1476
1474 Future<ServiceObject> getObject(String objectId, 1477 Future<ServiceObject> getObject(String objectId,
1475 {bool reload: true, int count: kDefaultFieldLimit}) { 1478 {bool reload: true, int count: kDefaultFieldLimit}) {
1476 assert(objectId != null && objectId != ''); 1479 assert(objectId != null && objectId != '');
1477 var obj = _cache[objectId]; 1480 var obj = _cache[objectId];
1478 if (obj != null) { 1481 if (obj != null) {
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4625 var v = list[i]; 4628 var v = list[i];
4626 if ((v is Map) && _isServiceMap(v)) { 4629 if ((v is Map) && _isServiceMap(v)) {
4627 list[i] = owner.getFromMap(v); 4630 list[i] = owner.getFromMap(v);
4628 } else if (v is List) { 4631 } else if (v is List) {
4629 _upgradeList(v, owner); 4632 _upgradeList(v, owner);
4630 } else if (v is Map) { 4633 } else if (v is Map) {
4631 _upgradeMap(v, owner); 4634 _upgradeMap(v, owner);
4632 } 4635 }
4633 } 4636 }
4634 } 4637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698