| 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 22 matching lines...) Expand all Loading... |
| 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 "V8TestInterfaceEmpty.h" | 37 #include "V8TestInterfaceEmpty.h" |
| 38 #include "bindings/v8/Dictionary.h" | 38 #include "bindings/v8/Dictionary.h" |
| 39 #include "bindings/v8/ExceptionState.h" | 39 #include "bindings/v8/ExceptionState.h" |
| 40 #include "bindings/v8/ScriptValue.h" | 40 #include "bindings/v8/ScriptValue.h" |
| 41 #include "bindings/v8/SerializedScriptValue.h" | 41 #include "bindings/v8/SerializedScriptValue.h" |
| 42 #include "bindings/v8/V8DOMConfiguration.h" | 42 #include "bindings/v8/V8DOMConfiguration.h" |
| 43 #include "bindings/v8/V8HiddenPropertyName.h" | |
| 44 #include "bindings/v8/V8ObjectConstructor.h" | 43 #include "bindings/v8/V8ObjectConstructor.h" |
| 45 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" | 44 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" |
| 46 #include "core/dom/ContextFeatures.h" | 45 #include "core/dom/ContextFeatures.h" |
| 47 #include "core/dom/Document.h" | 46 #include "core/dom/Document.h" |
| 48 #include "core/frame/UseCounter.h" | 47 #include "core/frame/UseCounter.h" |
| 49 #include "platform/TraceEvent.h" | 48 #include "platform/TraceEvent.h" |
| 50 | 49 |
| 51 namespace WebCore { | 50 namespace WebCore { |
| 52 | 51 |
| 53 static void initializeScriptWrappableForInterface(TestInterfaceEventConstructor*
object) | 52 static void initializeScriptWrappableForInterface(TestInterfaceEventConstructor*
object) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 141 } |
| 143 | 142 |
| 144 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
ter(const v8::PropertyCallbackInfo<v8::Value>& info) | 143 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
ter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 145 { | 144 { |
| 146 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); | 145 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); |
| 147 RefPtr<Uint8Array> result = imp->initializedByEventConstructorReadonlyUint8A
rrayAttribute(); | 146 RefPtr<Uint8Array> result = imp->initializedByEventConstructorReadonlyUint8A
rrayAttribute(); |
| 148 if (result && DOMDataStore::setReturnValueFromWrapper<V8Uint8Array>(info.Get
ReturnValue(), result.get())) | 147 if (result && DOMDataStore::setReturnValueFromWrapper<V8Uint8Array>(info.Get
ReturnValue(), result.get())) |
| 149 return; | 148 return; |
| 150 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); | 149 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); |
| 151 if (!wrapper.IsEmpty()) { | 150 if (!wrapper.IsEmpty()) { |
| 152 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "initialize
dByEventConstructorReadonlyUint8ArrayAttribute", wrapper); | 151 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEventCons
tructorReadonlyUint8ArrayAttribute", wrapper); |
| 153 v8SetReturnValue(info, wrapper); | 152 v8SetReturnValue(info, wrapper); |
| 154 } | 153 } |
| 155 } | 154 } |
| 156 | 155 |
| 157 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
terCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) | 156 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
terCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) |
| 158 { | 157 { |
| 159 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 160 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyUint8ArrayAttributeAttributeGetter(info); | 159 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyUint8ArrayAttributeAttributeGetter(info); |
| 161 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 162 } | 161 } |
| 163 | 162 |
| 164 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | 163 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 165 { | 164 { |
| 166 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); | 165 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); |
| 167 RefPtr<TestInterfaceEmpty> result = imp->initializedByEventConstructorReadon
lyTestInterfaceEmptyAttribute(); | 166 RefPtr<TestInterfaceEmpty> result = imp->initializedByEventConstructorReadon
lyTestInterfaceEmptyAttribute(); |
| 168 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(
info.GetReturnValue(), result.get())) | 167 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(
info.GetReturnValue(), result.get())) |
| 169 return; | 168 return; |
| 170 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); | 169 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); |
| 171 if (!wrapper.IsEmpty()) { | 170 if (!wrapper.IsEmpty()) { |
| 172 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "initialize
dByEventConstructorReadonlyTestInterfaceEmptyAttribute", wrapper); | 171 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEventCons
tructorReadonlyTestInterfaceEmptyAttribute", wrapper); |
| 173 v8SetReturnValue(info, wrapper); | 172 v8SetReturnValue(info, wrapper); |
| 174 } | 173 } |
| 175 } | 174 } |
| 176 | 175 |
| 177 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Va
lue>& info) | 176 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Va
lue>& info) |
| 178 { | 177 { |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 180 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyAttributeAttributeGetter(info); | 179 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyAttributeAttributeGetter(info); |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 180 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 182 } | 181 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 201 RefPtr<TestInterfaceEmpty> jsValue = imp->initializedByEventConstructorReado
nlyNullableTestInterfaceEmptyAttribute(isNull); | 200 RefPtr<TestInterfaceEmpty> jsValue = imp->initializedByEventConstructorReado
nlyNullableTestInterfaceEmptyAttribute(isNull); |
| 202 if (isNull) { | 201 if (isNull) { |
| 203 v8SetReturnValueNull(info); | 202 v8SetReturnValueNull(info); |
| 204 return; | 203 return; |
| 205 } | 204 } |
| 206 RefPtr<TestInterfaceEmpty> result = jsValue; | 205 RefPtr<TestInterfaceEmpty> result = jsValue; |
| 207 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(
info.GetReturnValue(), result.get())) | 206 if (result && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(
info.GetReturnValue(), result.get())) |
| 208 return; | 207 return; |
| 209 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); | 208 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs
olate()); |
| 210 if (!wrapper.IsEmpty()) { | 209 if (!wrapper.IsEmpty()) { |
| 211 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "initialize
dByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", wrapper); | 210 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEventCons
tructorReadonlyNullableTestInterfaceEmptyAttribute", wrapper); |
| 212 v8SetReturnValue(info, wrapper); | 211 v8SetReturnValue(info, wrapper); |
| 213 } | 212 } |
| 214 } | 213 } |
| 215 | 214 |
| 216 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInf
o<v8::Value>& info) | 215 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInf
o<v8::Value>& info) |
| 217 { | 216 { |
| 218 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 219 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyNullableTestInterfaceEmptyAttributeAttributeGetter(info); | 218 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyNullableTestInterfaceEmptyAttributeAttributeGetter(info); |
| 220 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 221 } | 220 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute; | 273 v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute; |
| 275 TestInterfaceEventConstructorInit eventInit; | 274 TestInterfaceEventConstructorInit eventInit; |
| 276 if (info.Length() >= 2) { | 275 if (info.Length() >= 2) { |
| 277 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate
())); | 276 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate
())); |
| 278 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState)) { | 277 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState)) { |
| 279 exceptionState.throwIfNeeded(); | 278 exceptionState.throwIfNeeded(); |
| 280 return; | 279 return; |
| 281 } | 280 } |
| 282 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); | 281 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); |
| 283 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | 282 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) |
| 284 info.Holder()->SetHiddenValue(V8HiddenPropertyName::initializedByEve
ntConstructorReadonlyAnyAttribute(info.GetIsolate()), initializedByEventConstruc
torReadonlyAnyAttribute); | 283 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEvent
ConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttrib
ute); |
| 285 } | 284 } |
| 286 RefPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor:
:create(type, eventInit, exceptionState); | 285 RefPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor:
:create(type, eventInit, exceptionState); |
| 287 if (exceptionState.throwIfNeeded()) | 286 if (exceptionState.throwIfNeeded()) |
| 288 return; | 287 return; |
| 289 if (isolatedWorldForIsolate(info.GetIsolate())) { | 288 if (isolatedWorldForIsolate(info.GetIsolate())) { |
| 290 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | 289 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) |
| 291 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructo
rReadonlyAnyAttribute, info.GetIsolate())); | 290 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructo
rReadonlyAnyAttribute, info.GetIsolate())); |
| 292 } | 291 } |
| 293 | 292 |
| 294 v8::Handle<v8::Object> wrapper = info.Holder(); | 293 v8::Handle<v8::Object> wrapper = info.Holder(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 fromInternalPointer(object)->deref(); | 430 fromInternalPointer(object)->deref(); |
| 432 } | 431 } |
| 433 | 432 |
| 434 template<> | 433 template<> |
| 435 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 434 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 436 { | 435 { |
| 437 return toV8(impl, creationContext, isolate); | 436 return toV8(impl, creationContext, isolate); |
| 438 } | 437 } |
| 439 | 438 |
| 440 } // namespace WebCore | 439 } // namespace WebCore |
| OLD | NEW |