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

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

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/V8Binding.cpp ('k') | 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 enum InstanceOrPrototypeConfiguration { 51 enum InstanceOrPrototypeConfiguration {
52 OnInstance, 52 OnInstance,
53 OnPrototype, 53 OnPrototype,
54 }; 54 };
55 55
56 // AttributeConfiguration translates into calls to SetAccessor() on either 56 // AttributeConfiguration translates into calls to SetAccessor() on either
57 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|. 57 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|.
58 struct AttributeConfiguration { 58 struct AttributeConfiguration {
59 const char* const name; 59 const char* const name;
60 v8::AccessorGetterCallback getter; 60 v8::AccessorNameGetterCallback getter;
61 v8::AccessorSetterCallback setter; 61 v8::AccessorNameSetterCallback setter;
62 v8::AccessorGetterCallback getterForMainWorld; 62 v8::AccessorNameGetterCallback getterForMainWorld;
63 v8::AccessorSetterCallback setterForMainWorld; 63 v8::AccessorNameSetterCallback setterForMainWorld;
64 const WrapperTypeInfo* data; 64 const WrapperTypeInfo* data;
65 v8::AccessControl settings; 65 v8::AccessControl settings;
66 v8::PropertyAttribute attribute; 66 v8::PropertyAttribute attribute;
67 ExposeConfiguration exposeConfiguration; 67 ExposeConfiguration exposeConfiguration;
68 InstanceOrPrototypeConfiguration instanceOrPrototypeConfiguration; 68 InstanceOrPrototypeConfiguration instanceOrPrototypeConfiguration;
69 }; 69 };
70 70
71 static void installAttributes(v8::Isolate*, v8::Handle<v8::ObjectTemplate> i nstanceTemplate, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Attribu teConfiguration*, size_t attributeCount); 71 static void installAttributes(v8::Isolate*, v8::Handle<v8::ObjectTemplate> i nstanceTemplate, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Attribu teConfiguration*, size_t attributeCount);
72 72
73 static void installAttribute(v8::Isolate*, v8::Handle<v8::ObjectTemplate> in stanceTemplate, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Attribut eConfiguration&); 73 static void installAttribute(v8::Isolate*, v8::Handle<v8::ObjectTemplate> in stanceTemplate, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Attribut eConfiguration&);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // installConstants and installConstant are used for simple constants. They 120 // installConstants and installConstant are used for simple constants. They
121 // install constants using v8::Template::Set(), which results in a property 121 // install constants using v8::Template::Set(), which results in a property
122 // that is much faster to access from scripts. 122 // that is much faster to access from scripts.
123 // installConstantWithGetter is used when some C++ code needs to be executed 123 // installConstantWithGetter is used when some C++ code needs to be executed
124 // when the constant is accessed, e.g. to handle deprecation or measuring 124 // when the constant is accessed, e.g. to handle deprecation or measuring
125 // usage. The property appears the same to scripts, but is slower to access. 125 // usage. The property appears the same to scripts, but is slower to access.
126 static void installConstants(v8::Isolate*, v8::Handle<v8::FunctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Cons tantConfiguration*, size_t constantCount); 126 static void installConstants(v8::Isolate*, v8::Handle<v8::FunctionTemplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Cons tantConfiguration*, size_t constantCount);
127 127
128 static void installConstant(v8::Isolate*, v8::Handle<v8::FunctionTemplate> f unctionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Const antConfiguration&); 128 static void installConstant(v8::Isolate*, v8::Handle<v8::FunctionTemplate> f unctionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, const Const antConfiguration&);
129 129
130 static void installConstantWithGetter(v8::Isolate*, v8::Handle<v8::FunctionT emplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, c onst char* name, v8::AccessorGetterCallback); 130 static void installConstantWithGetter(v8::Isolate*, v8::Handle<v8::FunctionT emplate> functionDescriptor, v8::Handle<v8::ObjectTemplate> prototypeTemplate, c onst char* name, v8::AccessorNameGetterCallback);
131 131
132 // MethodConfiguration translates into calls to Set() for setting up an 132 // MethodConfiguration translates into calls to Set() for setting up an
133 // object's callbacks. It sets the method on both the FunctionTemplate or 133 // object's callbacks. It sets the method on both the FunctionTemplate or
134 // the ObjectTemplate. 134 // the ObjectTemplate.
135 struct MethodConfiguration { 135 struct MethodConfiguration {
136 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); } 136 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); }
137 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t 137 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t
138 { 138 {
139 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback; 139 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback;
140 } 140 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const AttributeConfiguration*, size_t attributeCount, 172 const AttributeConfiguration*, size_t attributeCount,
173 const AccessorConfiguration*, size_t accessorCount, 173 const AccessorConfiguration*, size_t accessorCount,
174 const MethodConfiguration*, size_t callbackCount); 174 const MethodConfiguration*, size_t callbackCount);
175 175
176 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp erTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); 176 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp erTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*));
177 }; 177 };
178 178
179 } // namespace blink 179 } // namespace blink
180 180
181 #endif // V8DOMConfiguration_h 181 #endif // V8DOMConfiguration_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698