OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_API_H_ | 5 #ifndef V8_API_H_ |
6 #define V8_API_H_ | 6 #define V8_API_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "include/v8-testing.h" | 10 #include "include/v8-testing.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) { | 302 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) { |
303 return OpenHandle(*handle); | 303 return OpenHandle(*handle); |
304 } | 304 } |
305 | 305 |
306 private: | 306 private: |
307 static void ReportApiFailure(const char* location, const char* message); | 307 static void ReportApiFailure(const char* location, const char* message); |
308 }; | 308 }; |
309 | 309 |
310 | 310 |
311 template <class T> | 311 template <class T> |
312 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( | |
313 v8::EscapableHandleScope* scope) { | |
314 v8::internal::Handle<T> handle; | |
315 if (!is_null()) { | |
316 handle = *this; | |
317 } | |
318 return Utils::OpenHandle(*scope->Escape(Utils::ToLocal(handle)), true); | |
319 } | |
320 | |
321 | |
322 template <class T> | |
323 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { | 312 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { |
324 return reinterpret_cast<T*>(obj.location()); | 313 return reinterpret_cast<T*>(obj.location()); |
325 } | 314 } |
326 | 315 |
327 template <class T> | 316 template <class T> |
328 inline v8::Local<T> ToApiHandle( | 317 inline v8::Local<T> ToApiHandle( |
329 v8::internal::Handle<v8::internal::Object> obj) { | 318 v8::internal::Handle<v8::internal::Object> obj) { |
330 return Utils::Convert<v8::internal::Object, T>(obj); | 319 return Utils::Convert<v8::internal::Object, T>(obj); |
331 } | 320 } |
332 | 321 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 stress_type_ = stress_type; | 705 stress_type_ = stress_type; |
717 } | 706 } |
718 | 707 |
719 private: | 708 private: |
720 static v8::Testing::StressType stress_type_; | 709 static v8::Testing::StressType stress_type_; |
721 }; | 710 }; |
722 | 711 |
723 } } // namespace v8::internal | 712 } } // namespace v8::internal |
724 | 713 |
725 #endif // V8_API_H_ | 714 #endif // V8_API_H_ |
OLD | NEW |