| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static void TestInterfaceNamedConstructorConstructorGetter(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 74 static void TestInterfaceNamedConstructorConstructorGetter(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 75 { | 75 { |
| 76 v8::Handle<v8::Value> data = info.Data(); | 76 v8::Handle<v8::Value> data = info.Data(); |
| 77 ASSERT(data->IsExternal()); | 77 ASSERT(data->IsExternal()); |
| 78 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 78 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
| 79 if (!perContextData) | 79 if (!perContextData) |
| 80 return; | 80 return; |
| 81 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 81 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
| 82 } | 82 } |
| 83 | 83 |
| 84 static void testNamedConstructorConstructorAttributeConstructorGetterCallback(v8
::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 85 { |
| 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 87 TestInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorConstr
uctorGetter(property, info); |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 89 } |
| 90 |
| 84 static void TestInterfaceNamedConstructorReplaceableAttributeSetter(v8::Local<v8
::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) | 91 static void TestInterfaceNamedConstructorReplaceableAttributeSetter(v8::Local<v8
::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi
d>& info) |
| 85 { | 92 { |
| 86 info.This()->ForceSet(name, jsValue); | 93 info.This()->ForceSet(name, jsValue); |
| 87 } | 94 } |
| 88 | 95 |
| 89 static void TestInterfaceNamedConstructorReplaceableAttributeSetterCallback(v8::
Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallback
Info<void>& info) | 96 static void TestInterfaceNamedConstructorReplaceableAttributeSetterCallback(v8::
Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallback
Info<void>& info) |
| 90 { | 97 { |
| 91 TestInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorReplac
eableAttributeSetter(name, jsValue, info); | 98 TestInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorReplac
eableAttributeSetter(name, jsValue, info); |
| 92 } | 99 } |
| 93 | 100 |
| 94 } // namespace TestInterfaceNamedConstructorV8Internal | 101 } // namespace TestInterfaceNamedConstructorV8Internal |
| 95 | 102 |
| 96 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNamedCons
tructorAttributes[] = { | 103 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNamedCons
tructorAttributes[] = { |
| 97 {"testNamedConstructorConstructorAttribute", TestInterfaceNamedConstructorV8
Internal::TestInterfaceNamedConstructorConstructorGetter, TestInterfaceNamedCons
tructorV8Internal::TestInterfaceNamedConstructorReplaceableAttributeSetterCallba
ck, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestNamedConstructor::wrapperTypeInfo)
, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute
>(v8::DontEnum), 0 /* on instance */}, | 104 {"testNamedConstructorConstructorAttribute", TestInterfaceNamedConstructorV8
Internal::testNamedConstructorConstructorAttributeConstructorGetterCallback, Tes
tInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorReplaceableAt
tributeSetterCallback, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestNamedConstructo
r::wrapperTypeInfo), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8
::PropertyAttribute>(v8::DontEnum), 0 /* on instance */}, |
| 98 }; | 105 }; |
| 99 | 106 |
| 100 const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInf
o = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTempla
te, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructo
r::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEn
abledMethods, 0, WrapperTypeObjectPrototype, false }; | 107 const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInf
o = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTempla
te, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructo
r::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEn
abledMethods, 0, WrapperTypeObjectPrototype, false }; |
| 101 | 108 |
| 102 static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) | 109 static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 103 { | 110 { |
| 104 if (!info.IsConstructCall()) { | 111 if (!info.IsConstructCall()) { |
| 105 throwTypeError(ExceptionMessages::failedToConstruct("Audio", "Please use
the 'new' operator, this DOM object constructor cannot be called as a function.
"), info.GetIsolate()); | 112 throwTypeError(ExceptionMessages::failedToConstruct("Audio", "Please use
the 'new' operator, this DOM object constructor cannot be called as a function.
"), info.GetIsolate()); |
| 106 return; | 113 return; |
| 107 } | 114 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 fromInternalPointer(object)->deref(); | 242 fromInternalPointer(object)->deref(); |
| 236 } | 243 } |
| 237 | 244 |
| 238 template<> | 245 template<> |
| 239 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 246 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 240 { | 247 { |
| 241 return toV8(impl, creationContext, isolate); | 248 return toV8(impl, creationContext, isolate); |
| 242 } | 249 } |
| 243 | 250 |
| 244 } // namespace WebCore | 251 } // namespace WebCore |
| OLD | NEW |