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 V8TestException_h
8 #define V8TestException_h
10 #include "bindings/tests/idls/TestException.h"
11 #include "bindings/v8/V8Binding.h"
12 #include "bindings/v8/V8DOMWrapper.h"
13 #include "bindings/v8/WrapperTypeInfo.h"
14 #include "heap/Handle.h"
18 class V8TestException {
20 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
21 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
22 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
23 static TestException* toNative(v8::Handle<v8::Object> object)
25 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
27 static TestException* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
28 static const WrapperTypeInfo wrapperTypeInfo;
29 static void derefObject(void*);
30 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
31 static inline void* toInternalPointer(TestException* impl)
36 static inline TestException* fromInternalPointer(void* object)
38 return static_cast<TestException*>(object);
40 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestException*, v8::Isolate*) { }
41 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
44 friend v8::Handle<v8::Object> wrap(TestException*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
45 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestException>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
48 inline v8::Handle<v8::Object> wrap(TestException* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
51 ASSERT(!DOMDataStore::containsWrapper<V8TestException>(impl, isolate));
52 return V8TestException::createWrapper(impl, creationContext, isolate);
55 inline v8::Handle<v8::Value> toV8(TestException* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
58 return v8::Null(isolate);
59 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestException>(impl, isolate);
60 if (!wrapper.IsEmpty())
62 return wrap(impl, creationContext, isolate);
65 template<typename CallbackInfo>
66 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestException* impl)
68 if (UNLIKELY(!impl)) {
69 v8SetReturnValueNull(callbackInfo);
72 if (DOMDataStore::setReturnValueFromWrapper<V8TestException>(callbackInfo.GetReturnValue(), impl))
74 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
75 v8SetReturnValue(callbackInfo, wrapper);
78 template<typename CallbackInfo>
79 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestException* impl)
81 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate())->isMainWorld());
82 if (UNLIKELY(!impl)) {
83 v8SetReturnValueNull(callbackInfo);
86 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestException>(callbackInfo.GetReturnValue(), impl))
88 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
89 v8SetReturnValue(callbackInfo, wrapper);
92 template<class CallbackInfo, class Wrappable>
93 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestException* impl, Wrappable* wrappable)
95 if (UNLIKELY(!impl)) {
96 v8SetReturnValueNull(callbackInfo);
99 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestException>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
101 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
102 v8SetReturnValue(callbackInfo, wrapper);
105 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestException> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
107 return toV8(impl.get(), creationContext, isolate);
110 template<class CallbackInfo>
111 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestException> impl)
113 v8SetReturnValue(callbackInfo, impl.get());
116 template<class CallbackInfo>
117 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestException> impl)
119 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
122 template<class CallbackInfo, class Wrappable>
123 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestException> impl, Wrappable* wrappable)
125 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
129 #endif // V8TestException_h