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 #include "config.h"
      8 #include "V8TestInterface3.h"
      9 
     10 #include "bindings/core/v8/ExceptionState.h"
     11 #include "bindings/core/v8/V8DOMConfiguration.h"
     12 #include "bindings/core/v8/V8HiddenValue.h"
     13 #include "bindings/core/v8/V8Node.h"
     14 #include "bindings/core/v8/V8ObjectConstructor.h"
     15 #include "core/dom/ContextFeatures.h"
     16 #include "core/dom/Document.h"
     17 #include "platform/RuntimeEnabledFeatures.h"
     18 #include "platform/TraceEvent.h"
     19 #include "wtf/GetPtr.h"
     20 #include "wtf/RefPtr.h"
     21 
     22 namespace blink {
     23 
     24 const WrapperTypeInfo V8TestInterface3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface3::domTemplate, V8TestInterface3::refObject, V8TestInterface3::derefObject, V8TestInterface3::createPersistentHandle, 0, 0, V8TestInterface3::visitDOMWrapper, V8TestInterface3::installConditionallyEnabledMethods, V8TestInterface3::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject };
     25 
     26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterface3.h.
     27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
     28 // bindings/core/v8/ScriptWrappable.h.
     29 const WrapperTypeInfo& TestInterface3::s_wrapperTypeInfo = V8TestInterface3::wrapperTypeInfo;
     30 
     31 namespace TestInterface3V8Internal {
     32 
     33 template <typename T> void V8_USE(T) { }
     34 
     35 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
     36 {
     37     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
     38     V8TestInterface3::indexedPropertyGetterCustom(index, info);
     39     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     40 }
     41 
     42 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
     43 {
     44     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
     45     V8TestInterface3::indexedPropertySetterCustom(index, v8Value, info);
     46     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     47 }
     48 
     49 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
     50 {
     51     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
     52     V8TestInterface3::indexedPropertyDeleterCustom(index, info);
     53     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     54 }
     55 
     56 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
     57 {
     58     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
     59     V8TestInterface3::namedPropertyGetterCustom(name, info);
     60     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     61 }
     62 
     63 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
     64 {
     65     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
     66     V8TestInterface3::namedPropertySetterCustom(name, v8Value, info);
     67     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     68 }
     69 
     70 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
     71 {
     72     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
     73     V8TestInterface3::namedPropertyQueryCustom(name, info);
     74     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     75 }
     76 
     77 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
     78 {
     79     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
     80     V8TestInterface3::namedPropertyDeleterCustom(name, info);
     81     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     82 }
     83 
     84 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
     85 {
     86     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
     87     V8TestInterface3::namedPropertyEnumeratorCustom(info);
     88     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
     89 }
     90 
     91 } // namespace TestInterface3V8Internal
     92 
     93 static void installV8TestInterface3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
     94 {
     95     functionTemplate->ReadOnlyPrototype();
     96 
     97     v8::Local<v8::Signature> defaultSignature;
     98     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface3", v8::Local<v8::FunctionTemplate>(), V8TestInterface3::internalFieldCount,
     99         0, 0,
    100         0, 0,
    101         0, 0,
    102         isolate);
    103     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
    104     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
    105     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterface3V8Internal::indexedPropertyGetterCallback, TestInterface3V8Internal::indexedPropertySetterCallback, 0, TestInterface3V8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface3>);
    106     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface3V8Internal::namedPropertyGetterCallback, TestInterface3V8Internal::namedPropertySetterCallback, TestInterface3V8Internal::namedPropertyQueryCallback, TestInterface3V8Internal::namedPropertyDeleterCallback, TestInterface3V8Internal::namedPropertyEnumeratorCallback);
    107 
    108     // Custom toString template
    109     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
    110 }
    111 
    112 v8::Handle<v8::FunctionTemplate> V8TestInterface3::domTemplate(v8::Isolate* isolate)
    113 {
    114     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface3Template);
    115 }
    116 
    117 bool V8TestInterface3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
    118 {
    119     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
    120 }
    121 
    122 v8::Handle<v8::Object> V8TestInterface3::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
    123 {
    124     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
    125 }
    126 
    127 TestInterface3* V8TestInterface3::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
    128 {
    129     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterface3>() : 0;
    130 }
    131 
    132 
    133 void V8TestInterface3::refObject(ScriptWrappableBase* internalPointer)
    134 {
    135     internalPointer->toImpl<TestInterface3>()->ref();
    136 }
    137 
    138 void V8TestInterface3::derefObject(ScriptWrappableBase* internalPointer)
    139 {
    140     internalPointer->toImpl<TestInterface3>()->deref();
    141 }
    142 
    143 WrapperPersistentNode* V8TestInterface3::createPersistentHandle(ScriptWrappableBase* internalPointer)
    144 {
    145     ASSERT_NOT_REACHED();
    146     return 0;
    147 }
    148 
    149 template<>
    150 v8::Handle<v8::Value> toV8NoInline(TestInterface3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
    151 {
    152     return toV8(impl, creationContext, isolate);
    153 }
    154 
    155 } // namespace blink
    156