Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfacePython3.cpp

Issue 114813006: IDL compiler: [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: gclw Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython3.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "V8TestInterfacePython2.h" 34 #include "V8TestInterfacePython3.h"
35 35
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "V8Interface1.h"
38 #include "V8Interface2.h"
39 #include "bindings/v8/ExceptionState.h" 37 #include "bindings/v8/ExceptionState.h"
40 #include "bindings/v8/V8DOMConfiguration.h" 38 #include "bindings/v8/V8DOMConfiguration.h"
41 #include "core/dom/ContextFeatures.h" 39 #include "core/dom/ContextFeatures.h"
42 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
43 #include "platform/TraceEvent.h" 41 #include "platform/TraceEvent.h"
44 42
45 namespace WebCore { 43 namespace WebCore {
46 44
47 static void initializeScriptWrappableForInterface(TestInterfacePython2* object) 45 static void initializeScriptWrappableForInterface(TestInterfacePython3* object)
48 { 46 {
49 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 47 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
50 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython2::wr apperTypeInfo); 48 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython3::wr apperTypeInfo);
51 else 49 else
52 ASSERT_NOT_REACHED(); 50 ASSERT_NOT_REACHED();
53 } 51 }
54 52
55 } // namespace WebCore 53 } // namespace WebCore
56 54
57 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows: 55 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
58 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 56 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
59 // in the global namespace. 57 // in the global namespace.
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) 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)
61 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython2* object) 59 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython3* object)
62 { 60 {
63 WebCore::initializeScriptWrappableForInterface(object); 61 WebCore::initializeScriptWrappableForInterface(object);
64 } 62 }
65 63
66 namespace WebCore { 64 namespace WebCore {
67 const WrapperTypeInfo V8TestInterfacePython2::wrapperTypeInfo = { gin::kEmbedder Blink, V8TestInterfacePython2::domTemplate, V8TestInterfacePython2::derefObject, 0, 0, V8TestInterfacePython2::visitDOMWrapper, V8TestInterfacePython2::installP erContextEnabledMethods, 0, WrapperTypeObjectPrototype }; 65 const WrapperTypeInfo V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject, 0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP erContextEnabledMethods, 0, WrapperTypeObjectPrototype };
68 66
69 namespace TestInterfacePython2V8Internal { 67 namespace TestInterfacePython3V8Internal {
70 68
71 template <typename T> void V8_USE(T) { } 69 template <typename T> void V8_USE(T) { }
72 70
73 } // namespace TestInterfacePython2V8Internal 71 } // namespace TestInterfacePython3V8Internal
74 72
75 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePython2Template( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType) 73 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePython3Template( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType)
76 { 74 {
77 functionTemplate->ReadOnlyPrototype(); 75 functionTemplate->ReadOnlyPrototype();
78 76
79 v8::Local<v8::Signature> defaultSignature; 77 v8::Local<v8::Signature> defaultSignature;
80 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP ython2::internalFieldCount, 78 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP ython3::internalFieldCount,
81 0, 0, 79 0, 0,
82 0, 0, 80 0, 0,
83 0, 0, 81 0, 0,
84 isolate, currentWorldType); 82 isolate, currentWorldType);
85 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 83 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
86 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 84 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
87 85
88 // Custom toString template 86 // Custom toString template
89 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 87 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
90 return functionTemplate; 88 return functionTemplate;
91 } 89 }
92 90
93 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType) 91 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType)
94 { 92 {
95 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 93 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
96 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 94 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
97 if (result != data->templateMap(currentWorldType).end()) 95 if (result != data->templateMap(currentWorldType).end())
98 return result->value.newLocal(isolate); 96 return result->value.newLocal(isolate);
99 97
100 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 98 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
101 v8::EscapableHandleScope handleScope(isolate); 99 v8::EscapableHandleScope handleScope(isolate);
102 v8::Local<v8::FunctionTemplate> templ = 100 v8::Local<v8::FunctionTemplate> templ =
103 ConfigureV8TestInterfacePython2Template(data->rawDOMTemplate(&wrapperTyp eInfo, currentWorldType), isolate, currentWorldType); 101 ConfigureV8TestInterfacePython3Template(data->rawDOMTemplate(&wrapperTyp eInfo, currentWorldType), isolate, currentWorldType);
104 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 102 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
105 return handleScope.Escape(templ); 103 return handleScope.Escape(templ);
106 } 104 }
107 105
108 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType) 106 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType)
109 { 107 {
110 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 108 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
111 } 109 }
112 110
113 bool V8TestInterfacePython2::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate) 111 bool V8TestInterfacePython3::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
114 { 112 {
115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld) 113 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
116 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld) 114 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
117 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld); 115 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
118 } 116 }
119 117
120 v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 118 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate )
121 { 119 {
122 ASSERT(impl); 120 ASSERT(impl);
123 if (impl->isInterface1()) 121 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is olate));
124 return wrap(toInterface1(impl), creationContext, isolate);
125 if (impl->isInterface2())
126 return wrap(toInterface2(impl), creationContext, isolate);
127 v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl, creationContext, isolate);
128 return wrapper;
129 }
130
131 v8::Handle<v8::Object> V8TestInterfacePython2::createWrapper(PassRefPtr<TestInte rfacePython2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate )
132 {
133 ASSERT(impl);
134 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython2>(impl.get(), is olate));
135 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 122 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
136 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 123 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
137 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 124 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
138 // the same object de-ref functions, though, so use that as the basis of the check. 125 // the same object de-ref functions, though, so use that as the basis of the check.
139 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 126 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
140 } 127 }
141 128
142 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 129 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
143 if (UNLIKELY(wrapper.IsEmpty())) 130 if (UNLIKELY(wrapper.IsEmpty()))
144 return wrapper; 131 return wrapper;
145 132
146 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 133 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
147 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython2>(impl, &wrap perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); 134 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython3>(impl, &wrap perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
148 return wrapper; 135 return wrapper;
149 } 136 }
150 137
151 void V8TestInterfacePython2::derefObject(void* object) 138 void V8TestInterfacePython3::derefObject(void* object)
152 { 139 {
153 fromInternalPointer(object)->deref(); 140 fromInternalPointer(object)->deref();
154 } 141 }
155 142
156 template<> 143 template<>
157 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate) 144 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
158 { 145 {
159 return toV8(impl, creationContext, isolate); 146 return toV8(impl, creationContext, isolate);
160 } 147 }
161 148
162 } // namespace WebCore 149 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython3.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698