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

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

Issue 1002163002: bindings: Use AccessorName{Getter,Setter}Callback in AttributeConfiguration (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
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.h ('k') | Source/bindings/templates/attributes.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 25 matching lines...) Expand all
36 36
37 namespace { 37 namespace {
38 38
39 template<class ObjectOrTemplate> 39 template<class ObjectOrTemplate>
40 void installAttributeInternal(v8::Isolate* isolate, v8::Handle<ObjectOrTemplate> instanceOrTemplate, v8::Handle<ObjectOrTemplate> prototypeOrTemplate, const V8D OMConfiguration::AttributeConfiguration& attribute, const DOMWrapperWorld& world ) 40 void installAttributeInternal(v8::Isolate* isolate, v8::Handle<ObjectOrTemplate> instanceOrTemplate, v8::Handle<ObjectOrTemplate> prototypeOrTemplate, const V8D OMConfiguration::AttributeConfiguration& attribute, const DOMWrapperWorld& world )
41 { 41 {
42 if (attribute.exposeConfiguration == V8DOMConfiguration::OnlyExposedToPrivat eScript 42 if (attribute.exposeConfiguration == V8DOMConfiguration::OnlyExposedToPrivat eScript
43 && !world.isPrivateScriptIsolatedWorld()) 43 && !world.isPrivateScriptIsolatedWorld())
44 return; 44 return;
45 45
46 v8::AccessorGetterCallback getter = attribute.getter; 46 v8::AccessorNameGetterCallback getter = attribute.getter;
47 v8::AccessorSetterCallback setter = attribute.setter; 47 v8::AccessorNameSetterCallback setter = attribute.setter;
48 if (world.isMainWorld()) { 48 if (world.isMainWorld()) {
49 if (attribute.getterForMainWorld) 49 if (attribute.getterForMainWorld)
50 getter = attribute.getterForMainWorld; 50 getter = attribute.getterForMainWorld;
51 if (attribute.setterForMainWorld) 51 if (attribute.setterForMainWorld)
52 setter = attribute.setterForMainWorld; 52 setter = attribute.setterForMainWorld;
53 } 53 }
54 v8::Handle<ObjectOrTemplate> target = 54 v8::Handle<ObjectOrTemplate> target =
55 attribute.instanceOrPrototypeConfiguration == V8DOMConfiguration::OnProt otype ? 55 attribute.instanceOrPrototypeConfiguration == V8DOMConfiguration::OnProt otype ?
56 prototypeOrTemplate : 56 prototypeOrTemplate :
57 instanceOrTemplate; 57 instanceOrTemplate;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 { 198 {
199 for (size_t i = 0; i < constantCount; ++i) 199 for (size_t i = 0; i < constantCount; ++i)
200 installConstantInternal(isolate, functionDescriptor, prototypeTemplate, constants[i]); 200 installConstantInternal(isolate, functionDescriptor, prototypeTemplate, constants[i]);
201 } 201 }
202 202
203 void V8DOMConfiguration::installConstant(v8::Isolate* isolate, v8::Handle<v8::Fu nctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemp late, const ConstantConfiguration& constant) 203 void V8DOMConfiguration::installConstant(v8::Isolate* isolate, v8::Handle<v8::Fu nctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemp late, const ConstantConfiguration& constant)
204 { 204 {
205 installConstantInternal(isolate, functionDescriptor, prototypeTemplate, cons tant); 205 installConstantInternal(isolate, functionDescriptor, prototypeTemplate, cons tant);
206 } 206 }
207 207
208 void V8DOMConfiguration::installConstantWithGetter(v8::Isolate* isolate, v8::Han dle<v8::FunctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> pro totypeTemplate, const char* name, v8::AccessorGetterCallback getter) 208 void V8DOMConfiguration::installConstantWithGetter(v8::Isolate* isolate, v8::Han dle<v8::FunctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> pro totypeTemplate, const char* name, v8::AccessorNameGetterCallback getter)
209 { 209 {
210 v8::Handle<v8::String> constantName = v8AtomicString(isolate, name); 210 v8::Handle<v8::String> constantName = v8AtomicString(isolate, name);
211 v8::PropertyAttribute attributes = 211 v8::PropertyAttribute attributes =
212 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); 212 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);
213 functionDescriptor->SetNativeDataProperty(constantName, getter, 0, v8::Handl e<v8::Value>(), attributes); 213 functionDescriptor->SetNativeDataProperty(constantName, getter, 0, v8::Handl e<v8::Value>(), attributes);
214 prototypeTemplate->SetNativeDataProperty(constantName, getter, 0, v8::Handle <v8::Value>(), attributes); 214 prototypeTemplate->SetNativeDataProperty(constantName, getter, 0, v8::Handle <v8::Value>(), attributes);
215 } 215 }
216 216
217 void V8DOMConfiguration::installMethods(v8::Isolate* isolate, v8::Handle<v8::Obj ectTemplate> prototypeTemplate, v8::Handle<v8::Signature> signature, v8::Propert yAttribute attribute, const MethodConfiguration* callbacks, size_t callbackCount ) 217 void V8DOMConfiguration::installMethods(v8::Isolate* isolate, v8::Handle<v8::Obj ectTemplate> prototypeTemplate, v8::Handle<v8::Signature> signature, v8::Propert yAttribute attribute, const MethodConfiguration* callbacks, size_t callbackCount )
218 { 218 {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return result; 274 return result;
275 275
276 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); 276 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
277 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode); 277 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
278 configureDOMClassTemplate(result, isolate); 278 configureDOMClassTemplate(result, isolate);
279 data->setDOMTemplate(wrapperTypeInfo, result); 279 data->setDOMTemplate(wrapperTypeInfo, result);
280 return result; 280 return result;
281 } 281 }
282 282
283 } // namespace blink 283 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.h ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698