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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 if (contextData && contextData->activityLogger()) { | 1527 if (contextData && contextData->activityLogger()) { |
1528 v8::Handle<v8::Value> loggerArg[] = { jsValue }; | 1528 v8::Handle<v8::Value> loggerArg[] = { jsValue }; |
1529 contextData->activityLogger()->log("TestObjectPython.activityLoggingSett
erForAllWorldsLongAttribute", 1, &loggerArg[0], "Setter"); | 1529 contextData->activityLogger()->log("TestObjectPython.activityLoggingSett
erForAllWorldsLongAttribute", 1, &loggerArg[0], "Setter"); |
1530 } | 1530 } |
1531 TestObjectPythonV8Internal::activityLoggingSetterForAllWorldsLongAttributeAt
tributeSetter(jsValue, info); | 1531 TestObjectPythonV8Internal::activityLoggingSetterForAllWorldsLongAttributeAt
tributeSetter(jsValue, info); |
1532 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 1532 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
1533 } | 1533 } |
1534 | 1534 |
1535 static void cachedAttributeAnyAttributeAttributeGetter(const v8::PropertyCallbac
kInfo<v8::Value>& info) | 1535 static void cachedAttributeAnyAttributeAttributeGetter(const v8::PropertyCallbac
kInfo<v8::Value>& info) |
1536 { | 1536 { |
1537 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "cachedAttributeAnyAttribute", v8::String::kInternalizedString); | 1537 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac
hedAttributeAnyAttribute"); |
1538 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); | 1538 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
1539 if (!imp->isValueDirty()) { | 1539 if (!imp->isValueDirty()) { |
1540 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | 1540 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
1541 if (!jsValue.IsEmpty()) { | 1541 if (!jsValue.IsEmpty()) { |
1542 v8SetReturnValue(info, jsValue); | 1542 v8SetReturnValue(info, jsValue); |
1543 return; | 1543 return; |
1544 } | 1544 } |
1545 } | 1545 } |
1546 ScriptValue jsValue = imp->cachedAttributeAnyAttribute(); | 1546 ScriptValue jsValue = imp->cachedAttributeAnyAttribute(); |
1547 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); | 1547 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); |
1548 v8SetReturnValue(info, jsValue.v8Value()); | 1548 v8SetReturnValue(info, jsValue.v8Value()); |
1549 } | 1549 } |
1550 | 1550 |
1551 static void cachedAttributeAnyAttributeAttributeGetterCallback(v8::Local<v8::Str
ing>, const v8::PropertyCallbackInfo<v8::Value>& info) | 1551 static void cachedAttributeAnyAttributeAttributeGetterCallback(v8::Local<v8::Str
ing>, const v8::PropertyCallbackInfo<v8::Value>& info) |
1552 { | 1552 { |
1553 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 1553 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
1554 TestObjectPythonV8Internal::cachedAttributeAnyAttributeAttributeGetter(info)
; | 1554 TestObjectPythonV8Internal::cachedAttributeAnyAttributeAttributeGetter(info)
; |
1555 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 1555 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
1556 } | 1556 } |
1557 | 1557 |
1558 static void cachedAttributeAnyAttributeAttributeSetter(v8::Local<v8::Value> jsVa
lue, const v8::PropertyCallbackInfo<void>& info) | 1558 static void cachedAttributeAnyAttributeAttributeSetter(v8::Local<v8::Value> jsVa
lue, const v8::PropertyCallbackInfo<void>& info) |
1559 { | 1559 { |
1560 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); | 1560 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
1561 V8TRYCATCH_VOID(ScriptValue, cppValue, ScriptValue(jsValue, info.GetIsolate(
))); | 1561 V8TRYCATCH_VOID(ScriptValue, cppValue, ScriptValue(jsValue, info.GetIsolate(
))); |
1562 imp->setCachedAttributeAnyAttribute(cppValue); | 1562 imp->setCachedAttributeAnyAttribute(cppValue); |
1563 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"cachedAttributeAnyAttribute", v8::String::kInternalizedString)); // Invalidate
the cached value. | 1563 info.Holder()->DeleteHiddenValue(v8AtomicString(info.GetIsolate(), "cachedAt
tributeAnyAttribute")); // Invalidate the cached value. |
1564 } | 1564 } |
1565 | 1565 |
1566 static void cachedAttributeAnyAttributeAttributeSetterCallback(v8::Local<v8::Str
ing>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 1566 static void cachedAttributeAnyAttributeAttributeSetterCallback(v8::Local<v8::Str
ing>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
1567 { | 1567 { |
1568 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 1568 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
1569 TestObjectPythonV8Internal::cachedAttributeAnyAttributeAttributeSetter(jsVal
ue, info); | 1569 TestObjectPythonV8Internal::cachedAttributeAnyAttributeAttributeSetter(jsVal
ue, info); |
1570 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 1570 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
1571 } | 1571 } |
1572 | 1572 |
1573 static void callWithExecutionContextAnyAttributeAttributeGetter(const v8::Proper
tyCallbackInfo<v8::Value>& info) | 1573 static void callWithExecutionContextAnyAttributeAttributeGetter(const v8::Proper
tyCallbackInfo<v8::Value>& info) |
(...skipping 5015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6589 if (RuntimeEnabledFeatures::featureNameEnabled()) | 6589 if (RuntimeEnabledFeatures::featureNameEnabled()) |
6590 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "runtimeEnabledV
oidMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate,
TestObjectPythonV8Internal::runtimeEnabledVoidMethodMethodCallback, v8Undefined
(), defaultSignature, 0)); | 6590 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "runtimeEnabledV
oidMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate,
TestObjectPythonV8Internal::runtimeEnabledVoidMethodMethodCallback, v8Undefined
(), defaultSignature, 0)); |
6591 if (currentWorldType == MainWorld) { | 6591 if (currentWorldType == MainWorld) { |
6592 if (RuntimeEnabledFeatures::featureNameEnabled()) | 6592 if (RuntimeEnabledFeatures::featureNameEnabled()) |
6593 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin
dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe
mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV
oidMethodMethodCallbackForMainWorld, v8Undefined(), defaultSignature, 0)); | 6593 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin
dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe
mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV
oidMethodMethodCallbackForMainWorld, v8Undefined(), defaultSignature, 0)); |
6594 } else { | 6594 } else { |
6595 if (RuntimeEnabledFeatures::featureNameEnabled()) | 6595 if (RuntimeEnabledFeatures::featureNameEnabled()) |
6596 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin
dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe
mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV
oidMethodMethodCallback, v8Undefined(), defaultSignature, 0)); | 6596 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin
dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe
mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV
oidMethodMethodCallback, v8Undefined(), defaultSignature, 0)); |
6597 } | 6597 } |
6598 instanceTemplate->Set(v8::String::NewFromUtf8(isolate, "unforgeableVoidMetho
d", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObj
ectPythonV8Internal::unforgeableVoidMethodMethodCallback, v8Undefined(), default
Signature, 0)); | 6598 instanceTemplate->Set(v8::String::NewFromUtf8(isolate, "unforgeableVoidMetho
d", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObj
ectPythonV8Internal::unforgeableVoidMethodMethodCallback, v8Undefined(), default
Signature, 0)); |
6599 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st
aticStringAttribute", v8::String::kInternalizedString), TestObjectPythonV8Intern
al::staticStringAttributeAttributeGetterCallback, TestObjectPythonV8Internal::st
aticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), stati
c_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), st
atic_cast<v8::AccessControl>(v8::DEFAULT)); | 6599 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStrin
gAttribute"), TestObjectPythonV8Internal::staticStringAttributeAttributeGetterCa
llback, TestObjectPythonV8Internal::staticStringAttributeAttributeSetterCallback
, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v
8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT))
; |
6600 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st
aticLongAttribute", v8::String::kInternalizedString), TestObjectPythonV8Internal
::staticLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::static
LongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast
<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_c
ast<v8::AccessControl>(v8::DEFAULT)); | 6600 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticLongA
ttribute"), TestObjectPythonV8Internal::staticLongAttributeAttributeGetterCallba
ck, TestObjectPythonV8Internal::staticLongAttributeAttributeSetterCallback, v8::
External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Han
dle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
6601 | 6601 |
6602 // Custom toString template | 6602 // Custom toString template |
6603 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 6603 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
6604 return functionTemplate; | 6604 return functionTemplate; |
6605 } | 6605 } |
6606 | 6606 |
6607 v8::Handle<v8::FunctionTemplate> V8TestObjectPython::domTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 6607 v8::Handle<v8::FunctionTemplate> V8TestObjectPython::domTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
6608 { | 6608 { |
6609 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 6609 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
6610 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 6610 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6675 fromInternalPointer(object)->deref(); | 6675 fromInternalPointer(object)->deref(); |
6676 } | 6676 } |
6677 | 6677 |
6678 template<> | 6678 template<> |
6679 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) | 6679 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) |
6680 { | 6680 { |
6681 return toV8(impl, creationContext, isolate); | 6681 return toV8(impl, creationContext, isolate); |
6682 } | 6682 } |
6683 | 6683 |
6684 } // namespace WebCore | 6684 } // namespace WebCore |
OLD | NEW |