| 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 "V8TestInterfaceDoNotCheckConstants.h" | |
| 9 | |
| 10 #include "RuntimeEnabledFeatures.h" | |
| 11 #include "bindings/v8/ExceptionState.h" | |
| 12 #include "bindings/v8/V8DOMConfiguration.h" | |
| 13 #include "bindings/v8/V8HiddenValue.h" | |
| 14 #include "bindings/v8/V8ObjectConstructor.h" | |
| 15 #include "core/dom/ContextFeatures.h" | |
| 16 #include "core/dom/Document.h" | |
| 17 #include "platform/TraceEvent.h" | |
| 18 #include "wtf/GetPtr.h" | |
| 19 #include "wtf/RefPtr.h" | |
| 20 | |
| 21 namespace WebCore { | |
| 22 | |
| 23 static void initializeScriptWrappableForInterface(TestInterfaceDoNotCheckConstan
ts* object) | |
| 24 { | |
| 25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 26 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceDoNotCheckC
onstants::wrapperTypeInfo); | |
| 27 else | |
| 28 ASSERT_NOT_REACHED(); | |
| 29 } | |
| 30 | |
| 31 } // namespace WebCore | |
| 32 | |
| 33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceDoNotChe
ckConstants* object) | |
| 34 { | |
| 35 WebCore::initializeScriptWrappableForInterface(object); | |
| 36 } | |
| 37 | |
| 38 namespace WebCore { | |
| 39 const WrapperTypeInfo V8TestInterfaceDoNotCheckConstants::wrapperTypeInfo = { gi
n::kEmbedderBlink, V8TestInterfaceDoNotCheckConstants::domTemplate, V8TestInterf
aceDoNotCheckConstants::derefObject, 0, 0, 0, V8TestInterfaceDoNotCheckConstants
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | |
| 40 | |
| 41 namespace TestInterfaceDoNotCheckConstantsV8Internal { | |
| 42 | |
| 43 template <typename T> void V8_USE(T) { } | |
| 44 | |
| 45 } // namespace TestInterfaceDoNotCheckConstantsV8Internal | |
| 46 | |
| 47 static void configureV8TestInterfaceDoNotCheckConstantsTemplate(v8::Handle<v8::F
unctionTemplate> functionTemplate, v8::Isolate* isolate) | |
| 48 { | |
| 49 functionTemplate->ReadOnlyPrototype(); | |
| 50 | |
| 51 v8::Local<v8::Signature> defaultSignature; | |
| 52 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceDoNotCheckConstants", v8::Local<v8::FunctionTemplate>(), V8Te
stInterfaceDoNotCheckConstants::internalFieldCount, | |
| 53 0, 0, | |
| 54 0, 0, | |
| 55 0, 0, | |
| 56 isolate); | |
| 57 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 58 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 59 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceDoNotC
heckConstantsConstants[] = { | |
| 60 {"CONST_VALUE_0", 0}, | |
| 61 {"CONST_JAVASCRIPT", 1}, | |
| 62 }; | |
| 63 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestInterfaceDoNotCheckConstantsConstants, WTF_ARRAY_LENGTH(V8TestInterfaceDoNot
CheckConstantsConstants), isolate); | |
| 64 | |
| 65 // Custom toString template | |
| 66 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
| 67 } | |
| 68 | |
| 69 v8::Handle<v8::FunctionTemplate> V8TestInterfaceDoNotCheckConstants::domTemplate
(v8::Isolate* isolate) | |
| 70 { | |
| 71 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 72 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | |
| 73 if (!result.IsEmpty()) | |
| 74 return result; | |
| 75 | |
| 76 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 77 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | |
| 78 configureV8TestInterfaceDoNotCheckConstantsTemplate(result, isolate); | |
| 79 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | |
| 80 return result; | |
| 81 } | |
| 82 | |
| 83 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> v8Val
ue, v8::Isolate* isolate) | |
| 84 { | |
| 85 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 86 } | |
| 87 | |
| 88 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::findInstanceInPrototy
peChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 89 { | |
| 90 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 91 } | |
| 92 | |
| 93 TestInterfaceDoNotCheckConstants* V8TestInterfaceDoNotCheckConstants::toNativeWi
thTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
| 94 { | |
| 95 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
| 96 } | |
| 97 | |
| 98 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef
Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | |
| 99 { | |
| 100 ASSERT(impl); | |
| 101 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im
pl.get(), isolate)); | |
| 102 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 103 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 104 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 105 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 106 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 107 } | |
| 108 | |
| 109 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 110 if (UNLIKELY(wrapper.IsEmpty())) | |
| 111 return wrapper; | |
| 112 | |
| 113 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 114 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceDoNotCheckConstants>
(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | |
| 115 return wrapper; | |
| 116 } | |
| 117 | |
| 118 void V8TestInterfaceDoNotCheckConstants::derefObject(void* object) | |
| 119 { | |
| 120 fromInternalPointer(object)->deref(); | |
| 121 } | |
| 122 | |
| 123 template<> | |
| 124 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 125 { | |
| 126 return toV8(impl, creationContext, isolate); | |
| 127 } | |
| 128 | |
| 129 } // namespace WebCore | |
| OLD | NEW |