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

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

Issue 110023002: IDL compiler: [InitializedByEventConstructor] attribute any (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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/idls/TestInterfaceEventConstructor.idl ('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 18 matching lines...) Expand all
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 "V8TestInterfaceEventConstructor.h" 34 #include "V8TestInterfaceEventConstructor.h"
35 35
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "bindings/v8/Dictionary.h" 37 #include "bindings/v8/Dictionary.h"
38 #include "bindings/v8/ExceptionMessages.h" 38 #include "bindings/v8/ExceptionMessages.h"
39 #include "bindings/v8/ScriptValue.h"
40 #include "bindings/v8/SerializedScriptValue.h"
39 #include "bindings/v8/V8DOMConfiguration.h" 41 #include "bindings/v8/V8DOMConfiguration.h"
40 #include "bindings/v8/V8ObjectConstructor.h" 42 #include "bindings/v8/V8ObjectConstructor.h"
41 #include "core/dom/ContextFeatures.h" 43 #include "core/dom/ContextFeatures.h"
42 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
43 #include "platform/TraceEvent.h" 45 #include "platform/TraceEvent.h"
44 #include "wtf/UnusedParam.h" 46 #include "wtf/UnusedParam.h"
45 47
46 namespace WebCore { 48 namespace WebCore {
47 49
48 static void initializeScriptWrappableForInterface(TestInterfaceEventConstructor* object) 50 static void initializeScriptWrappableForInterface(TestInterfaceEventConstructor* object)
(...skipping 15 matching lines...) Expand all
64 WebCore::initializeScriptWrappableForInterface(object); 66 WebCore::initializeScriptWrappableForInterface(object);
65 } 67 }
66 68
67 namespace WebCore { 69 namespace WebCore {
68 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin:: kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEve ntConstructor::derefObject, 0, 0, 0, V8TestInterfaceEventConstructor::installPer ContextEnabledMethods, &V8Event::wrapperTypeInfo, WrapperTypeObjectPrototype }; 70 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin:: kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEve ntConstructor::derefObject, 0, 0, 0, V8TestInterfaceEventConstructor::installPer ContextEnabledMethods, &V8Event::wrapperTypeInfo, WrapperTypeObjectPrototype };
69 71
70 namespace TestInterfaceEventConstructorV8Internal { 72 namespace TestInterfaceEventConstructorV8Internal {
71 73
72 template <typename T> void V8_USE(T) { } 74 template <typename T> void V8_USE(T) { }
73 75
74 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info ) 76 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
75 { 77 {
76 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati ve(info.Holder()); 78 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati ve(info.Holder());
77 v8SetReturnValueString(info, imp->attr1(), info.GetIsolate()); 79 v8SetReturnValueString(info, imp->readonlyStringAttribute(), info.GetIsolate ());
78 } 80 }
79 81
80 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper tyCallbackInfo<v8::Value>& info) 82 static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
81 { 83 {
82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
83 TestInterfaceEventConstructorV8Internal::attr1AttributeGetter(info); 85 TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGet ter(info);
84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
85 } 87 }
86 88
87 static void attr2AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info ) 89 static void InitializedByEventConstructorReadonlyStringAttributeAttributeGetter( const v8::PropertyCallbackInfo<v8::Value>& info)
88 { 90 {
89 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati ve(info.Holder()); 91 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati ve(info.Holder());
90 v8SetReturnValueString(info, imp->attr2(), info.GetIsolate()); 92 v8SetReturnValueString(info, imp->initializedByEventConstructorReadonlyStrin gAttribute(), info.GetIsolate());
91 } 93 }
92 94
93 static void attr2AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper tyCallbackInfo<v8::Value>& info) 95 static void InitializedByEventConstructorReadonlyStringAttributeAttributeGetterC allback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
94 { 96 {
95 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 97 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
96 TestInterfaceEventConstructorV8Internal::attr2AttributeGetter(info); 98 TestInterfaceEventConstructorV8Internal::InitializedByEventConstructorReadon lyStringAttributeAttributeGetter(info);
97 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
98 } 100 }
99 101
102 static void InitializedByEventConstructorReadonlyAnyAttributeAttributeGetter(con st v8::PropertyCallbackInfo<v8::Value>& info)
103 {
104 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati ve(info.Holder());
105 v8SetReturnValue(info, imp->initializedByEventConstructorReadonlyAnyAttribut e().v8Value());
106 }
107
108 static void InitializedByEventConstructorReadonlyAnyAttributeAttributeGetterCall back(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
109 {
110 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
111 TestInterfaceEventConstructorV8Internal::InitializedByEventConstructorReadon lyAnyAttributeAttributeGetter(info);
112 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
113 }
114
100 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 115 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
101 { 116 {
102 if (info.Length() < 1) { 117 if (info.Length() < 1) {
103 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceEventC onstructor", "An event name must be provided."), info.GetIsolate()); 118 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceEventC onstructor", "An event name must be provided."), info.GetIsolate());
104 return; 119 return;
105 } 120 }
106 121
107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, info[0]); 122 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, info[0]);
123 v8::Local<v8::Value> InitializedByEventConstructorReadonlyAnyAttribute;
108 TestInterfaceEventConstructorInit eventInit; 124 TestInterfaceEventConstructorInit eventInit;
109 if (info.Length() >= 2) { 125 if (info.Length() >= 2) {
110 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate ())); 126 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate ()));
111 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 127 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
112 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti onState)) { 128 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti onState)) {
113 exceptionState.throwIfNeeded(); 129 exceptionState.throwIfNeeded();
114 return; 130 return;
115 } 131 }
132 options.get("InitializedByEventConstructorReadonlyAnyAttribute", Initial izedByEventConstructorReadonlyAnyAttribute);
133 if (!InitializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
134 info.Holder()->SetHiddenValue(V8HiddenPropertyName::InitializedByEve ntConstructorReadonlyAnyAttribute(info.GetIsolate()), InitializedByEventConstruc torReadonlyAnyAttribute);
116 } 135 }
117 RefPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor: :create(type, eventInit); 136 RefPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor: :create(type, eventInit);
137 if (isolatedWorldForIsolate(info.GetIsolate())) {
138 if (!InitializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
139 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut e(SerializedScriptValue::createAndSwallowExceptions(InitializedByEventConstructo rReadonlyAnyAttribute, info.GetIsolate()));
140 }
141
118 v8::Handle<v8::Object> wrapper = info.Holder(); 142 v8::Handle<v8::Object> wrapper = info.Holder();
119 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(ev ent.release(), &V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info. GetIsolate(), WrapperConfiguration::Dependent); 143 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(ev ent.release(), &V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info. GetIsolate(), WrapperConfiguration::Dependent);
120 v8SetReturnValue(info, wrapper); 144 v8SetReturnValue(info, wrapper);
121 } 145 }
122 146
123 } // namespace TestInterfaceEventConstructorV8Internal 147 } // namespace TestInterfaceEventConstructorV8Internal
124 148
125 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventCons tructorAttributes[] = { 149 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventCons tructorAttributes[] = {
126 {"attr1", TestInterfaceEventConstructorV8Internal::attr1AttributeGetterCallb ack, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Pr opertyAttribute>(v8::None), 0 /* on instance */}, 150 {"readonlyStringAttribute", TestInterfaceEventConstructorV8Internal::readonl yStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContr ol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
127 {"attr2", TestInterfaceEventConstructorV8Internal::attr2AttributeGetterCallb ack, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Pr opertyAttribute>(v8::None), 0 /* on instance */}, 151 {"InitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventC onstructorV8Internal::InitializedByEventConstructorReadonlyStringAttributeAttrib uteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stat ic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
152 {"InitializedByEventConstructorReadonlyAnyAttribute", TestInterfaceEventCons tructorV8Internal::InitializedByEventConstructorReadonlyAnyAttributeAttributeGet terCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cas t<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
128 }; 153 };
129 154
130 bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const Stri ng& forEventName) 155 bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const Stri ng& forEventName)
131 { 156 {
132 Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? Str ing("TestInterfaceEventConstructor") : forEventName, "", exceptionState); 157 Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? Str ing("TestInterfaceEventConstructor") : forEventName, "", exceptionState);
133 if (!initializeEvent(eventInit, options, exceptionState, forEventName.isEmpt y() ? String("TestInterfaceEventConstructor") : forEventName)) 158 if (!initializeEvent(eventInit, options, exceptionState, forEventName.isEmpt y() ? String("TestInterfaceEventConstructor") : forEventName))
134 return false; 159 return false;
135 160
136 if (!options.convert(conversionContext, "attr2", eventInit.attr2)) 161 if (!options.convert(conversionContext, "InitializedByEventConstructorReadon lyStringAttribute", eventInit.InitializedByEventConstructorReadonlyStringAttribu te))
137 return false; 162 return false;
138 return true; 163 return true;
139 } 164 }
140 165
141 void V8TestInterfaceEventConstructor::constructorCallback(const v8::FunctionCall backInfo<v8::Value>& info) 166 void V8TestInterfaceEventConstructor::constructorCallback(const v8::FunctionCall backInfo<v8::Value>& info)
142 { 167 {
143 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); 168 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
144 if (!info.IsConstructCall()) { 169 if (!info.IsConstructCall()) {
145 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceEventC onstructor", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate()); 170 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceEventC onstructor", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate());
146 return; 171 return;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 fromInternalPointer(object)->deref(); 254 fromInternalPointer(object)->deref();
230 } 255 }
231 256
232 template<> 257 template<>
233 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 258 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
234 { 259 {
235 return toV8(impl, creationContext, isolate); 260 return toV8(impl, creationContext, isolate);
236 } 261 }
237 262
238 } // namespace WebCore 263 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/idls/TestInterfaceEventConstructor.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698