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

Side by Side Diff: Source/bindings/core/v8/V8DOMConfiguration.h

Issue 709023003: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 v8::FunctionCallback getter; 75 v8::FunctionCallback getter;
76 v8::FunctionCallback setter; 76 v8::FunctionCallback setter;
77 v8::FunctionCallback getterForMainWorld; 77 v8::FunctionCallback getterForMainWorld;
78 v8::FunctionCallback setterForMainWorld; 78 v8::FunctionCallback setterForMainWorld;
79 const WrapperTypeInfo* data; 79 const WrapperTypeInfo* data;
80 v8::AccessControl settings; 80 v8::AccessControl settings;
81 v8::PropertyAttribute attribute; 81 v8::PropertyAttribute attribute;
82 ExposeConfiguration exposeConfiguration; 82 ExposeConfiguration exposeConfiguration;
83 }; 83 };
84 84
85 static void installAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8: :ObjectTemplate>, const AttributeConfiguration*, size_t attributeCount, v8::Isol ate*); 85 static void installAttributes(v8::Isolate*, v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const AttributeConfiguration*, size_t attributeC ount);
86 86
87 template<class ObjectOrTemplate> 87 template<class ObjectOrTemplate>
88 static inline void installAttribute(v8::Handle<ObjectOrTemplate> instanceTem plate, v8::Handle<ObjectOrTemplate> prototype, const AttributeConfiguration& att ribute, v8::Isolate* isolate) 88 static inline void installAttribute(v8::Handle<ObjectOrTemplate> instanceTem plate, v8::Handle<ObjectOrTemplate> prototype, const AttributeConfiguration& att ribute, v8::Isolate* isolate)
89 { 89 {
90 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); 90 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
91 if (attribute.exposeConfiguration == OnlyExposedToPrivateScript && !worl d.isPrivateScriptIsolatedWorld()) 91 if (attribute.exposeConfiguration == OnlyExposedToPrivateScript && !worl d.isPrivateScriptIsolatedWorld())
92 return; 92 return;
93 93
94 v8::AccessorGetterCallback getter = attribute.getter; 94 v8::AccessorGetterCallback getter = attribute.getter;
95 v8::AccessorSetterCallback setter = attribute.setter; 95 v8::AccessorSetterCallback setter = attribute.setter;
(...skipping 25 matching lines...) Expand all
121 // object's constants. It sets the constant on both the FunctionTemplate and 121 // object's constants. It sets the constant on both the FunctionTemplate and
122 // the ObjectTemplate. PropertyAttributes is always ReadOnly. 122 // the ObjectTemplate. PropertyAttributes is always ReadOnly.
123 struct ConstantConfiguration { 123 struct ConstantConfiguration {
124 const char* const name; 124 const char* const name;
125 int ivalue; 125 int ivalue;
126 double dvalue; 126 double dvalue;
127 const char* const svalue; 127 const char* const svalue;
128 ConstantType type; 128 ConstantType type;
129 }; 129 };
130 130
131 static void installConstants(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8 ::ObjectTemplate>, const ConstantConfiguration*, size_t constantCount, v8::Isola te*); 131 static void installConstants(v8::Isolate*, v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const ConstantConfiguration*, size_t constantCo unt);
132 static void installConstant(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8: :ObjectTemplate>, const char* name, v8::AccessorGetterCallback, v8::Isolate*); 132 static void installConstant(v8::Isolate*, v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const char* name, v8::AccessorGetterCallback);
133 133
134 // MethodConfiguration translates into calls to Set() for setting up an 134 // MethodConfiguration translates into calls to Set() for setting up an
135 // object's callbacks. It sets the method on both the FunctionTemplate or 135 // object's callbacks. It sets the method on both the FunctionTemplate or
136 // the ObjectTemplate. 136 // the ObjectTemplate.
137 struct MethodConfiguration { 137 struct MethodConfiguration {
138 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); } 138 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); }
139 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t 139 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t
140 { 140 {
141 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback; 141 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback;
142 } 142 }
(...skipping 12 matching lines...) Expand all
155 return callback; 155 return callback;
156 } 156 }
157 157
158 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*); 158 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*);
159 v8::FunctionCallback callback; 159 v8::FunctionCallback callback;
160 // SymbolKeyedMethodConfiguration doesn't support per-world bindings. 160 // SymbolKeyedMethodConfiguration doesn't support per-world bindings.
161 int length; 161 int length;
162 ExposeConfiguration exposeConfiguration; 162 ExposeConfiguration exposeConfiguration;
163 }; 163 };
164 164
165 static void installMethods(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Si gnature>, v8::PropertyAttribute, const MethodConfiguration*, size_t callbackCoun t, v8::Isolate*); 165 static void installMethods(v8::Isolate*, v8::Handle<v8::ObjectTemplate>, v8: :Handle<v8::Signature>, v8::PropertyAttribute, const MethodConfiguration*, size_ t callbackCount);
166 166
167 template <class ObjectOrTemplate, class Configuration> 167 template <class ObjectOrTemplate, class Configuration>
168 static void installMethod(v8::Handle<ObjectOrTemplate> objectOrTemplate, v8: :Handle<v8::Signature> signature, v8::PropertyAttribute attribute, const Configu ration& callback, v8::Isolate* isolate) 168 static void installMethod(v8::Handle<ObjectOrTemplate> objectOrTemplate, v8: :Handle<v8::Signature> signature, v8::PropertyAttribute attribute, const Configu ration& callback, v8::Isolate* isolate)
169 { 169 {
170 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); 170 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
171 if (callback.exposeConfiguration == OnlyExposedToPrivateScript && !world .isPrivateScriptIsolatedWorld()) 171 if (callback.exposeConfiguration == OnlyExposedToPrivateScript && !world .isPrivateScriptIsolatedWorld())
172 return; 172 return;
173 173
174 v8::Local<v8::FunctionTemplate> functionTemplate = functionTemplateForCa llback(isolate, signature, callback.callbackForWorld(world), callback.length); 174 v8::Local<v8::FunctionTemplate> functionTemplate = functionTemplateForCa llback(isolate, signature, callback.callbackForWorld(world), callback.length);
175 setMethod(objectOrTemplate, callback.methodName(isolate), functionTempla te, attribute); 175 setMethod(objectOrTemplate, callback.methodName(isolate), functionTempla te, attribute);
176 } 176 }
177 177
178 static void installAccessors(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8:: Signature>, const AccessorConfiguration*, size_t accessorCount, v8::Isolate*); 178 static void installAccessors(v8::Isolate*, v8::Handle<v8::ObjectTemplate>, v 8::Handle<v8::Signature>, const AccessorConfiguration*, size_t accessorCount);
179 179
180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Handle<v8::Funct ionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTemplate> parent Class, size_t fieldCount, 180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Handle<v8::Funct ionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTemplate> parent Class, size_t fieldCount,
181 const AttributeConfiguration*, size_t attributeCount, 181 const AttributeConfiguration*, size_t attributeCount,
182 const AccessorConfiguration*, size_t accessorCount, 182 const AccessorConfiguration*, size_t accessorCount,
183 const MethodConfiguration*, size_t callbackCount, 183 const MethodConfiguration*, size_t callbackCount,
184 v8::Isolate*); 184 v8::Isolate*);
185 185
186 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp erTypeInfo*, void (*)(v8::Handle<v8::FunctionTemplate>, v8::Isolate*)); 186 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp erTypeInfo*, void (*)(v8::Handle<v8::FunctionTemplate>, v8::Isolate*));
187 187
188 private: 188 private:
189 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att ribute) 189 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att ribute)
190 { 190 {
191 target->Set(name, functionTemplate->GetFunction()); 191 target->Set(name, functionTemplate->GetFunction());
192 } 192 }
193 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8 ::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt ribute attribute) 193 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8 ::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt ribute attribute)
194 { 194 {
195 target->Set(name, functionTemplate, attribute); 195 target->Set(name, functionTemplate, attribute);
196 } 196 }
197 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8:: Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri bute attribute) 197 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8:: Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri bute attribute)
198 { 198 {
199 target->Set(name, functionTemplate, attribute); 199 target->Set(name, functionTemplate, attribute);
200 } 200 }
201 201
202 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Isol ate*, v8::Handle<v8::Signature>, v8::FunctionCallback, int length); 202 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Isol ate*, v8::Handle<v8::Signature>, v8::FunctionCallback, int length);
203 }; 203 };
204 204
205 } // namespace blink 205 } // namespace blink
206 206
207 #endif // V8DOMConfiguration_h 207 #endif // V8DOMConfiguration_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698