| 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 |
| 8 // doesn't result in an expired ref because the elements lapped it in the |
| 9 // object ring. |
| 10 const int kDefaultFieldLimit = 100; |
| 11 |
| 7 /// Helper function for canceling a Future<StreamSubscription>. | 12 /// Helper function for canceling a Future<StreamSubscription>. |
| 8 Future cancelFutureSubscription( | 13 Future cancelFutureSubscription( |
| 9 Future<StreamSubscription> subscriptionFuture) async { | 14 Future<StreamSubscription> subscriptionFuture) async { |
| 10 if (subscriptionFuture != null) { | 15 if (subscriptionFuture != null) { |
| 11 var subscription = await subscriptionFuture; | 16 var subscription = await subscriptionFuture; |
| 12 return subscription.cancel(); | 17 return subscription.cancel(); |
| 13 } else { | 18 } else { |
| 14 return null; | 19 return null; |
| 15 } | 20 } |
| 16 } | 21 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 282 } |
| 278 // Call reload which will fill in the entire object. | 283 // Call reload which will fill in the entire object. |
| 279 return reload(); | 284 return reload(); |
| 280 } | 285 } |
| 281 | 286 |
| 282 Future<ServiceObject> _inProgressReload; | 287 Future<ServiceObject> _inProgressReload; |
| 283 | 288 |
| 284 Future<ObservableMap> _fetchDirect() { | 289 Future<ObservableMap> _fetchDirect() { |
| 285 Map params = { | 290 Map params = { |
| 286 'objectId': id, | 291 'objectId': id, |
| 292 'count': kDefaultFieldLimit, |
| 287 }; | 293 }; |
| 288 return isolate.invokeRpcNoUpgrade('getObject', params); | 294 return isolate.invokeRpcNoUpgrade('getObject', params); |
| 289 } | 295 } |
| 290 | 296 |
| 291 /// Reload [this]. Returns a future which completes to [this] or | 297 /// Reload [this]. Returns a future which completes to [this] or |
| 292 /// an exception. | 298 /// an exception. |
| 293 Future<ServiceObject> reload() { | 299 Future<ServiceObject> reload() { |
| 294 // TODO(turnidge): Checking for a null id should be part of the | 300 // TODO(turnidge): Checking for a null id should be part of the |
| 295 // "immmutable" check. | 301 // "immmutable" check. |
| 296 bool hasId = (id != null) && (id != ''); | 302 bool hasId = (id != null) && (id != ''); |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 var obj = _cache[objectId]; | 1287 var obj = _cache[objectId]; |
| 1282 if (obj != null) { | 1288 if (obj != null) { |
| 1283 if (reload) { | 1289 if (reload) { |
| 1284 return obj.reload(); | 1290 return obj.reload(); |
| 1285 } | 1291 } |
| 1286 // Returned cached object. | 1292 // Returned cached object. |
| 1287 return new Future.value(obj); | 1293 return new Future.value(obj); |
| 1288 } | 1294 } |
| 1289 Map params = { | 1295 Map params = { |
| 1290 'objectId': objectId, | 1296 'objectId': objectId, |
| 1297 'count': kDefaultFieldLimit, |
| 1291 }; | 1298 }; |
| 1292 return isolate.invokeRpc('getObject', params); | 1299 return isolate.invokeRpc('getObject', params); |
| 1293 } | 1300 } |
| 1294 | 1301 |
| 1295 Future<ObservableMap> _fetchDirect() { | 1302 Future<ObservableMap> _fetchDirect() { |
| 1296 return invokeRpcNoUpgrade('getIsolate', {}); | 1303 return invokeRpcNoUpgrade('getIsolate', {}); |
| 1297 } | 1304 } |
| 1298 | 1305 |
| 1299 @observable Class objectClass; | 1306 @observable Class objectClass; |
| 1300 @observable final rootClasses = new ObservableList<Class>(); | 1307 @observable final rootClasses = new ObservableList<Class>(); |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 code = map['code']; | 2639 code = map['code']; |
| 2633 isOptimizable = map['_optimizable']; | 2640 isOptimizable = map['_optimizable']; |
| 2634 isInlinable = map['_inlinable']; | 2641 isInlinable = map['_inlinable']; |
| 2635 isRecognized = map['_recognized']; | 2642 isRecognized = map['_recognized']; |
| 2636 unoptimizedCode = map['_unoptimizedCode']; | 2643 unoptimizedCode = map['_unoptimizedCode']; |
| 2637 deoptimizations = map['_deoptimizations']; | 2644 deoptimizations = map['_deoptimizations']; |
| 2638 usageCounter = map['_usageCounter']; | 2645 usageCounter = map['_usageCounter']; |
| 2639 icDataArray = map['_icDataArray']; | 2646 icDataArray = map['_icDataArray']; |
| 2640 field = map['_field']; | 2647 field = map['_field']; |
| 2641 } | 2648 } |
| 2649 |
| 2650 ServiceFunction get homeMethod { |
| 2651 var m = this; |
| 2652 while (m.dartOwner is ServiceFunction) { |
| 2653 m = m.dartOwner; |
| 2654 } |
| 2655 return m; |
| 2656 } |
| 2642 } | 2657 } |
| 2643 | 2658 |
| 2644 | 2659 |
| 2645 class Field extends HeapObject { | 2660 class Field extends HeapObject { |
| 2646 // Library or Class. | 2661 // Library or Class. |
| 2647 @observable ServiceObject dartOwner; | 2662 @observable ServiceObject dartOwner; |
| 2648 @observable Library library; | 2663 @observable Library library; |
| 2649 @observable Instance declaredType; | 2664 @observable Instance declaredType; |
| 2650 @observable bool isStatic; | 2665 @observable bool isStatic; |
| 2651 @observable bool isFinal; | 2666 @observable bool isFinal; |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4029 var v = list[i]; | 4044 var v = list[i]; |
| 4030 if ((v is ObservableMap) && _isServiceMap(v)) { | 4045 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 4031 list[i] = owner.getFromMap(v); | 4046 list[i] = owner.getFromMap(v); |
| 4032 } else if (v is ObservableList) { | 4047 } else if (v is ObservableList) { |
| 4033 _upgradeObservableList(v, owner); | 4048 _upgradeObservableList(v, owner); |
| 4034 } else if (v is ObservableMap) { | 4049 } else if (v is ObservableMap) { |
| 4035 _upgradeObservableMap(v, owner); | 4050 _upgradeObservableMap(v, owner); |
| 4036 } | 4051 } |
| 4037 } | 4052 } |
| 4038 } | 4053 } |
| OLD | NEW |