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