OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |
| 6 #define MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |
| 7 |
| 8 #include "v8/include/v8.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace js { |
| 12 |
| 13 enum InternalFields { |
| 14 kWrapperInfoIndex, |
| 15 kEncodedValueIndex, |
| 16 kNumberOfInternalFields, |
| 17 }; |
| 18 |
| 19 struct WrapperInfo { |
| 20 static WrapperInfo* From(v8::Handle<v8::Object> object); |
| 21 // Currently we just use the address of this struct for identity. |
| 22 }; |
| 23 |
| 24 template<typename T> |
| 25 struct Wrapper {}; |
| 26 |
| 27 template<> |
| 28 struct Wrapper<int32_t> { |
| 29 static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| 30 int32_t native); |
| 31 static int32_t ToNative(v8::Handle<v8::Value> value); |
| 32 }; |
| 33 |
| 34 template<> |
| 35 struct Wrapper<uint32_t> { |
| 36 static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| 37 uint32_t native); |
| 38 static uint32_t ToNative(v8::Handle<v8::Value> value); |
| 39 }; |
| 40 |
| 41 template<> |
| 42 struct Wrapper<uint64_t> { |
| 43 static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| 44 uint64_t native); |
| 45 static uint64_t ToNative(v8::Handle<v8::Value> value); |
| 46 }; |
| 47 |
| 48 } // namespace js |
| 49 } // namespace mojo |
| 50 |
| 51 #endif // MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |
OLD | NEW |