| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 // Gets a handle to False | 143 // Gets a handle to False |
| 144 static Dart_Handle False(Isolate* isolate); | 144 static Dart_Handle False(Isolate* isolate); |
| 145 | 145 |
| 146 // Retrieves the top ApiLocalScope. | 146 // Retrieves the top ApiLocalScope. |
| 147 static ApiLocalScope* TopScope(Isolate* isolate); | 147 static ApiLocalScope* TopScope(Isolate* isolate); |
| 148 | 148 |
| 149 // Performs one-time initialization needed by the API. | 149 // Performs one-time initialization needed by the API. |
| 150 static void InitOnce(); | 150 static void InitOnce(); |
| 151 | 151 |
| 152 // Helper function to get the peer value of an external string object. |
| 153 static bool ExternalStringGetPeerHelper(Dart_Handle object, void** peer); |
| 154 |
| 152 private: | 155 private: |
| 153 // Thread local key used by the API. Currently holds the current | 156 // Thread local key used by the API. Currently holds the current |
| 154 // ApiNativeScope if any. | 157 // ApiNativeScope if any. |
| 155 static ThreadLocalKey api_native_key_; | 158 static ThreadLocalKey api_native_key_; |
| 156 | 159 |
| 157 friend class ApiNativeScope; | 160 friend class ApiNativeScope; |
| 158 }; | 161 }; |
| 159 | 162 |
| 160 class IsolateSaver { | 163 class IsolateSaver { |
| 161 public: | 164 public: |
| 162 explicit IsolateSaver(Isolate* current_isolate) | 165 explicit IsolateSaver(Isolate* current_isolate) |
| 163 : saved_isolate_(current_isolate) { | 166 : saved_isolate_(current_isolate) { |
| 164 } | 167 } |
| 165 ~IsolateSaver() { | 168 ~IsolateSaver() { |
| 166 Isolate::SetCurrent(saved_isolate_); | 169 Isolate::SetCurrent(saved_isolate_); |
| 167 } | 170 } |
| 168 private: | 171 private: |
| 169 Isolate* saved_isolate_; | 172 Isolate* saved_isolate_; |
| 170 | 173 |
| 171 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 174 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
| 172 }; | 175 }; |
| 173 | 176 |
| 174 } // namespace dart. | 177 } // namespace dart. |
| 175 | 178 |
| 176 #endif // VM_DART_API_IMPL_H_ | 179 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |