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 VM_DART_API_STATE_H_ | 5 #ifndef VM_DART_API_STATE_H_ |
6 #define VM_DART_API_STATE_H_ | 6 #define 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" |
11 #include "vm/bitfield.h" | 11 #include "vm/bitfield.h" |
12 #include "vm/dart_api_impl.h" | 12 #include "vm/dart_api_impl.h" |
13 #include "vm/flags.h" | 13 #include "vm/flags.h" |
14 #include "vm/growable_array.h" | 14 #include "vm/growable_array.h" |
15 #include "vm/handles.h" | 15 #include "vm/handles.h" |
16 #include "vm/object.h" | 16 #include "vm/object.h" |
17 #include "vm/os.h" | 17 #include "vm/os.h" |
18 #include "vm/raw_object.h" | 18 #include "vm/raw_object.h" |
19 #include "vm/os_thread.h" | 19 #include "vm/os_thread.h" |
20 #include "vm/visitor.h" | 20 #include "vm/visitor.h" |
| 21 #include "vm/weak_table.h" |
21 | 22 |
22 #include "vm/handles_impl.h" | 23 #include "vm/handles_impl.h" |
23 | 24 |
24 namespace dart { | 25 namespace dart { |
25 | 26 |
26 DECLARE_DEBUG_FLAG(bool, trace_zones); | 27 DECLARE_DEBUG_FLAG(bool, trace_zones); |
27 DECLARE_DEBUG_FLAG(bool, trace_handles); | 28 DECLARE_DEBUG_FLAG(bool, trace_handles); |
28 | 29 |
29 // Implementation of Zone support for very fast allocation of small chunks | 30 // Implementation of Zone support for very fast allocation of small chunks |
30 // of memory. The chunks cannot be deallocated individually, but instead | 31 // of memory. The chunks cannot be deallocated individually, but instead |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 826 |
826 PersistentHandle* AcquiredError() const { | 827 PersistentHandle* AcquiredError() const { |
827 ASSERT(acquired_error_ != NULL); | 828 ASSERT(acquired_error_ != NULL); |
828 return acquired_error_; | 829 return acquired_error_; |
829 } | 830 } |
830 | 831 |
831 WeakReferenceSetBuilder* NewWeakReferenceSetBuilder(); | 832 WeakReferenceSetBuilder* NewWeakReferenceSetBuilder(); |
832 | 833 |
833 void DelayWeakReferenceSet(WeakReferenceSet* reference_set); | 834 void DelayWeakReferenceSet(WeakReferenceSet* reference_set); |
834 | 835 |
| 836 WeakTable* acquired_table() { return &acquired_table_; } |
| 837 |
835 private: | 838 private: |
836 PersistentHandles persistent_handles_; | 839 PersistentHandles persistent_handles_; |
837 FinalizablePersistentHandles weak_persistent_handles_; | 840 FinalizablePersistentHandles weak_persistent_handles_; |
838 FinalizablePersistentHandles prologue_weak_persistent_handles_; | 841 FinalizablePersistentHandles prologue_weak_persistent_handles_; |
839 ApiLocalScope* reusable_scope_; | 842 ApiLocalScope* reusable_scope_; |
840 ApiLocalScope* top_scope_; | 843 ApiLocalScope* top_scope_; |
841 WeakReferenceSet* delayed_weak_reference_sets_; | 844 WeakReferenceSet* delayed_weak_reference_sets_; |
| 845 WeakTable acquired_table_; |
842 | 846 |
843 // Persistent handles to important objects. | 847 // Persistent handles to important objects. |
844 PersistentHandle* null_; | 848 PersistentHandle* null_; |
845 PersistentHandle* true_; | 849 PersistentHandle* true_; |
846 PersistentHandle* false_; | 850 PersistentHandle* false_; |
847 PersistentHandle* acquired_error_; | 851 PersistentHandle* acquired_error_; |
848 | 852 |
849 DISALLOW_COPY_AND_ASSIGN(ApiState); | 853 DISALLOW_COPY_AND_ASSIGN(ApiState); |
850 }; | 854 }; |
851 | 855 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 ref->set_peer(peer); | 975 ref->set_peer(peer); |
972 ref->set_callback(callback); | 976 ref->set_callback(callback); |
973 // This may trigger GC, so it must be called last. | 977 // This may trigger GC, so it must be called last. |
974 ref->SetExternalSize(external_size, isolate); | 978 ref->SetExternalSize(external_size, isolate); |
975 return ref; | 979 return ref; |
976 } | 980 } |
977 | 981 |
978 } // namespace dart | 982 } // namespace dart |
979 | 983 |
980 #endif // VM_DART_API_STATE_H_ | 984 #endif // VM_DART_API_STATE_H_ |
OLD | NEW |