Home | History | Annotate | Download | only in core
      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.
      4 
      5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
      6 
      7 #ifndef V8TestInterfaceWillBeGarbageCollected_h
      8 #define V8TestInterfaceWillBeGarbageCollected_h
      9 
     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/V8EventTarget.h"
     14 #include "bindings/core/v8/WrapperTypeInfo.h"
     15 #include "bindings/tests/idls/core/TestInterfaceWillBeGarbageCollected.h"
     16 #include "platform/heap/Handle.h"
     17 
     18 namespace blink {
     19 
     20 class V8TestInterfaceWillBeGarbageCollectedConstructor {
     21 public:
     22     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
     23     static const WrapperTypeInfo wrapperTypeInfo;
     24 };
     25 
     26 class V8TestInterfaceWillBeGarbageCollected {
     27 public:
     28     static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
     29     static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
     30     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
     31     static TestInterfaceWillBeGarbageCollected* toImpl(v8::Handle<v8::Object> object)
     32     {
     33         return toImpl(blink::toScriptWrappableBase(object));
     34     }
     35     static TestInterfaceWillBeGarbageCollected* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
     36     static const WrapperTypeInfo wrapperTypeInfo;
     37     static void refObject(ScriptWrappableBase* internalPointer);
     38     static void derefObject(ScriptWrappableBase* internalPointer);
     39     static WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer);
     40     static EventTarget* toEventTarget(v8::Handle<v8::Object>);
     41     static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
     42     static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
     43 #if ENABLE(OILPAN)
     44     static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 1;
     45     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1 + 1;
     46 #else
     47     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
     48 #endif
     49     static inline ScriptWrappableBase* toScriptWrappableBase(TestInterfaceWillBeGarbageCollected* impl)
     50     {
     51         return impl->toScriptWrappableBase();
     52     }
     53 
     54     static inline TestInterfaceWillBeGarbageCollected* toImpl(ScriptWrappableBase* internalPointer)
     55     {
     56         return internalPointer->toImpl<TestInterfaceWillBeGarbageCollected>();
     57     }
     58     static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
     59     static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
     60 
     61 private:
     62 };
     63 
     64 inline v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     65 {
     66     return impl->wrap(creationContext, isolate);
     67 }
     68 
     69 inline v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     70 {
     71     if (UNLIKELY(!impl))
     72         return v8::Null(isolate);
     73     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate);
     74     if (!wrapper.IsEmpty())
     75         return wrapper;
     76 
     77     return impl->wrap(creationContext, isolate);
     78 }
     79 
     80 template<typename CallbackInfo>
     81 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
     82 {
     83     if (UNLIKELY(!impl)) {
     84         v8SetReturnValueNull(callbackInfo);
     85         return;
     86     }
     87     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
     88         return;
     89     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
     90     v8SetReturnValue(callbackInfo, wrapper);
     91 }
     92 
     93 template<typename CallbackInfo>
     94 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
     95 {
     96     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
     97     if (UNLIKELY(!impl)) {
     98         v8SetReturnValueNull(callbackInfo);
     99         return;
    100     }
    101     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
    102         return;
    103     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
    104     v8SetReturnValue(callbackInfo, wrapper);
    105 }
    106 
    107 template<class CallbackInfo, class Wrappable>
    108 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl, Wrappable* wrappable)
    109 {
    110     if (UNLIKELY(!impl)) {
    111         v8SetReturnValueNull(callbackInfo);
    112         return;
    113     }
    114     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
    115         return;
    116     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
    117     v8SetReturnValue(callbackInfo, wrapper);
    118 }
    119 
    120 inline v8::Handle<v8::Value> toV8(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
    121 {
    122     return toV8(impl.get(), creationContext, isolate);
    123 }
    124 
    125 template<class CallbackInfo>
    126 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
    127 {
    128     v8SetReturnValue(callbackInfo, impl.get());
    129 }
    130 
    131 template<class CallbackInfo>
    132 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
    133 {
    134     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
    135 }
    136 
    137 template<class CallbackInfo, class Wrappable>
    138 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, Wrappable* wrappable)
    139 {
    140     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
    141 }
    142 
    143 } // namespace blink
    144 #endif // V8TestInterfaceWillBeGarbageCollected_h
    145