OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef RUNTIME_VM_DART_API_STATE_H_ | 5 #ifndef RUNTIME_VM_DART_API_STATE_H_ |
6 #define RUNTIME_VM_DART_API_STATE_H_ | 6 #define RUNTIME_VM_DART_API_STATE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 716 |
717 ApiZone zone_; | 717 ApiZone zone_; |
718 }; | 718 }; |
719 | 719 |
720 | 720 |
721 // Api growable arrays use a zone for allocation. The constructor | 721 // Api growable arrays use a zone for allocation. The constructor |
722 // picks the zone from the current isolate if in an isolate | 722 // picks the zone from the current isolate if in an isolate |
723 // environment. When outside an isolate environment it picks the zone | 723 // environment. When outside an isolate environment it picks the zone |
724 // from the current native scope. | 724 // from the current native scope. |
725 template <typename T> | 725 template <typename T> |
726 class ApiGrowableArray : public BaseGrowableArray<T, ValueObject> { | 726 class ApiGrowableArray : public BaseGrowableArray<T, ValueObject, Zone> { |
727 public: | 727 public: |
728 explicit ApiGrowableArray(int initial_capacity) | 728 explicit ApiGrowableArray(int initial_capacity) |
729 : BaseGrowableArray<T, ValueObject>(initial_capacity, | 729 : BaseGrowableArray<T, ValueObject, Zone>( |
730 ApiNativeScope::Current()->zone()) {} | 730 initial_capacity, |
| 731 ApiNativeScope::Current()->zone()) {} |
731 ApiGrowableArray() | 732 ApiGrowableArray() |
732 : BaseGrowableArray<T, ValueObject>(ApiNativeScope::Current()->zone()) {} | 733 : BaseGrowableArray<T, ValueObject, Zone>( |
| 734 ApiNativeScope::Current()->zone()) {} |
733 ApiGrowableArray(intptr_t initial_capacity, Zone* zone) | 735 ApiGrowableArray(intptr_t initial_capacity, Zone* zone) |
734 : BaseGrowableArray<T, ValueObject>(initial_capacity, zone) {} | 736 : BaseGrowableArray<T, ValueObject, Zone>(initial_capacity, zone) {} |
735 }; | 737 }; |
736 | 738 |
737 | 739 |
738 // Implementation of the API State used in dart api for maintaining | 740 // Implementation of the API State used in dart api for maintaining |
739 // local scopes, persistent handles etc. These are setup on a per isolate | 741 // local scopes, persistent handles etc. These are setup on a per isolate |
740 // basis and destroyed when the isolate is shutdown. | 742 // basis and destroyed when the isolate is shutdown. |
741 class ApiState { | 743 class ApiState { |
742 public: | 744 public: |
743 ApiState() | 745 ApiState() |
744 : persistent_handles_(), | 746 : persistent_handles_(), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 ref->set_callback(callback); | 863 ref->set_callback(callback); |
862 ref->set_is_queued_for_finalization(false); | 864 ref->set_is_queued_for_finalization(false); |
863 // This may trigger GC, so it must be called last. | 865 // This may trigger GC, so it must be called last. |
864 ref->SetExternalSize(external_size, isolate); | 866 ref->SetExternalSize(external_size, isolate); |
865 return ref; | 867 return ref; |
866 } | 868 } |
867 | 869 |
868 } // namespace dart | 870 } // namespace dart |
869 | 871 |
870 #endif // RUNTIME_VM_DART_API_STATE_H_ | 872 #endif // RUNTIME_VM_DART_API_STATE_H_ |
OLD | NEW |