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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "wtf/text/AtomicString.h" 67 #include "wtf/text/AtomicString.h"
68 #include "wtf/text/CString.h" 68 #include "wtf/text/CString.h"
69 #include "wtf/text/StringBuffer.h" 69 #include "wtf/text/StringBuffer.h"
70 #include "wtf/text/StringHash.h" 70 #include "wtf/text/StringHash.h"
71 #include "wtf/text/WTFString.h" 71 #include "wtf/text/WTFString.h"
72 #include "wtf/unicode/CharacterNames.h" 72 #include "wtf/unicode/CharacterNames.h"
73 #include "wtf/unicode/Unicode.h" 73 #include "wtf/unicode/Unicode.h"
74 74
75 namespace blink { 75 namespace blink {
76 76
77 namespace {
78
79 template<class Callback>
80 void v8ConstructorAttributeGetter(const Callback& info)
81 {
82 v8::Local<v8::Value> data = info.Data();
83 ASSERT(data->IsExternal());
84 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
85 if (!perContextData)
86 return;
87 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
88 }
89
90 } // namespace
91
77 void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsign ed provided) 92 void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsign ed provided)
78 { 93 {
79 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d)); 94 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d));
80 } 95 }
81 96
82 v8::Local<v8::Value> createMinimumArityTypeErrorForMethod(v8::Isolate* isolate, const char* method, const char* type, unsigned expected, unsigned provided) 97 v8::Local<v8::Value> createMinimumArityTypeErrorForMethod(v8::Isolate* isolate, const char* method, const char* type, unsigned expected, unsigned provided)
83 { 98 {
84 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oExecute(method, type, ExceptionMessages::notEnoughArguments(expected, provided) )); 99 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oExecute(method, type, ExceptionMessages::notEnoughArguments(expected, provided) ));
85 } 100 }
86 101
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 ensureInitialized(); 1053 ensureInitialized();
1039 return m_resourceName; 1054 return m_resourceName;
1040 } 1055 }
1041 1056
1042 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function) 1057 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function)
1043 { 1058 {
1044 DevToolsFunctionInfo info(function); 1059 DevToolsFunctionInfo info(function);
1045 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber()); 1060 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber());
1046 } 1061 }
1047 1062
1063 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>& info)
1064 {
1065 v8ConstructorAttributeGetter(info);
1066 }
1067
1068 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>& info)
1069 {
1070 v8ConstructorAttributeGetter(info);
1071 }
1072
1048 } // namespace blink 1073 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698