| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | |
| 32 | |
| 33 #include "config.h" | |
| 34 #include "V8TestEvent.h" | |
| 35 | |
| 36 #include "RuntimeEnabledFeatures.h" | |
| 37 #include "bindings/v8/ExceptionMessages.h" | |
| 38 #include "bindings/v8/V8DOMConfiguration.h" | |
| 39 #include "core/dom/ContextFeatures.h" | |
| 40 #include "core/dom/Document.h" | |
| 41 #include "platform/TraceEvent.h" | |
| 42 | |
| 43 namespace WebCore { | |
| 44 | |
| 45 static void initializeScriptWrappableForInterface(TestEvent* object) | |
| 46 { | |
| 47 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 48 ScriptWrappable::setTypeInfoInObject(object, &V8TestEvent::wrapperTypeIn
fo); | |
| 49 else | |
| 50 ASSERT_NOT_REACHED(); | |
| 51 } | |
| 52 | |
| 53 } // namespace WebCore | |
| 54 | |
| 55 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | |
| 56 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | |
| 57 // in the global namespace. | |
| 58 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | |
| 59 void webCoreInitializeScriptWrappableForInterface(WebCore::TestEvent* object) | |
| 60 { | |
| 61 WebCore::initializeScriptWrappableForInterface(object); | |
| 62 } | |
| 63 | |
| 64 namespace WebCore { | |
| 65 const WrapperTypeInfo V8TestEvent::wrapperTypeInfo = { gin::kEmbedderBlink, V8Te
stEvent::domTemplate, V8TestEvent::derefObject, 0, 0, 0, V8TestEvent::installPer
ContextEnabledMethods, &V8Event::wrapperTypeInfo, WrapperTypeObjectPrototype }; | |
| 66 | |
| 67 namespace TestEventV8Internal { | |
| 68 | |
| 69 template <typename T> void V8_USE(T) { } | |
| 70 | |
| 71 } // namespace TestEventV8Internal | |
| 72 | |
| 73 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestEventTemplate(v8::Handle<
v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType c
urrentWorldType) | |
| 74 { | |
| 75 functionTemplate->ReadOnlyPrototype(); | |
| 76 | |
| 77 v8::Local<v8::Signature> defaultSignature; | |
| 78 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestEvent", V8Event::domTemplate(isolate, currentWorldType), V8TestEvent::
internalFieldCount, | |
| 79 0, 0, | |
| 80 0, 0, | |
| 81 0, 0, | |
| 82 isolate, currentWorldType); | |
| 83 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 84 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 85 | |
| 86 // Custom toString template | |
| 87 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | |
| 88 return functionTemplate; | |
| 89 } | |
| 90 | |
| 91 v8::Handle<v8::FunctionTemplate> V8TestEvent::domTemplate(v8::Isolate* isolate,
WrapperWorldType currentWorldType) | |
| 92 { | |
| 93 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 94 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | |
| 95 if (result != data->templateMap(currentWorldType).end()) | |
| 96 return result->value.newLocal(isolate); | |
| 97 | |
| 98 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 99 v8::EscapableHandleScope handleScope(isolate); | |
| 100 v8::Local<v8::FunctionTemplate> templ = | |
| 101 ConfigureV8TestEventTemplate(data->rawDOMTemplate(&wrapperTypeInfo, curr
entWorldType), isolate, currentWorldType); | |
| 102 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | |
| 103 return handleScope.Escape(templ); | |
| 104 } | |
| 105 | |
| 106 bool V8TestEvent::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | |
| 107 { | |
| 108 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | |
| 109 } | |
| 110 | |
| 111 bool V8TestEvent::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate) | |
| 112 { | |
| 113 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 114 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 115 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 116 } | |
| 117 | |
| 118 v8::Handle<v8::Object> V8TestEvent::createWrapper(PassRefPtr<TestEvent> impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 119 { | |
| 120 ASSERT(impl); | |
| 121 ASSERT(!DOMDataStore::containsWrapper<V8TestEvent>(impl.get(), isolate)); | |
| 122 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 123 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 124 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 125 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 126 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 127 } | |
| 128 | |
| 129 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 130 if (UNLIKELY(wrapper.IsEmpty())) | |
| 131 return wrapper; | |
| 132 | |
| 133 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 134 V8DOMWrapper::associateObjectWithWrapper<V8TestEvent>(impl, &wrapperTypeInfo
, wrapper, isolate, WrapperConfiguration::Independent); | |
| 135 return wrapper; | |
| 136 } | |
| 137 | |
| 138 void V8TestEvent::derefObject(void* object) | |
| 139 { | |
| 140 fromInternalPointer(object)->deref(); | |
| 141 } | |
| 142 | |
| 143 template<> | |
| 144 v8::Handle<v8::Value> toV8NoInline(TestEvent* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | |
| 145 { | |
| 146 return toV8(impl, creationContext, isolate); | |
| 147 } | |
| 148 | |
| 149 } // namespace WebCore | |
| OLD | NEW |