OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 static Dart_Handle True(); | 114 static Dart_Handle True(); |
115 | 115 |
116 // Gets a handle to False | 116 // Gets a handle to False |
117 static Dart_Handle False(); | 117 static Dart_Handle False(); |
118 | 118 |
119 // Allocates space in the local zone. | 119 // Allocates space in the local zone. |
120 static uword Allocate(intptr_t size); | 120 static uword Allocate(intptr_t size); |
121 | 121 |
122 // Reallocates space in the local zone. | 122 // Reallocates space in the local zone. |
123 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); | 123 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); |
| 124 |
| 125 // Performs one-time initialization needed by the API. |
| 126 static void InitOnce(); |
| 127 |
| 128 private: |
| 129 // Thread local key used by the API. Currently holds the current |
| 130 // ApiNativeScope if any. |
| 131 static ThreadLocalKey api_native_key_; |
| 132 |
| 133 friend class ApiNativeScope; |
124 }; | 134 }; |
125 | 135 |
126 class IsolateSaver { | 136 class IsolateSaver { |
127 public: | 137 public: |
128 explicit IsolateSaver(Isolate* current_isolate) | 138 explicit IsolateSaver(Isolate* current_isolate) |
129 : saved_isolate_(current_isolate) { | 139 : saved_isolate_(current_isolate) { |
130 } | 140 } |
131 ~IsolateSaver() { | 141 ~IsolateSaver() { |
132 Isolate::SetCurrent(saved_isolate_); | 142 Isolate::SetCurrent(saved_isolate_); |
133 } | 143 } |
134 private: | 144 private: |
135 Isolate* saved_isolate_; | 145 Isolate* saved_isolate_; |
136 | 146 |
137 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 147 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
138 }; | 148 }; |
139 | 149 |
140 } // namespace dart. | 150 } // namespace dart. |
141 | 151 |
142 #endif // VM_DART_API_IMPL_H_ | 152 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |