OLD | NEW |
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::Handle<v8::FunctionTemplate>, v8::Handle<v8
::ObjectTemplate>, const ConstantConfiguration*, size_t constantCount, v8::Isola
te*); |
| 132 static void installConstant(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8:
:ObjectTemplate>, const char* name, v8::AccessorGetterCallback, v8::Isolate*); |
132 | 133 |
133 // MethodConfiguration translates into calls to Set() for setting up an | 134 // MethodConfiguration translates into calls to Set() for setting up an |
134 // 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 |
135 // the ObjectTemplate. | 136 // the ObjectTemplate. |
136 struct MethodConfiguration { | 137 struct MethodConfiguration { |
137 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); } |
138 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons
t | 139 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons
t |
139 { | 140 { |
140 return world.isMainWorld() && callbackForMainWorld ? callbackForMain
World : callback; | 141 return world.isMainWorld() && callbackForMainWorld ? callbackForMain
World : callback; |
141 } | 142 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 { | 198 { |
198 target->Set(name, functionTemplate, attribute); | 199 target->Set(name, functionTemplate, attribute); |
199 } | 200 } |
200 | 201 |
201 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Hand
le<v8::Signature>, v8::FunctionCallback, int length, v8::Isolate*); | 202 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Hand
le<v8::Signature>, v8::FunctionCallback, int length, v8::Isolate*); |
202 }; | 203 }; |
203 | 204 |
204 } // namespace blink | 205 } // namespace blink |
205 | 206 |
206 #endif // V8DOMConfiguration_h | 207 #endif // V8DOMConfiguration_h |
OLD | NEW |