Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 1 | /* |
| 2 | This file is part of the Blink open source project. |
| 3 | This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Library General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Library General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Library General Public License |
| 16 | along with this library; see the file COPYING.LIB. If not, write to |
| 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 | Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | |
| 21 | #ifndef V8TestCustomAccessors_h |
| 22 | #define V8TestCustomAccessors_h |
| 23 | |
| 24 | #include "bindings/bindings/tests/idls/TestCustomAccessors.h" |
| 25 | #include "bindings/v8/V8Binding.h" |
| 26 | #include "bindings/v8/V8DOMWrapper.h" |
| 27 | #include "bindings/v8/WrapperTypeInfo.h" |
| 28 | |
| 29 | namespace WebCore { |
| 30 | |
| 31 | class V8TestCustomAccessors { |
| 32 | public: |
| 33 | static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldType); |
| 34 | static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 35 | static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 36 | static TestCustomAccessors* toNative(v8::Handle<v8::Object> object) |
| 37 | { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 38 | return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 39 | } |
| 40 | static void derefObject(void*); |
| 41 | static WrapperTypeInfo info; |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 42 | static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&); |
| 43 | static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&); |
| 44 | static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&); |
| 45 | static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&); |
| 46 | static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&); |
| 47 | static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&); |
| 48 | static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8::Array>&); |
| 49 | static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 50 | static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 51 | static inline void* toInternalPointer(TestCustomAccessors* impl) |
| 52 | { |
| 53 | return impl; |
| 54 | } |
| 55 | |
| 56 | static inline TestCustomAccessors* fromInternalPointer(void* object) |
| 57 | { |
| 58 | return static_cast<TestCustomAccessors*>(object); |
| 59 | } |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 60 | static void installPerContextProperties(v8::Handle<v8::Object>, TestCustomAccessors*, v8::Isolate*) { } |
| 61 | static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { } |
| 62 | private: |
| 63 | friend v8::Handle<v8::Object> wrap(TestCustomAccessors*, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| 64 | static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestCustomAccessors>, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| 65 | }; |
| 66 | |
| 67 | template<> |
| 68 | class WrapperTypeTraits<TestCustomAccessors > { |
| 69 | public: |
| 70 | static WrapperTypeInfo* info() { return &V8TestCustomAccessors::info; } |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | inline v8::Handle<v8::Object> wrap(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 75 | { |
| 76 | ASSERT(impl); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 77 | ASSERT(DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate).IsEmpty()); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 78 | return V8TestCustomAccessors::createWrapper(impl, creationContext, isolate); |
| 79 | } |
| 80 | |
| 81 | inline v8::Handle<v8::Value> toV8(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 82 | { |
| 83 | if (UNLIKELY(!impl)) |
| 84 | return v8NullWithCheck(isolate); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 85 | v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 86 | if (!wrapper.IsEmpty()) |
| 87 | return wrapper; |
| 88 | return wrap(impl, creationContext, isolate); |
| 89 | } |
| 90 | |
| 91 | inline v8::Handle<v8::Value> toV8ForMainWorld(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 92 | { |
| 93 | ASSERT(worldType(isolate) == MainWorld); |
| 94 | if (UNLIKELY(!impl)) |
| 95 | return v8NullWithCheck(isolate); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 96 | v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 97 | if (!wrapper.IsEmpty()) |
| 98 | return wrapper; |
| 99 | return wrap(impl, creationContext, isolate); |
| 100 | } |
| 101 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 102 | template<class CallbackInfo, class Wrappable> |
| 103 | inline v8::Handle<v8::Value> toV8Fast(TestCustomAccessors* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable) |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 104 | { |
| 105 | if (UNLIKELY(!impl)) |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 106 | return v8::Null(callbackInfo.GetIsolate()); |
| 107 | v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestCustomAccessors>(impl, callbackInfo, wrappable); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 108 | if (!wrapper.IsEmpty()) |
| 109 | return wrapper; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 110 | return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 111 | } |
| 112 | |
Ben Murdoch | 8375017 | 2013-07-24 10:36:59 +0100 | [diff] [blame^] | 113 | inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 114 | { |
Ben Murdoch | 8375017 | 2013-07-24 10:36:59 +0100 | [diff] [blame^] | 115 | return toV8ForMainWorld(impl.get(), creationContext, isolate); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 119 | template<class CallbackInfo, class Wrappable> |
| 120 | inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestCustomAccessors > impl, const CallbackInfo& callbackInfo, Wrappable* wrappable) |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 121 | { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 122 | return toV8Fast(impl.get(), callbackInfo, wrappable); |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 126 | { |
| 127 | return toV8(impl.get(), creationContext, isolate); |
| 128 | } |
| 129 | |
| 130 | } |
| 131 | |
| 132 | #endif // V8TestCustomAccessors_h |