| 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 5204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5215 imp->doNotCheckSignatureVoidMethod(); | 5215 imp->doNotCheckSignatureVoidMethod(); |
| 5216 } | 5216 } |
| 5217 | 5217 |
| 5218 static void doNotCheckSignatureVoidMethodMethodCallback(const v8::FunctionCallba
ckInfo<v8::Value>& info) | 5218 static void doNotCheckSignatureVoidMethodMethodCallback(const v8::FunctionCallba
ckInfo<v8::Value>& info) |
| 5219 { | 5219 { |
| 5220 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 5220 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 5221 TestObjectPythonV8Internal::doNotCheckSignatureVoidMethodMethod(info); | 5221 TestObjectPythonV8Internal::doNotCheckSignatureVoidMethodMethod(info); |
| 5222 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 5222 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 5223 } | 5223 } |
| 5224 | 5224 |
| 5225 static void perContextEnabledVoidMethodMethod(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 5226 { |
| 5227 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
| 5228 imp->perContextEnabledVoidMethod(); |
| 5229 } |
| 5230 |
| 5231 static void perContextEnabledVoidMethodMethodCallback(const v8::FunctionCallback
Info<v8::Value>& info) |
| 5232 { |
| 5233 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 5234 TestObjectPythonV8Internal::perContextEnabledVoidMethodMethod(info); |
| 5235 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 5236 } |
| 5237 |
| 5225 } // namespace TestObjectPythonV8Internal | 5238 } // namespace TestObjectPythonV8Internal |
| 5226 | 5239 |
| 5227 static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib
utes[] = { | 5240 static const V8DOMConfiguration::AttributeConfiguration V8TestObjectPythonAttrib
utes[] = { |
| 5228 {"readonlyStringAttribute", TestObjectPythonV8Internal::readonlyStringAttrib
uteAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 5241 {"readonlyStringAttribute", TestObjectPythonV8Internal::readonlyStringAttrib
uteAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 5229 {"readonlyTestInterfaceEmptyAttribute", TestObjectPythonV8Internal::readonly
TestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::
AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /*
on instance */}, | 5242 {"readonlyTestInterfaceEmptyAttribute", TestObjectPythonV8Internal::readonly
TestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::
AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /*
on instance */}, |
| 5230 {"readonlyLongAttribute", TestObjectPythonV8Internal::readonlyLongAttributeA
ttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 5243 {"readonlyLongAttribute", TestObjectPythonV8Internal::readonlyLongAttributeA
ttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT),
static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 5231 {"dateAttribute", TestObjectPythonV8Internal::dateAttributeAttributeGetterCa
llback, TestObjectPythonV8Internal::dateAttributeAttributeSetterCallback, 0, 0,
0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribut
e>(v8::None), 0 /* on instance */}, | 5244 {"dateAttribute", TestObjectPythonV8Internal::dateAttributeAttributeGetterCa
llback, TestObjectPythonV8Internal::dateAttributeAttributeSetterCallback, 0, 0,
0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribut
e>(v8::None), 0 /* on instance */}, |
| 5232 {"stringAttribute", TestObjectPythonV8Internal::stringAttributeAttributeGett
erCallback, TestObjectPythonV8Internal::stringAttributeAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAt
tribute>(v8::None), 0 /* on instance */}, | 5245 {"stringAttribute", TestObjectPythonV8Internal::stringAttributeAttributeGett
erCallback, TestObjectPythonV8Internal::stringAttributeAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAt
tribute>(v8::None), 0 /* on instance */}, |
| 5233 {"readonlyDOMTimeStampAttribute", TestObjectPythonV8Internal::readonlyDOMTim
eStampAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContro
l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance
*/}, | 5246 {"readonlyDOMTimeStampAttribute", TestObjectPythonV8Internal::readonlyDOMTim
eStampAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContro
l>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance
*/}, |
| 5234 {"booleanAttribute", TestObjectPythonV8Internal::booleanAttributeAttributeGe
tterCallback, TestObjectPythonV8Internal::booleanAttributeAttributeSetterCallbac
k, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Propert
yAttribute>(v8::None), 0 /* on instance */}, | 5247 {"booleanAttribute", TestObjectPythonV8Internal::booleanAttributeAttributeGe
tterCallback, TestObjectPythonV8Internal::booleanAttributeAttributeSetterCallbac
k, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Propert
yAttribute>(v8::None), 0 /* on instance */}, |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5621 void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle<v8::Objec
t> instance, TestObjectPython* impl, v8::Isolate* isolate) | 5634 void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle<v8::Objec
t> instance, TestObjectPython* impl, v8::Isolate* isolate) |
| 5622 { | 5635 { |
| 5623 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto
type()); | 5636 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto
type()); |
| 5624 if (ContextFeatures::featureNameEnabled(impl->document())) { | 5637 if (ContextFeatures::featureNameEnabled(impl->document())) { |
| 5625 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 5638 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
| 5626 {"perContextEnabledLongAttribute", TestObjectPythonV8Internal::perContex
tEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perCon
textEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on ins
tance */}; | 5639 {"perContextEnabledLongAttribute", TestObjectPythonV8Internal::perContex
tEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perCon
textEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on ins
tance */}; |
| 5627 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); | 5640 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura
tion, isolate); |
| 5628 } | 5641 } |
| 5629 } | 5642 } |
| 5630 | 5643 |
| 5644 void V8TestObjectPython::installPerContextEnabledPrototypeProperties(v8::Handle<
v8::Object> proto, v8::Isolate* isolate) |
| 5645 { |
| 5646 UNUSED_PARAM(proto); |
| 5647 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(i
solate, worldType(isolate))); |
| 5648 UNUSED_PARAM(defaultSignature); |
| 5649 |
| 5650 ExecutionContext* context = toExecutionContext(proto->CreationContext()); |
| 5651 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) |
| 5652 proto->Set(v8::String::NewSymbol("perContextEnabledVoidMethod"), v8::Fun
ctionTemplate::New(TestObjectPythonV8Internal::perContextEnabledVoidMethodMethod
Callback, v8Undefined(), defaultSignature, 0)->GetFunction()); |
| 5653 } |
| 5654 |
| 5631 v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPy
thon> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 5655 v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPy
thon> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 5632 { | 5656 { |
| 5633 ASSERT(impl); | 5657 ASSERT(impl); |
| 5634 ASSERT(!DOMDataStore::containsWrapper<V8TestObjectPython>(impl.get(), isolat
e)); | 5658 ASSERT(!DOMDataStore::containsWrapper<V8TestObjectPython>(impl.get(), isolat
e)); |
| 5635 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 5659 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 5636 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 5660 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 5637 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 5661 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 5638 // the same object de-ref functions, though, so use that as the basis of
the check. | 5662 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 5639 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 5663 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 5640 } | 5664 } |
| 5641 | 5665 |
| 5642 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 5666 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 5643 if (UNLIKELY(wrapper.IsEmpty())) | 5667 if (UNLIKELY(wrapper.IsEmpty())) |
| 5644 return wrapper; | 5668 return wrapper; |
| 5645 | 5669 |
| 5646 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 5670 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 5647 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT
ypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 5671 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT
ypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 5648 return wrapper; | 5672 return wrapper; |
| 5649 } | 5673 } |
| 5650 | 5674 |
| 5651 void V8TestObjectPython::derefObject(void* object) | 5675 void V8TestObjectPython::derefObject(void* object) |
| 5652 { | 5676 { |
| 5653 fromInternalPointer(object)->deref(); | 5677 fromInternalPointer(object)->deref(); |
| 5654 } | 5678 } |
| 5655 | 5679 |
| 5656 } // namespace WebCore | 5680 } // namespace WebCore |
| OLD | NEW |