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

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

Issue 1181113006: bindings: Introduces on_{instance,prototype,interface} in the code generator. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
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 21 matching lines...) Expand all
32 #include "bindings/core/v8/V8Binding.h" 32 #include "bindings/core/v8/V8Binding.h"
33 #include "bindings/core/v8/V8DOMWrapper.h" 33 #include "bindings/core/v8/V8DOMWrapper.h"
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include <v8.h> 35 #include <v8.h>
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class CORE_EXPORT V8DOMConfiguration final { 39 class CORE_EXPORT V8DOMConfiguration final {
40 public: 40 public:
41 // The following Configuration structs and install methods are used for 41 // The following Configuration structs and install methods are used for
42 // setting multiple properties on an ObjectTemplate, used from the 42 // setting multiple properties on ObjectTemplate / FunctionTemplate, used
43 // generated bindings initialization (ConfigureXXXTemplate). This greatly 43 // from the generated bindings initialization (ConfigureXXXTemplate).
44 // reduces the binary size by moving from code driven setup to data table 44 // This greatly reduces the binary size by moving from code driven setup to
45 // driven setup. 45 // data table driven setup.
46 46
47 enum ExposeConfiguration { 47 enum ExposeConfiguration {
48 ExposedToAllScripts, 48 ExposedToAllScripts,
49 OnlyExposedToPrivateScript, 49 OnlyExposedToPrivateScript,
50 }; 50 };
51 51
52 enum InstanceOrPrototypeConfiguration { 52 enum PropertyLocationConfiguration {
53 OnInstance, 53 OnInstance = 1 << 0,
54 OnPrototype, 54 OnPrototype = 1 << 1,
55 OnInterface = 1 << 2,
55 }; 56 };
56 57
57 enum HolderCheckConfiguration { 58 enum HolderCheckConfiguration {
58 CheckHolder, 59 CheckHolder,
59 DoNotCheckHolder, 60 DoNotCheckHolder,
60 }; 61 };
61 62
62 // AttributeConfiguration translates into calls to SetAccessor() on either 63 // AttributeConfiguration translates into calls to SetAccessor() on either
63 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|. 64 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|.
64 struct AttributeConfiguration { 65 struct AttributeConfiguration {
65 const char* const name; 66 const char* const name;
66 v8::AccessorNameGetterCallback getter; 67 v8::AccessorNameGetterCallback getter;
67 v8::AccessorNameSetterCallback setter; 68 v8::AccessorNameSetterCallback setter;
68 v8::AccessorNameGetterCallback getterForMainWorld; 69 v8::AccessorNameGetterCallback getterForMainWorld;
69 v8::AccessorNameSetterCallback setterForMainWorld; 70 v8::AccessorNameSetterCallback setterForMainWorld;
70 const WrapperTypeInfo* data; 71 const WrapperTypeInfo* data;
71 v8::AccessControl settings; 72 v8::AccessControl settings;
72 v8::PropertyAttribute attribute; 73 v8::PropertyAttribute attribute;
73 unsigned exposeConfiguration : 1; // ExposeConfiguration 74 unsigned exposeConfiguration : 1; // ExposeConfiguration
74 unsigned instanceOrPrototypeConfiguration : 1; // InstanceOrPrototypeCon figuration 75 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion
76 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
75 }; 77 };
76 78
77 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute Configuration*, size_t attributeCount); 79 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute Configuration*, size_t attributeCount);
78 80
79 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC onfiguration&); 81 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC onfiguration&);
80 82
81 static void installAttribute(v8::Isolate*, v8::Local<v8::Object> instance, v 8::Local<v8::Object> prototype, const AttributeConfiguration&);
82
83 // AccessorConfiguration translates into calls to SetAccessorProperty() 83 // AccessorConfiguration translates into calls to SetAccessorProperty()
84 // on prototype ObjectTemplate. 84 // on prototype ObjectTemplate.
85 struct AccessorConfiguration { 85 struct AccessorConfiguration {
86 const char* const name; 86 const char* const name;
87 v8::FunctionCallback getter; 87 v8::FunctionCallback getter;
88 v8::FunctionCallback setter; 88 v8::FunctionCallback setter;
89 v8::FunctionCallback getterForMainWorld; 89 v8::FunctionCallback getterForMainWorld;
90 v8::FunctionCallback setterForMainWorld; 90 v8::FunctionCallback setterForMainWorld;
91 const WrapperTypeInfo* data; 91 const WrapperTypeInfo* data;
92 v8::AccessControl settings; 92 v8::AccessControl settings;
93 v8::PropertyAttribute attribute; 93 v8::PropertyAttribute attribute;
94 unsigned exposeConfiguration : 1; // ExposeConfiguration 94 unsigned exposeConfiguration : 1; // ExposeConfiguration
95 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion
95 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration 96 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
96 }; 97 };
97 98
98 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> pro totypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration*, size_t a ccessorCount); 99 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fu nctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfi guration*, size_t accessorCount);
99 100
100 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> prot otypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration&); 101 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&);
101
102 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> prototype, c onst AccessorConfiguration&);
103 102
104 enum ConstantType { 103 enum ConstantType {
105 ConstantTypeShort, 104 ConstantTypeShort,
106 ConstantTypeLong, 105 ConstantTypeLong,
107 ConstantTypeUnsignedShort, 106 ConstantTypeUnsignedShort,
108 ConstantTypeUnsignedLong, 107 ConstantTypeUnsignedLong,
109 ConstantTypeFloat, 108 ConstantTypeFloat,
110 ConstantTypeDouble, 109 ConstantTypeDouble,
111 ConstantTypeString 110 ConstantTypeString
112 }; 111 };
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const AttributeConfiguration*, size_t attributeCount, 178 const AttributeConfiguration*, size_t attributeCount,
180 const AccessorConfiguration*, size_t accessorCount, 179 const AccessorConfiguration*, size_t accessorCount,
181 const MethodConfiguration*, size_t callbackCount); 180 const MethodConfiguration*, size_t callbackCount);
182 181
183 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); 182 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*));
184 }; 183 };
185 184
186 } // namespace blink 185 } // namespace blink
187 186
188 #endif // V8DOMConfiguration_h 187 #endif // V8DOMConfiguration_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698