| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return reinterpret_cast<T*>(obj.location()); | 312 return reinterpret_cast<T*>(obj.location()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 template <class T> | 315 template <class T> |
| 316 inline v8::Local<T> ToApiHandle( | 316 inline v8::Local<T> ToApiHandle( |
| 317 v8::internal::Handle<v8::internal::Object> obj) { | 317 v8::internal::Handle<v8::internal::Object> obj) { |
| 318 return Utils::Convert<v8::internal::Object, T>(obj); | 318 return Utils::Convert<v8::internal::Object, T>(obj); |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 template <class T> |
| 323 inline bool ToLocal(v8::internal::MaybeHandle<v8::internal::Object> maybe, |
| 324 Local<T>* local) { |
| 325 v8::internal::Handle<v8::internal::Object> handle; |
| 326 if (maybe.ToHandle(&handle)) { |
| 327 *local = Utils::Convert<v8::internal::Object, T>(handle); |
| 328 return true; |
| 329 } |
| 330 return false; |
| 331 } |
| 332 |
| 333 |
| 322 // Implementations of ToLocal | 334 // Implementations of ToLocal |
| 323 | 335 |
| 324 #define MAKE_TO_LOCAL(Name, From, To) \ | 336 #define MAKE_TO_LOCAL(Name, From, To) \ |
| 325 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ | 337 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ |
| 326 return Convert<v8::internal::From, v8::To>(obj); \ | 338 return Convert<v8::internal::From, v8::To>(obj); \ |
| 327 } | 339 } |
| 328 | 340 |
| 329 | 341 |
| 330 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \ | 342 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \ |
| 331 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \ | 343 Local<v8::Type##Array> Utils::ToLocal##Type##Array( \ |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 stress_type_ = stress_type; | 704 stress_type_ = stress_type; |
| 693 } | 705 } |
| 694 | 706 |
| 695 private: | 707 private: |
| 696 static v8::Testing::StressType stress_type_; | 708 static v8::Testing::StressType stress_type_; |
| 697 }; | 709 }; |
| 698 | 710 |
| 699 } } // namespace v8::internal | 711 } } // namespace v8::internal |
| 700 | 712 |
| 701 #endif // V8_API_H_ | 713 #endif // V8_API_H_ |
| OLD | NEW |