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

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

Issue 1315663004: [bindings] Bindings should only support the prescribed types for constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> inst anceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fun ctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfig uration&); 108 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> inst anceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fun ctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfig uration&);
109 109
110 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> instance, v8 ::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8:: Signature>, const AccessorConfiguration&); 110 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> instance, v8 ::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8:: Signature>, const AccessorConfiguration&);
111 111
112 enum ConstantType { 112 enum ConstantType {
113 ConstantTypeShort, 113 ConstantTypeShort,
114 ConstantTypeLong, 114 ConstantTypeLong,
115 ConstantTypeUnsignedShort, 115 ConstantTypeUnsignedShort,
116 ConstantTypeUnsignedLong, 116 ConstantTypeUnsignedLong,
117 ConstantTypeFloat, 117 ConstantTypeFloat,
118 ConstantTypeDouble, 118 ConstantTypeDouble
119 ConstantTypeString
120 }; 119 };
121 120
122 // ConstantConfiguration translates into calls to Set() for setting up an 121 // ConstantConfiguration translates into calls to Set() for setting up an
123 // object's constants. It sets the constant on both the FunctionTemplate and 122 // object's constants. It sets the constant on both the FunctionTemplate and
124 // the ObjectTemplate. PropertyAttributes is always ReadOnly. 123 // the ObjectTemplate. PropertyAttributes is always ReadOnly.
125 struct ConstantConfiguration { 124 struct ConstantConfiguration {
126 ConstantConfiguration& operator=(const ConstantConfiguration&) = delete; 125 ConstantConfiguration& operator=(const ConstantConfiguration&) = delete;
127 DISALLOW_ALLOCATION(); 126 DISALLOW_ALLOCATION();
128 const char* const name; 127 const char* const name;
129 int ivalue; 128 int ivalue;
130 double dvalue; 129 double dvalue;
131 const char* const svalue;
132 ConstantType type; 130 ConstantType type;
133 }; 131 };
134 132
135 // Constant installation 133 // Constant installation
136 // 134 //
137 // installConstants and installConstant are used for simple constants. They 135 // installConstants and installConstant are used for simple constants. They
138 // install constants using v8::Template::Set(), which results in a property 136 // install constants using v8::Template::Set(), which results in a property
139 // that is much faster to access from scripts. 137 // that is much faster to access from scripts.
140 // installConstantWithGetter is used when some C++ code needs to be executed 138 // installConstantWithGetter is used when some C++ code needs to be executed
141 // when the constant is accessed, e.g. to handle deprecation or measuring 139 // when the constant is accessed, e.g. to handle deprecation or measuring
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const AttributeConfiguration*, size_t attributeCount, 191 const AttributeConfiguration*, size_t attributeCount,
194 const AccessorConfiguration*, size_t accessorCount, 192 const AccessorConfiguration*, size_t accessorCount,
195 const MethodConfiguration*, size_t callbackCount); 193 const MethodConfiguration*, size_t callbackCount);
196 194
197 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); 195 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*));
198 }; 196 };
199 197
200 } // namespace blink 198 } // namespace blink
201 199
202 #endif // V8DOMConfiguration_h 200 #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