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

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

Issue 78713009: Introduce toV8NoInline (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
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 #if ENABLE(CONDITION) 34 #include "V8TestPromiseResolutionTarget.h"
35 #include "V8TestConditionalInterface.h"
36 35
37 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
38 #include "bindings/v8/ScriptController.h" 37 #include "bindings/v8/ScriptController.h"
38 #include "bindings/v8/ScriptPromiseResolver.h"
39 #include "bindings/v8/V8Binding.h" 39 #include "bindings/v8/V8Binding.h"
40 #include "bindings/v8/V8DOMConfiguration.h" 40 #include "bindings/v8/V8DOMConfiguration.h"
41 #include "bindings/v8/V8DOMWrapper.h" 41 #include "bindings/v8/V8DOMWrapper.h"
42 #include "core/dom/ContextFeatures.h" 42 #include "core/dom/ContextFeatures.h"
43 #include "core/dom/Document.h" 43 #include "core/dom/Document.h"
44 #include "platform/TraceEvent.h" 44 #include "platform/TraceEvent.h"
45 #include "wtf/UnusedParam.h" 45 #include "wtf/UnusedParam.h"
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 static void initializeScriptWrappableForInterface(TestConditionalInterface* obje ct) 49 static void initializeScriptWrappableForInterface(TestPromiseResolutionTarget* o bject)
50 { 50 {
51 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 51 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
52 ScriptWrappable::setTypeInfoInObject(object, &V8TestConditionalInterface ::wrapperTypeInfo); 52 ScriptWrappable::setTypeInfoInObject(object, &V8TestPromiseResolutionTar get::wrapperTypeInfo);
53 else 53 else
54 ASSERT_NOT_REACHED(); 54 ASSERT_NOT_REACHED();
55 } 55 }
56 56
57 } // namespace WebCore 57 } // namespace WebCore
58 58
59 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows: 59 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
60 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 60 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
61 // in the global namespace. 61 // in the global namespace.
62 // (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 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
63 void webCoreInitializeScriptWrappableForInterface(WebCore::TestConditionalInterf ace* object) 63 void webCoreInitializeScriptWrappableForInterface(WebCore::TestPromiseResolution Target* object)
64 { 64 {
65 WebCore::initializeScriptWrappableForInterface(object); 65 WebCore::initializeScriptWrappableForInterface(object);
66 } 66 }
67 67
68 namespace WebCore { 68 namespace WebCore {
69 const WrapperTypeInfo V8TestConditionalInterface::wrapperTypeInfo = { V8TestCond itionalInterface::GetTemplate, V8TestConditionalInterface::derefObject, 0, 0, 0, V8TestConditionalInterface::installPerContextEnabledMethods, 0, WrapperTypeObje ctPrototype }; 69 const WrapperTypeInfo V8TestPromiseResolutionTarget::wrapperTypeInfo = { V8TestP romiseResolutionTarget::GetTemplate, V8TestPromiseResolutionTarget::derefObject, 0, 0, 0, V8TestPromiseResolutionTarget::installPerContextEnabledMethods, 0, Wra pperTypeObjectPrototype };
70 70
71 namespace TestConditionalInterfaceV8Internal { 71 namespace TestPromiseResolutionTargetV8Internal {
72 72
73 template <typename T> void V8_USE(T) { } 73 template <typename T> void V8_USE(T) { }
74 74
75 } // namespace TestConditionalInterfaceV8Internal 75 } // namespace TestPromiseResolutionTargetV8Internal
76 76
77 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestConditionalInterfaceTempl ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra pperWorldType currentWorldType) 77 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestPromiseResolutionTargetTe mplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
78 { 78 {
79 functionTemplate->ReadOnlyPrototype(); 79 functionTemplate->ReadOnlyPrototype();
80 80
81 v8::Local<v8::Signature> defaultSignature; 81 v8::Local<v8::Signature> defaultSignature;
82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestConditionalInterface", v8::Local<v8::FunctionTemplate>(), V8TestCondit ionalInterface::internalFieldCount, 82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestPromiseResolutionTarget", v8::Local<v8::FunctionTemplate>(), V8TestPro miseResolutionTarget::internalFieldCount,
83 0, 0, 83 0, 0,
84 0, 0, 84 0, 0,
85 0, 0, 85 0, 0,
86 isolate, currentWorldType); 86 isolate, currentWorldType);
87 UNUSED_PARAM(defaultSignature); 87 UNUSED_PARAM(defaultSignature);
88 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); 88 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate();
89 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); 89 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate();
90 UNUSED_PARAM(instanceTemplate); 90 UNUSED_PARAM(instanceTemplate);
91 UNUSED_PARAM(prototypeTemplate); 91 UNUSED_PARAM(prototypeTemplate);
92 92
93 // Custom toString template 93 // Custom toString template
94 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c urrent()->toStringTemplate()); 94 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c urrent()->toStringTemplate());
95 return functionTemplate; 95 return functionTemplate;
96 } 96 }
97 97
98 v8::Handle<v8::FunctionTemplate> V8TestConditionalInterface::GetTemplate(v8::Iso late* isolate, WrapperWorldType currentWorldType) 98 v8::Handle<v8::FunctionTemplate> V8TestPromiseResolutionTarget::GetTemplate(v8:: Isolate* isolate, WrapperWorldType currentWorldType)
99 { 99 {
100 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 100 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
102 if (result != data->templateMap(currentWorldType).end()) 102 if (result != data->templateMap(currentWorldType).end())
103 return result->value.newLocal(isolate); 103 return result->value.newLocal(isolate);
104 104
105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
106 v8::HandleScope handleScope(isolate); 106 v8::HandleScope handleScope(isolate);
107 v8::Handle<v8::FunctionTemplate> templ = 107 v8::Handle<v8::FunctionTemplate> templ =
108 ConfigureV8TestConditionalInterfaceTemplate(data->rawTemplate(&wrapperTy peInfo, currentWorldType), isolate, currentWorldType); 108 ConfigureV8TestPromiseResolutionTargetTemplate(data->rawTemplate(&wrappe rTypeInfo, currentWorldType), isolate, currentWorldType);
109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
110 return handleScope.Close(templ); 110 return handleScope.Close(templ);
111 } 111 }
112 112
113 bool V8TestConditionalInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate, WrapperWorldType currentWorldType) 113 bool V8TestPromiseResolutionTarget::hasInstance(v8::Handle<v8::Value> jsValue, v 8::Isolate* isolate, WrapperWorldType currentWorldType)
114 { 114 {
115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
116 } 116 }
117 117
118 bool V8TestConditionalInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate) 118 bool V8TestPromiseResolutionTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
119 { 119 {
120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld) 120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld) 121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
122 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld); 122 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
123 } 123 }
124 124
125 v8::Handle<v8::Object> V8TestConditionalInterface::createWrapper(PassRefPtr<Test ConditionalInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 125 v8::Handle<v8::Object> V8TestPromiseResolutionTarget::createWrapper(PassRefPtr<T estPromiseResolutionTarget> impl, v8::Handle<v8::Object> creationContext, v8::Is olate* isolate)
126 { 126 {
127 ASSERT(impl); 127 ASSERT(impl);
128 ASSERT(!DOMDataStore::containsWrapper<V8TestConditionalInterface>(impl.get() , isolate)); 128 ASSERT(!DOMDataStore::containsWrapper<V8TestPromiseResolutionTarget>(impl.ge t(), isolate));
129 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 129 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
130 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 130 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
131 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 131 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
132 // the same object de-ref functions, though, so use that as the basis of the check. 132 // the same object de-ref functions, though, so use that as the basis of the check.
133 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 133 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
134 } 134 }
135 135
136 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 136 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
137 if (UNLIKELY(wrapper.IsEmpty())) 137 if (UNLIKELY(wrapper.IsEmpty()))
138 return wrapper; 138 return wrapper;
139 139
140 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 140 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
141 V8DOMWrapper::associateObjectWithWrapper<V8TestConditionalInterface>(impl, & wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); 141 V8DOMWrapper::associateObjectWithWrapper<V8TestPromiseResolutionTarget>(impl , &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
142 return wrapper; 142 return wrapper;
143 } 143 }
144 144
145 void V8TestConditionalInterface::derefObject(void* object) 145 void V8TestPromiseResolutionTarget::derefObject(void* object)
146 { 146 {
147 fromInternalPointer(object)->deref(); 147 fromInternalPointer(object)->deref();
148 } 148 }
149 149
150 template<>
151 void ScriptPromiseResolver::resolve(TestPromiseResolutionTarget* impl, v8::Handl e<v8::Object> creationContext)
152 {
153 resolve(toV8(impl, creationContext, m_isolate));
154 }
155
156 template<>
157 void ScriptPromiseResolver::reject(TestPromiseResolutionTarget* impl, v8::Handle <v8::Object> creationContext)
158 {
159 reject(toV8(impl, creationContext, m_isolate));
160 }
161
150 } // namespace WebCore 162 } // namespace WebCore
151 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698