| OLD | NEW |
| (Empty) |
| 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 "V8TestSpecialOperationsCustom.h" | |
| 9 | |
| 10 #include "RuntimeEnabledFeatures.h" | |
| 11 #include "V8Node.h" | |
| 12 #include "bindings/v8/ExceptionState.h" | |
| 13 #include "bindings/v8/V8DOMConfiguration.h" | |
| 14 #include "bindings/v8/V8HiddenValue.h" | |
| 15 #include "bindings/v8/V8ObjectConstructor.h" | |
| 16 #include "core/dom/ContextFeatures.h" | |
| 17 #include "core/dom/Document.h" | |
| 18 #include "platform/TraceEvent.h" | |
| 19 #include "wtf/GetPtr.h" | |
| 20 #include "wtf/RefPtr.h" | |
| 21 | |
| 22 namespace WebCore { | |
| 23 | |
| 24 static void initializeScriptWrappableForInterface(TestSpecialOperationsCustom* o
bject) | |
| 25 { | |
| 26 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 27 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsCus
tom::wrapperTypeInfo); | |
| 28 else | |
| 29 ASSERT_NOT_REACHED(); | |
| 30 } | |
| 31 | |
| 32 } // namespace WebCore | |
| 33 | |
| 34 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
Custom* object) | |
| 35 { | |
| 36 WebCore::initializeScriptWrappableForInterface(object); | |
| 37 } | |
| 38 | |
| 39 namespace WebCore { | |
| 40 const WrapperTypeInfo V8TestSpecialOperationsCustom::wrapperTypeInfo = { gin::kE
mbedderBlink, V8TestSpecialOperationsCustom::domTemplate, V8TestSpecialOperation
sCustom::derefObject, 0, 0, 0, V8TestSpecialOperationsCustom::installPerContextE
nabledMethods, 0, WrapperTypeObjectPrototype, false }; | |
| 41 | |
| 42 namespace TestSpecialOperationsCustomV8Internal { | |
| 43 | |
| 44 template <typename T> void V8_USE(T) { } | |
| 45 | |
| 46 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | |
| 47 { | |
| 48 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 49 V8TestSpecialOperationsCustom::indexedPropertyGetterCustom(index, info); | |
| 50 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 51 } | |
| 52 | |
| 53 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 54 { | |
| 55 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 56 V8TestSpecialOperationsCustom::indexedPropertySetterCustom(index, v8Value, i
nfo); | |
| 57 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 58 } | |
| 59 | |
| 60 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | |
| 61 { | |
| 62 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 63 V8TestSpecialOperationsCustom::indexedPropertyDeleterCustom(index, info); | |
| 64 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 65 } | |
| 66 | |
| 67 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | |
| 68 { | |
| 69 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 70 V8TestSpecialOperationsCustom::namedPropertyGetterCustom(name, info); | |
| 71 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 72 } | |
| 73 | |
| 74 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 75 { | |
| 76 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 77 V8TestSpecialOperationsCustom::namedPropertySetterCustom(name, v8Value, info
); | |
| 78 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 79 } | |
| 80 | |
| 81 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | |
| 82 { | |
| 83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 84 V8TestSpecialOperationsCustom::namedPropertyQueryCustom(name, info); | |
| 85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 86 } | |
| 87 | |
| 88 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | |
| 89 { | |
| 90 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 91 V8TestSpecialOperationsCustom::namedPropertyDeleterCustom(name, info); | |
| 92 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 93 } | |
| 94 | |
| 95 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | |
| 96 { | |
| 97 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 98 V8TestSpecialOperationsCustom::namedPropertyEnumeratorCustom(info); | |
| 99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 100 } | |
| 101 | |
| 102 } // namespace TestSpecialOperationsCustomV8Internal | |
| 103 | |
| 104 static void configureV8TestSpecialOperationsCustomTemplate(v8::Handle<v8::Functi
onTemplate> functionTemplate, v8::Isolate* isolate) | |
| 105 { | |
| 106 functionTemplate->ReadOnlyPrototype(); | |
| 107 | |
| 108 v8::Local<v8::Signature> defaultSignature; | |
| 109 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsCustom", v8::Local<v8::FunctionTemplate>(), V8TestSpe
cialOperationsCustom::internalFieldCount, | |
| 110 0, 0, | |
| 111 0, 0, | |
| 112 0, 0, | |
| 113 isolate); | |
| 114 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 115 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 116 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsCustomV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsC
ustomV8Internal::indexedPropertySetterCallback, 0, TestSpecialOperationsCustomV8
Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestSpecialO
perationsCustom>); | |
| 117 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsCustomV8Internal::namedPropertyGetterCallback, TestSpecialOperationsCusto
mV8Internal::namedPropertySetterCallback, TestSpecialOperationsCustomV8Internal:
:namedPropertyQueryCallback, TestSpecialOperationsCustomV8Internal::namedPropert
yDeleterCallback, TestSpecialOperationsCustomV8Internal::namedPropertyEnumerator
Callback); | |
| 118 | |
| 119 // Custom toString template | |
| 120 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
| 121 } | |
| 122 | |
| 123 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsCustom::domTemplate(v8::
Isolate* isolate) | |
| 124 { | |
| 125 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 126 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | |
| 127 if (!result.IsEmpty()) | |
| 128 return result; | |
| 129 | |
| 130 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 131 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | |
| 132 configureV8TestSpecialOperationsCustomTemplate(result, isolate); | |
| 133 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | |
| 134 return result; | |
| 135 } | |
| 136 | |
| 137 bool V8TestSpecialOperationsCustom::hasInstance(v8::Handle<v8::Value> v8Value, v
8::Isolate* isolate) | |
| 138 { | |
| 139 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 140 } | |
| 141 | |
| 142 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::findInstanceInPrototypeCha
in(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 143 { | |
| 144 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 145 } | |
| 146 | |
| 147 TestSpecialOperationsCustom* V8TestSpecialOperationsCustom::toNativeWithTypeChec
k(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
| 148 { | |
| 149 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
| 150 } | |
| 151 | |
| 152 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::createWrapper(PassRefPtr<T
estSpecialOperationsCustom> impl, v8::Handle<v8::Object> creationContext, v8::Is
olate* isolate) | |
| 153 { | |
| 154 ASSERT(impl); | |
| 155 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsCustom>(impl.ge
t(), isolate)); | |
| 156 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 157 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 158 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 159 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 160 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 161 } | |
| 162 | |
| 163 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 164 if (UNLIKELY(wrapper.IsEmpty())) | |
| 165 return wrapper; | |
| 166 | |
| 167 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 168 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsCustom>(impl
, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | |
| 169 return wrapper; | |
| 170 } | |
| 171 | |
| 172 void V8TestSpecialOperationsCustom::derefObject(void* object) | |
| 173 { | |
| 174 fromInternalPointer(object)->deref(); | |
| 175 } | |
| 176 | |
| 177 template<> | |
| 178 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsCustom* impl, v8::Handle
<v8::Object> creationContext, v8::Isolate* isolate) | |
| 179 { | |
| 180 return toV8(impl, creationContext, isolate); | |
| 181 } | |
| 182 | |
| 183 } // namespace WebCore | |
| OLD | NEW |