Chromium Code Reviews| Index: mojo/public/bindings/js/v8_wrapper.h |
| diff --git a/mojo/public/bindings/js/v8_wrapper.h b/mojo/public/bindings/js/v8_wrapper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f0a2e7b1877e4780fadb20b5bee0a5bcb5e6e63a |
| --- /dev/null |
| +++ b/mojo/public/bindings/js/v8_wrapper.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |
| +#define MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |
| + |
| +#include "v8/include/v8.h" |
| + |
| +namespace mojo { |
| +namespace js { |
| + |
| +enum InternalFields { |
| + kWrapperInfoIndex, |
| + kEncodedValueIndex, |
| + kNumberOfInternalFields, |
| +}; |
| + |
| +struct WrapperInfo { |
| + static WrapperInfo* From(v8::Handle<v8::Object> object); |
| + // Currently we just use the address of this struct for identity. |
| +}; |
| + |
| +template<typename T> |
| +struct Wrapper {}; |
|
Aaron Boodman
2013/11/09 08:26:02
The naming is a bit confused here between Wrapper,
abarth-chromium
2013/11/09 08:52:37
Yeah, this code evolved but the names didn't. I l
|
| + |
| +template<> |
| +struct Wrapper<int32_t> { |
| + static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| + int32_t native); |
| + static int32_t ToNative(v8::Handle<v8::Value> value); |
| +}; |
| + |
| +template<> |
| +struct Wrapper<uint32_t> { |
| + static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| + uint32_t native); |
| + static uint32_t ToNative(v8::Handle<v8::Value> value); |
| +}; |
| + |
| +template<> |
| +struct Wrapper<uint64_t> { |
| + static v8::Handle<v8::Value> ToObject(v8::Isolate* isolate, |
| + uint64_t native); |
| + static uint64_t ToNative(v8::Handle<v8::Value> value); |
| +}; |
| + |
| +} // js |
| +} // mojo |
| + |
| +#endif // MOJO_PUBLIC_BINDINGS_JS_V8_WRAPPER_H_ |