Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: Source/bindings/tests/results/V8TestObjectPython.cpp

Issue 26547005: IDL compiler: [PerContextEnabled] for getters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/V8TestObjectPython.cpp
diff --git a/Source/bindings/tests/results/V8TestObjectPython.cpp b/Source/bindings/tests/results/V8TestObjectPython.cpp
index 4691d1d63053d04daab6f9dcd4c1dbd426481bff..c58dd76a62fcfee2e4c8ed17ef7ed39a2dd880bd 100644
--- a/Source/bindings/tests/results/V8TestObjectPython.cpp
+++ b/Source/bindings/tests/results/V8TestObjectPython.cpp
@@ -81,7 +81,7 @@ void webCoreInitializeScriptWrappableForInterface(WebCore::TestObjectPython* obj
}
namespace WebCore {
-WrapperTypeInfo V8TestObjectPython::info = { V8TestObjectPython::GetTemplate, V8TestObjectPython::derefObject, 0, 0, 0, V8TestObjectPython::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
+WrapperTypeInfo V8TestObjectPython::info = { V8TestObjectPython::GetTemplate, V8TestObjectPython::derefObject, 0, 0, 0, V8TestObjectPython::installPerContextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype };
namespace TestObjectPythonV8Internal {
@@ -1013,6 +1013,19 @@ static void notEnumerableReadonlyLongAttributeAttributeGetterCallback(v8::Local<
TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
}
+static void perContextEnabledReadonlyLongAttributeAttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
+ v8SetReturnValueInt(info, imp->perContextEnabledReadonlyLongAttribute());
+}
+
+static void perContextEnabledReadonlyLongAttributeAttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TestObjectPythonV8Internal::perContextEnabledReadonlyLongAttributeAttributeGetter(name, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
static void raisesExceptionReadonlyLongAttributeAttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
@@ -1516,6 +1529,16 @@ bool V8TestObjectPython::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::
|| V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorld);
}
+void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle<v8::Object> instance, TestObjectPython* impl, v8::Isolate* isolate)
+{
+ v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype());
+ if (ContextFeatures::featureNameEnabled(impl->document())) {
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
+ {"perContextEnabledReadonlyLongAttribute", TestObjectPythonV8Internal::perContextEnabledReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
+ V8DOMConfiguration::installAttribute(instance, proto, attributeConfiguration, isolate);
+ }
+}
+
v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPython> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
@@ -1531,7 +1554,7 @@ v8::Handle<v8::Object> V8TestObjectPython::createWrapper(PassRefPtr<TestObjectPy
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
- installPerContextProperties(wrapper, impl.get(), isolate);
+ installPerContextEnabledProperties(wrapper, impl.get(), isolate);
V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
« no previous file with comments | « Source/bindings/tests/results/V8TestObjectPython.h ('k') | Source/bindings/tests/results/V8TestOverloadedConstructors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698