1 // Copyright 2014 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.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
7 #ifndef V8TestInterface2_h
8 #define V8TestInterface2_h
10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8DOMWrapper.h"
13 #include "bindings/core/v8/WrapperTypeInfo.h"
14 #include "bindings/tests/idls/TestInterface2.h"
15 #include "platform/heap/Handle.h"
19 class V8TestInterface2 {
21 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
22 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
23 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
24 static TestInterface2* toNative(v8::Handle<v8::Object> object)
26 return fromInternalPointer(blink::toInternalPointer(object));
28 static TestInterface2* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
29 static const WrapperTypeInfo wrapperTypeInfo;
30 static void derefObject(ScriptWrappableBase* internalPointer);
31 static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8::Persistent<v8::Object>&, v8::Isolate*);
32 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
33 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
34 static inline ScriptWrappableBase* toInternalPointer(TestInterface2* impl)
36 return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
39 static inline TestInterface2* fromInternalPointer(ScriptWrappableBase* internalPointer)
41 return reinterpret_cast<TestInterface2*>(static_cast<void*>(internalPointer));
43 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
44 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
47 friend v8::Handle<v8::Object> wrap(TestInterface2*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
48 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterface2>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
51 v8::Handle<v8::Object> wrap(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
53 inline v8::Handle<v8::Value> toV8(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
56 return v8::Null(isolate);
57 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterface2>(impl, isolate);
58 if (!wrapper.IsEmpty())
60 return wrap(impl, creationContext, isolate);
63 template<typename CallbackInfo>
64 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface2* impl)
66 if (UNLIKELY(!impl)) {
67 v8SetReturnValueNull(callbackInfo);
70 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterface2>(callbackInfo.GetReturnValue(), impl))
72 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
73 v8SetReturnValue(callbackInfo, wrapper);
76 template<typename CallbackInfo>
77 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterface2* impl)
79 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
80 if (UNLIKELY(!impl)) {
81 v8SetReturnValueNull(callbackInfo);
84 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterface2>(callbackInfo.GetReturnValue(), impl))
86 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
87 v8SetReturnValue(callbackInfo, wrapper);
90 template<class CallbackInfo, class Wrappable>
91 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface2* impl, Wrappable* wrappable)
93 if (UNLIKELY(!impl)) {
94 v8SetReturnValueNull(callbackInfo);
97 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterface2>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
99 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
100 v8SetReturnValue(callbackInfo, wrapper);
103 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
105 return toV8(impl.get(), creationContext, isolate);
108 template<class CallbackInfo>
109 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl)
111 v8SetReturnValue(callbackInfo, impl.get());
114 template<class CallbackInfo>
115 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl)
117 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
120 template<class CallbackInfo, class Wrappable>
121 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl, Wrappable* wrappable)
123 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
127 #endif // V8TestInterface2_h