| OLD | NEW |
| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 'objectId': id, | 323 'objectId': id, |
| 324 'count': count, | 324 'count': count, |
| 325 }; | 325 }; |
| 326 return isolate.invokeRpcNoUpgrade('getObject', params); | 326 return isolate.invokeRpcNoUpgrade('getObject', params); |
| 327 } | 327 } |
| 328 | 328 |
| 329 /// Reload [this]. Returns a future which completes to [this] or | 329 /// Reload [this]. Returns a future which completes to [this] or |
| 330 /// an exception. | 330 /// an exception. |
| 331 Future<ServiceObject> reload({int count: kDefaultFieldLimit}) { | 331 Future<ServiceObject> reload({int count: kDefaultFieldLimit}) { |
| 332 // TODO(turnidge): Checking for a null id should be part of the | 332 // TODO(turnidge): Checking for a null id should be part of the |
| 333 // "immmutable" check. | 333 // "immutable" check. |
| 334 bool hasId = (id != null) && (id != ''); | 334 bool hasId = (id != null) && (id != ''); |
| 335 bool isVM = this is VM; | 335 bool isVM = this is VM; |
| 336 // We should always reload the VM. | 336 // We should always reload the VM. |
| 337 // We can't reload objects without an id. | 337 // We can't reload objects without an id. |
| 338 // We shouldn't reload an immutable and already loaded object. | 338 // We shouldn't reload an immutable and already loaded object. |
| 339 bool skipLoad = !isVM && (!hasId || (immutable && loaded)); | 339 bool skipLoad = !isVM && (!hasId || (immutable && loaded)); |
| 340 if (skipLoad) { | 340 if (skipLoad) { |
| 341 return new Future.value(this); | 341 return new Future.value(this); |
| 342 } | 342 } |
| 343 if (_inProgressReload == null) { | 343 if (_inProgressReload == null) { |
| (...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4628 var v = list[i]; | 4628 var v = list[i]; |
| 4629 if ((v is Map) && _isServiceMap(v)) { | 4629 if ((v is Map) && _isServiceMap(v)) { |
| 4630 list[i] = owner.getFromMap(v); | 4630 list[i] = owner.getFromMap(v); |
| 4631 } else if (v is List) { | 4631 } else if (v is List) { |
| 4632 _upgradeList(v, owner); | 4632 _upgradeList(v, owner); |
| 4633 } else if (v is Map) { | 4633 } else if (v is Map) { |
| 4634 _upgradeMap(v, owner); | 4634 _upgradeMap(v, owner); |
| 4635 } | 4635 } |
| 4636 } | 4636 } |
| 4637 } | 4637 } |
| OLD | NEW |