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

Side by Side Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 1008353002: bindings: Reduces the binary size by reducing # of callback functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. 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
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
92 void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsign ed provided) 77 void setArityTypeError(ExceptionState& exceptionState, const char* valid, unsign ed provided)
93 { 78 {
94 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d)); 79 exceptionState.throwTypeError(ExceptionMessages::invalidArity(valid, provide d));
95 } 80 }
96 81
97 v8::Local<v8::Value> createMinimumArityTypeErrorForMethod(v8::Isolate* isolate, const char* method, const char* type, unsigned expected, unsigned provided) 82 v8::Local<v8::Value> createMinimumArityTypeErrorForMethod(v8::Isolate* isolate, const char* method, const char* type, unsigned expected, unsigned provided)
98 { 83 {
99 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oExecute(method, type, ExceptionMessages::notEnoughArguments(expected, provided) )); 84 return V8ThrowException::createTypeError(isolate, ExceptionMessages::failedT oExecute(method, type, ExceptionMessages::notEnoughArguments(expected, provided) ));
100 } 85 }
101 86
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 ensureInitialized(); 999 ensureInitialized();
1015 return m_resourceName; 1000 return m_resourceName;
1016 } 1001 }
1017 1002
1018 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function) 1003 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function)
1019 { 1004 {
1020 DevToolsFunctionInfo info(function); 1005 DevToolsFunctionInfo info(function);
1021 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber()); 1006 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber());
1022 } 1007 }
1023 1008
1024 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::Name> propertyName, co nst v8::PropertyCallbackInfo<v8::Value>& info) 1009 void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::Pr opertyCallbackInfo<v8::Value>& info)
1025 { 1010 {
1026 v8ConstructorAttributeGetter(info); 1011 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
1027 } 1012 v8::Local<v8::Value> data = info.Data();
1028 1013 ASSERT(data->IsExternal());
1029 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>& info) 1014 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
1030 { 1015 if (!perContextData)
1031 v8ConstructorAttributeGetter(info); 1016 return;
1017 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
1018 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1032 } 1019 }
1033 1020
1034 } // namespace blink 1021 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/WrapperTypeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698