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

Unified Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 968593002: bindings: Supports constructor attributes on prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/core/v8/V8Binding.cpp
diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp
index b010879387e759cdfb0c3588e03603a0eaeb03f1..956026bf0e9d01f35f727a489aac371f031ce90d 100644
--- a/Source/bindings/core/v8/V8Binding.cpp
+++ b/Source/bindings/core/v8/V8Binding.cpp
@@ -74,6 +74,21 @@
namespace blink {
+namespace {
+
+template<class Callback>
+void v8ConstructorAttributeGetter(const Callback& info)
+{
+ v8::Local<v8::Value> data = info.Data();
+ ASSERT(data->IsExternal());
+ V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
+ if (!perContextData)
+ return;
+ v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data)));
+}
+
+} // namespace
+
void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsigned provided)
{
exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provided));
@@ -1045,4 +1060,14 @@ PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resourceName(), info.lineNumber());
}
+void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ v8ConstructorAttributeGetter(info);
+}
+
+void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8ConstructorAttributeGetter(info);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698