| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class ApiLocalScope; |
| 13 class ApiState; | 14 class ApiState; |
| 14 class FinalizablePersistentHandle; | 15 class FinalizablePersistentHandle; |
| 15 class LocalHandle; | 16 class LocalHandle; |
| 16 class PersistentHandle; | 17 class PersistentHandle; |
| 17 | 18 |
| 18 const char* CanonicalFunction(const char* func); | 19 const char* CanonicalFunction(const char* func); |
| 19 | 20 |
| 20 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) | 21 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) |
| 21 | 22 |
| 22 // Checks that the current isolate is not NULL. | 23 // Checks that the current isolate is not NULL. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 137 |
| 137 // Gets a handle to Null. | 138 // Gets a handle to Null. |
| 138 static Dart_Handle Null(Isolate* isolate); | 139 static Dart_Handle Null(Isolate* isolate); |
| 139 | 140 |
| 140 // Gets a handle to True. | 141 // Gets a handle to True. |
| 141 static Dart_Handle True(Isolate* isolate); | 142 static Dart_Handle True(Isolate* isolate); |
| 142 | 143 |
| 143 // Gets a handle to False | 144 // Gets a handle to False |
| 144 static Dart_Handle False(Isolate* isolate); | 145 static Dart_Handle False(Isolate* isolate); |
| 145 | 146 |
| 146 // Allocates space in the local zone. | 147 // Retrieves the top ApiLocalScope. |
| 147 static uword Allocate(Isolate* isolate, intptr_t size); | 148 static ApiLocalScope* TopScope(Isolate* isolate); |
| 148 | |
| 149 // Reallocates space in the local zone. | |
| 150 static uword Reallocate(Isolate* isolate, | |
| 151 uword ptr, | |
| 152 intptr_t old_size, | |
| 153 intptr_t new_size); | |
| 154 | 149 |
| 155 // Performs one-time initialization needed by the API. | 150 // Performs one-time initialization needed by the API. |
| 156 static void InitOnce(); | 151 static void InitOnce(); |
| 157 | 152 |
| 158 private: | 153 private: |
| 159 // Thread local key used by the API. Currently holds the current | 154 // Thread local key used by the API. Currently holds the current |
| 160 // ApiNativeScope if any. | 155 // ApiNativeScope if any. |
| 161 static ThreadLocalKey api_native_key_; | 156 static ThreadLocalKey api_native_key_; |
| 162 | 157 |
| 163 friend class ApiNativeScope; | 158 friend class ApiNativeScope; |
| 164 }; | 159 }; |
| 165 | 160 |
| 166 class IsolateSaver { | 161 class IsolateSaver { |
| 167 public: | 162 public: |
| 168 explicit IsolateSaver(Isolate* current_isolate) | 163 explicit IsolateSaver(Isolate* current_isolate) |
| 169 : saved_isolate_(current_isolate) { | 164 : saved_isolate_(current_isolate) { |
| 170 } | 165 } |
| 171 ~IsolateSaver() { | 166 ~IsolateSaver() { |
| 172 Isolate::SetCurrent(saved_isolate_); | 167 Isolate::SetCurrent(saved_isolate_); |
| 173 } | 168 } |
| 174 private: | 169 private: |
| 175 Isolate* saved_isolate_; | 170 Isolate* saved_isolate_; |
| 176 | 171 |
| 177 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 172 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
| 178 }; | 173 }; |
| 179 | 174 |
| 180 } // namespace dart. | 175 } // namespace dart. |
| 181 | 176 |
| 182 #endif // VM_DART_API_IMPL_H_ | 177 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |