| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2013 Google Inc. All rights reserved. | 2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
| 3  * | 3  * | 
| 4  * Redistribution and use in source and binary forms, with or without | 4  * Redistribution and use in source and binary forms, with or without | 
| 5  * modification, are permitted provided that the following conditions are | 5  * modification, are permitted provided that the following conditions are | 
| 6  * met: | 6  * met: | 
| 7  * | 7  * | 
| 8  *     * Redistributions of source code must retain the above copyright | 8  *     * Redistributions of source code must retain the above copyright | 
| 9  * notice, this list of conditions and the following disclaimer. | 9  * notice, this list of conditions and the following disclaimer. | 
| 10  *     * Redistributions in binary form must reproduce the above | 10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
| 25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
| 26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| 27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 29  */ | 29  */ | 
| 30 | 30 | 
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 
| 32 | 32 | 
| 33 #include "config.h" | 33 #include "config.h" | 
| 34 #include "V8TestCustomWrapInterface.h" | 34 #include "V8TestCustomToV8Interface.h" | 
| 35 | 35 | 
| 36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" | 
| 37 #include "bindings/v8/ScriptController.h" |  | 
| 38 #include "bindings/v8/V8Binding.h" | 37 #include "bindings/v8/V8Binding.h" | 
| 39 #include "bindings/v8/V8DOMConfiguration.h" | 38 #include "bindings/v8/V8DOMConfiguration.h" | 
| 40 #include "bindings/v8/V8DOMWrapper.h" | 39 #include "bindings/v8/V8DOMWrapper.h" | 
| 41 #include "core/dom/ContextFeatures.h" | 40 #include "core/dom/ContextFeatures.h" | 
| 42 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" | 
| 43 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" | 
| 44 #include "wtf/UnusedParam.h" | 43 #include "wtf/UnusedParam.h" | 
| 45 | 44 | 
| 46 namespace WebCore { | 45 namespace WebCore { | 
| 47 | 46 | 
| 48 static void initializeScriptWrappableForInterface(TestCustomWrapInterface* objec
     t) | 47 static void initializeScriptWrappableForInterface(TestCustomToV8Interface* objec
     t) | 
| 49 { | 48 { | 
| 50     if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 49     if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 
| 51         ScriptWrappable::setTypeInfoInObject(object, &V8TestCustomWrapInterface:
     :wrapperTypeInfo); | 50         ScriptWrappable::setTypeInfoInObject(object, &V8TestCustomToV8Interface:
     :wrapperTypeInfo); | 
| 52     else | 51     else | 
| 53         ASSERT_NOT_REACHED(); | 52         ASSERT_NOT_REACHED(); | 
| 54 } | 53 } | 
| 55 | 54 | 
| 56 } // namespace WebCore | 55 } // namespace WebCore | 
| 57 | 56 | 
| 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
     e on Windows: | 57 // In ScriptWrappable::init, the use of a local function declaration has an issu
     e on Windows: | 
| 59 // the local declaration does not pick up the surrounding namespace. Therefore, 
     we provide this function | 58 // the local declaration does not pick up the surrounding namespace. Therefore, 
     we provide this function | 
| 60 // in the global namespace. | 59 // in the global namespace. | 
| 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
     edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 60 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
     edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 
| 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestCustomWrapInterfa
     ce* object) | 61 void webCoreInitializeScriptWrappableForInterface(WebCore::TestCustomToV8Interfa
     ce* object) | 
| 63 { | 62 { | 
| 64     WebCore::initializeScriptWrappableForInterface(object); | 63     WebCore::initializeScriptWrappableForInterface(object); | 
| 65 } | 64 } | 
| 66 | 65 | 
| 67 namespace WebCore { | 66 namespace WebCore { | 
| 68 const WrapperTypeInfo V8TestCustomWrapInterface::wrapperTypeInfo = { gin::kEmbed
     derBlink, V8TestCustomWrapInterface::GetTemplate, V8TestCustomWrapInterface::der
     efObject, 0, 0, 0, V8TestCustomWrapInterface::installPerContextEnabledMethods, 0
     , WrapperTypeObjectPrototype }; | 67 const WrapperTypeInfo V8TestCustomToV8Interface::wrapperTypeInfo = { gin::kEmbed
     derBlink, V8TestCustomToV8Interface::GetTemplate, V8TestCustomToV8Interface::der
     efObject, 0, 0, 0, V8TestCustomToV8Interface::installPerContextEnabledMethods, 0
     , WrapperTypeObjectPrototype }; | 
| 69 | 68 | 
| 70 namespace TestCustomWrapInterfaceV8Internal { | 69 namespace TestCustomToV8InterfaceV8Internal { | 
| 71 | 70 | 
| 72 template <typename T> void V8_USE(T) { } | 71 template <typename T> void V8_USE(T) { } | 
| 73 | 72 | 
| 74 } // namespace TestCustomWrapInterfaceV8Internal | 73 } // namespace TestCustomToV8InterfaceV8Internal | 
| 75 | 74 | 
| 76 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCustomWrapInterfaceTempla
     te(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrap
     perWorldType currentWorldType) | 75 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCustomToV8InterfaceTempla
     te(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrap
     perWorldType currentWorldType) | 
| 77 { | 76 { | 
| 78     functionTemplate->ReadOnlyPrototype(); | 77     functionTemplate->ReadOnlyPrototype(); | 
| 79 | 78 | 
| 80     v8::Local<v8::Signature> defaultSignature; | 79     v8::Local<v8::Signature> defaultSignature; | 
| 81     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
     ate, "TestCustomWrapInterface", v8::Local<v8::FunctionTemplate>(), V8TestCustomW
     rapInterface::internalFieldCount, | 80     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
     ate, "TestCustomToV8Interface", v8::Local<v8::FunctionTemplate>(), V8TestCustomT
     oV8Interface::internalFieldCount, | 
| 82         0, 0, | 81         0, 0, | 
| 83         0, 0, | 82         0, 0, | 
| 84         0, 0, | 83         0, 0, | 
| 85         isolate, currentWorldType); | 84         isolate, currentWorldType); | 
| 86     UNUSED_PARAM(defaultSignature); | 85     UNUSED_PARAM(defaultSignature); | 
| 87     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); | 86     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); | 
| 88     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); | 87     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); | 
| 89     UNUSED_PARAM(instanceTemplate); | 88     UNUSED_PARAM(instanceTemplate); | 
| 90     UNUSED_PARAM(prototypeTemplate); | 89     UNUSED_PARAM(prototypeTemplate); | 
| 91 | 90 | 
| 92     // Custom toString template | 91     // Custom toString template | 
| 93     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); | 92     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); | 
| 94     return functionTemplate; | 93     return functionTemplate; | 
| 95 } | 94 } | 
| 96 | 95 | 
| 97 v8::Handle<v8::FunctionTemplate> V8TestCustomWrapInterface::GetTemplate(v8::Isol
     ate* isolate, WrapperWorldType currentWorldType) | 96 v8::Handle<v8::FunctionTemplate> V8TestCustomToV8Interface::GetTemplate(v8::Isol
     ate* isolate, WrapperWorldType currentWorldType) | 
| 98 { | 97 { | 
| 99     V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 98     V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 
| 100     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); | 99     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); | 
| 101     if (result != data->templateMap(currentWorldType).end()) | 100     if (result != data->templateMap(currentWorldType).end()) | 
| 102         return result->value.newLocal(isolate); | 101         return result->value.newLocal(isolate); | 
| 103 | 102 | 
| 104     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 103     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 
| 105     v8::HandleScope handleScope(isolate); | 104     v8::HandleScope handleScope(isolate); | 
| 106     v8::Handle<v8::FunctionTemplate> templ = | 105     v8::Handle<v8::FunctionTemplate> templ = | 
| 107         ConfigureV8TestCustomWrapInterfaceTemplate(data->rawTemplate(&wrapperTyp
     eInfo, currentWorldType), isolate, currentWorldType); | 106         ConfigureV8TestCustomToV8InterfaceTemplate(data->rawTemplate(&wrapperTyp
     eInfo, currentWorldType), isolate, currentWorldType); | 
| 108     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); | 107     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); | 
| 109     return handleScope.Close(templ); | 108     return handleScope.Close(templ); | 
| 110 } | 109 } | 
| 111 | 110 | 
| 112 bool V8TestCustomWrapInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::I
     solate* isolate, WrapperWorldType currentWorldType) | 111 bool V8TestCustomToV8Interface::hasInstance(v8::Handle<v8::Value> jsValue, v8::I
     solate* isolate, WrapperWorldType currentWorldType) | 
| 113 { | 112 { | 
| 114     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); | 113     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); | 
| 115 } | 114 } | 
| 116 | 115 | 
| 117 bool V8TestCustomWrapInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsVa
     lue, v8::Isolate* isolate) | 116 bool V8TestCustomToV8Interface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsVa
     lue, v8::Isolate* isolate) | 
| 118 { | 117 { | 
| 119     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) | 118     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) | 
| 120         || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, IsolatedWorld) | 119         || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, IsolatedWorld) | 
| 121         || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, WorkerWorld); | 120         || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, WorkerWorld); | 
| 122 } | 121 } | 
| 123 | 122 | 
| 124 v8::Handle<v8::Object> V8TestCustomWrapInterface::createWrapper(PassRefPtr<TestC
     ustomWrapInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* i
     solate) | 123 void V8TestCustomToV8Interface::derefObject(void* object) | 
| 125 { |  | 
| 126     ASSERT(impl); |  | 
| 127     ASSERT(!DOMDataStore::containsWrapper<V8TestCustomWrapInterface>(impl.get(),
      isolate)); |  | 
| 128     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |  | 
| 129         const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
     ct(impl.get()); |  | 
| 130         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
     TypeInfo. These will both have |  | 
| 131         // the same object de-ref functions, though, so use that as the basis of
      the check. |  | 
| 132         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
      == wrapperTypeInfo.derefObjectFunction); |  | 
| 133     } |  | 
| 134 |  | 
| 135     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
     , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |  | 
| 136     if (UNLIKELY(wrapper.IsEmpty())) |  | 
| 137         return wrapper; |  | 
| 138 |  | 
| 139     installPerContextEnabledProperties(wrapper, impl.get(), isolate); |  | 
| 140     V8DOMWrapper::associateObjectWithWrapper<V8TestCustomWrapInterface>(impl, &w
     rapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |  | 
| 141     return wrapper; |  | 
| 142 } |  | 
| 143 |  | 
| 144 void V8TestCustomWrapInterface::derefObject(void* object) |  | 
| 145 { | 124 { | 
| 146     fromInternalPointer(object)->deref(); | 125     fromInternalPointer(object)->deref(); | 
| 147 } | 126 } | 
| 148 | 127 | 
| 149 } // namespace WebCore | 128 } // namespace WebCore | 
| OLD | NEW | 
|---|