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

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

Issue 2335203006: Add [CachedAccessor] attribute to cache (almost) constant accessors (window.document). (Closed)
Patch Set: Pre-review nits Created 4 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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // AttributeConfiguration translates into calls to SetNativeDataProperty() o n either 68 // AttributeConfiguration translates into calls to SetNativeDataProperty() o n either
69 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|. 69 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|.
70 struct AttributeConfiguration { 70 struct AttributeConfiguration {
71 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet e; 71 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet e;
72 DISALLOW_NEW(); 72 DISALLOW_NEW();
73 const char* const name; 73 const char* const name;
74 v8::AccessorNameGetterCallback getter; 74 v8::AccessorNameGetterCallback getter;
75 v8::AccessorNameSetterCallback setter; 75 v8::AccessorNameSetterCallback setter;
76 v8::AccessorNameGetterCallback getterForMainWorld; 76 v8::AccessorNameGetterCallback getterForMainWorld;
77 v8::AccessorNameSetterCallback setterForMainWorld; 77 v8::AccessorNameSetterCallback setterForMainWorld;
78 // TODO(vogelheim): Figure out how to remove this. 78
79 // TODO(peterssen|vogelheim): Figure out how to remove this.
79 FastAccessorBuilderCallback fastGetter; 80 FastAccessorBuilderCallback fastGetter;
81 // TODO(peterssen|vogelheim): This has to be removed too since it's only used in accessors.
82 const char* const surrogatePropertyName; // The accessor's 'result' is s tored in a private property.
83
80 const WrapperTypeInfo* data; 84 const WrapperTypeInfo* data;
81 unsigned settings : 8; // v8::AccessControl 85 unsigned settings : 8; // v8::AccessControl
82 unsigned attribute : 8; // v8::PropertyAttribute 86 unsigned attribute : 8; // v8::PropertyAttribute
83 unsigned exposeConfiguration : 1; // ExposeConfiguration 87 unsigned exposeConfiguration : 1; // ExposeConfiguration
84 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion 88 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion
85 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration 89 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
86 }; 90 };
87 91
88 static void installAttributes(v8::Isolate*, const DOMWrapperWorld&, v8::Loca l<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeT emplate, const AttributeConfiguration*, size_t attributeCount); 92 static void installAttributes(v8::Isolate*, const DOMWrapperWorld&, v8::Loca l<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeT emplate, const AttributeConfiguration*, size_t attributeCount);
89 93
90 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe mplate, const AttributeConfiguration&); 94 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe mplate, const AttributeConfiguration&);
91 95
92 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::Object> instance, v8::Local<v8::Object> prototype, const AttributeConfigura tion&); 96 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::Object> instance, v8::Local<v8::Object> prototype, const AttributeConfigura tion&);
93 97
94 // AccessorConfiguration translates into calls to SetAccessorProperty() 98 // AccessorConfiguration translates into calls to SetAccessorProperty()
95 // on prototype ObjectTemplate. 99 // on prototype ObjectTemplate.
96 struct AccessorConfiguration { 100 struct AccessorConfiguration {
97 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; 101 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete;
98 DISALLOW_NEW(); 102 DISALLOW_NEW();
99 const char* const name; 103 const char* const name;
100 v8::FunctionCallback getter; 104 v8::FunctionCallback getter;
101 v8::FunctionCallback setter; 105 v8::FunctionCallback setter;
102 v8::FunctionCallback getterForMainWorld; 106 v8::FunctionCallback getterForMainWorld;
103 v8::FunctionCallback setterForMainWorld; 107 v8::FunctionCallback setterForMainWorld;
104 FastAccessorBuilderCallback fastGetter; 108 FastAccessorBuilderCallback fastGetter;
109 const char* const surrogatePropertyName; // The accessor is backed by a private property.
haraken 2016/09/15 09:26:10 surrogatePropertyName => keyForCachedAttributeGett
105 const WrapperTypeInfo* data; 110 const WrapperTypeInfo* data;
106 unsigned settings : 8; // v8::AccessControl 111 unsigned settings : 8; // v8::AccessControl
107 unsigned attribute : 8; // v8::PropertyAttribute 112 unsigned attribute : 8; // v8::PropertyAttribute
108 unsigned exposeConfiguration : 1; // ExposeConfiguration 113 unsigned exposeConfiguration : 1; // ExposeConfiguration
109 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion 114 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion
110 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration 115 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
111 }; 116 };
112 117
113 static void installAccessors(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe mplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signatu re>, const AccessorConfiguration*, size_t accessorCount); 118 static void installAccessors(v8::Isolate*, const DOMWrapperWorld&, v8::Local <v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe mplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signatu re>, const AccessorConfiguration*, size_t accessorCount);
114 119
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, const DOMWrapperWorld&, WrapperTypeInfo*, InstallTemplateFunction); 210 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, const DOMWrapperWorld&, WrapperTypeInfo*, InstallTemplateFunction);
206 211
207 // Sets the class string of platform objects, interface prototype objects, e tc. 212 // Sets the class string of platform objects, interface prototype objects, e tc.
208 // See also http://heycam.github.io/webidl/#dfn-class-string 213 // See also http://heycam.github.io/webidl/#dfn-class-string
209 static void setClassString(v8::Isolate*, v8::Local<v8::ObjectTemplate>, cons t char* classString); 214 static void setClassString(v8::Isolate*, v8::Local<v8::ObjectTemplate>, cons t char* classString);
210 }; 215 };
211 216
212 } // namespace blink 217 } // namespace blink
213 218
214 #endif // V8DOMConfiguration_h 219 #endif // V8DOMConfiguration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698