| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 ConstantTypeDouble, | 118 ConstantTypeDouble, |
| 119 ConstantTypeString | 119 ConstantTypeString |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 // ConstantConfiguration translates into calls to Set() for setting up an | 122 // ConstantConfiguration translates into calls to Set() for setting up an |
| 123 // object's constants. It sets the constant on both the FunctionTemplate and | 123 // object's constants. It sets the constant on both the FunctionTemplate and |
| 124 // the ObjectTemplate. PropertyAttributes is always ReadOnly. | 124 // the ObjectTemplate. PropertyAttributes is always ReadOnly. |
| 125 struct ConstantConfiguration { | 125 struct ConstantConfiguration { |
| 126 ConstantConfiguration& operator=(const ConstantConfiguration&) = delete; | 126 ConstantConfiguration& operator=(const ConstantConfiguration&) = delete; |
| 127 DISALLOW_ALLOCATION(); | 127 DISALLOW_ALLOCATION(); |
| 128 ConstantConfiguration(const char* const name, unsigned value, ConstantTy
pe type) | |
| 129 : name(name) | |
| 130 , ivalue(value) | |
| 131 , type(type) {} | |
| 132 ConstantConfiguration(const char* const name, int value, ConstantType ty
pe) | |
| 133 : name(name) | |
| 134 , ivalue(value) | |
| 135 , type(type) {} | |
| 136 ConstantConfiguration(const char* const name, double value, ConstantType
type) | |
| 137 : name(name) | |
| 138 , dvalue(value) | |
| 139 , type(type) {} | |
| 140 ConstantConfiguration(const char* const name, const char* const value, C
onstantType type) | |
| 141 : name(name) | |
| 142 , svalue(value) | |
| 143 , type(type) {} | |
| 144 const char* const name; | 128 const char* const name; |
| 145 union { | 129 int ivalue; |
| 146 int ivalue; | 130 double dvalue; |
| 147 double dvalue; | 131 const char* const svalue; |
| 148 const char* const svalue; | |
| 149 }; | |
| 150 ConstantType type; | 132 ConstantType type; |
| 151 }; | 133 }; |
| 152 | 134 |
| 153 // Constant installation | 135 // Constant installation |
| 154 // | 136 // |
| 155 // installConstants and installConstant are used for simple constants. They | 137 // installConstants and installConstant are used for simple constants. They |
| 156 // install constants using v8::Template::Set(), which results in a property | 138 // install constants using v8::Template::Set(), which results in a property |
| 157 // that is much faster to access from scripts. | 139 // that is much faster to access from scripts. |
| 158 // installConstantWithGetter is used when some C++ code needs to be executed | 140 // installConstantWithGetter is used when some C++ code needs to be executed |
| 159 // when the constant is accessed, e.g. to handle deprecation or measuring | 141 // when the constant is accessed, e.g. to handle deprecation or measuring |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 const AttributeConfiguration*, size_t attributeCount, | 193 const AttributeConfiguration*, size_t attributeCount, |
| 212 const AccessorConfiguration*, size_t accessorCount, | 194 const AccessorConfiguration*, size_t accessorCount, |
| 213 const MethodConfiguration*, size_t callbackCount); | 195 const MethodConfiguration*, size_t callbackCount); |
| 214 | 196 |
| 215 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe
rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); | 197 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe
rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); |
| 216 }; | 198 }; |
| 217 | 199 |
| 218 } // namespace blink | 200 } // namespace blink |
| 219 | 201 |
| 220 #endif // V8DOMConfiguration_h | 202 #endif // V8DOMConfiguration_h |
| OLD | NEW |