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

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

Issue 2873543002: First implementation of lazily cached accessor for DOM attributes. (Closed)
Patch Set: Created 3 years, 7 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 }; 66 };
67 67
68 // Bit field to select which worlds the member will be defined in. 68 // Bit field to select which worlds the member will be defined in.
69 enum WorldConfiguration : unsigned { 69 enum WorldConfiguration : unsigned {
70 kMainWorld = 1 << 0, 70 kMainWorld = 1 << 0,
71 kNonMainWorlds = 1 << 1, 71 kNonMainWorlds = 1 << 1,
72 kAllWorlds = kMainWorld | kNonMainWorlds, 72 kAllWorlds = kMainWorld | kNonMainWorlds,
73 }; 73 };
74 74
75 typedef v8::Local<v8::Private> (*CachedPropertyKey)(v8::Isolate*); 75 typedef v8::Local<v8::Private> (*CachedPropertyKey)(v8::Isolate*);
76 typedef void (*CachedAccessorInitCallback)(v8::Isolate*,
77 v8::Local<v8::Object>);
76 78
77 // AttributeConfiguration translates into calls to SetNativeDataProperty() on 79 // AttributeConfiguration translates into calls to SetNativeDataProperty() on
78 // either the instance or the prototype ObjectTemplate, based on 80 // either the instance or the prototype ObjectTemplate, based on
79 // |propertyLocationConfiguration|. 81 // |propertyLocationConfiguration|.
80 struct AttributeConfiguration { 82 struct AttributeConfiguration {
81 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete; 83 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete;
82 DISALLOW_NEW(); 84 DISALLOW_NEW();
83 const char* const name; 85 const char* const name;
84 v8::AccessorNameGetterCallback getter; 86 v8::AccessorNameGetterCallback getter;
85 v8::AccessorNameSetterCallback setter; 87 v8::AccessorNameSetterCallback setter;
86 // TODO(vogelheim): This has to be removed too since it's only used in 88
87 // accessors.
88 // The accessor's 'result' is stored in a private property.
89 CachedPropertyKey cached_property_key;
90 const WrapperTypeInfo* data; 89 const WrapperTypeInfo* data;
91 // v8::PropertyAttribute 90 // v8::PropertyAttribute
92 unsigned attribute : 8; 91 unsigned attribute : 8;
93 // PropertyLocationConfiguration 92 // PropertyLocationConfiguration
94 unsigned property_location_configuration : 3; 93 unsigned property_location_configuration : 3;
95 // HolderCheckConfiguration 94 // HolderCheckConfiguration
96 unsigned holder_check_configuration : 1; 95 unsigned holder_check_configuration : 1;
97 // WorldConfiguration 96 // WorldConfiguration
98 unsigned world_configuration : 2; 97 unsigned world_configuration : 2;
99 }; 98 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // AccessorConfiguration translates into calls to SetAccessorProperty() 134 // AccessorConfiguration translates into calls to SetAccessorProperty()
136 // on prototype ObjectTemplate. 135 // on prototype ObjectTemplate.
137 struct AccessorConfiguration { 136 struct AccessorConfiguration {
138 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; 137 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete;
139 DISALLOW_NEW(); 138 DISALLOW_NEW();
140 const char* const name; 139 const char* const name;
141 v8::FunctionCallback getter; 140 v8::FunctionCallback getter;
142 v8::FunctionCallback setter; 141 v8::FunctionCallback setter;
143 // The accessor's 'result' is stored in a private property. 142 // The accessor's 'result' is stored in a private property.
144 CachedPropertyKey cached_property_key; 143 CachedPropertyKey cached_property_key;
144 CachedAccessorInitCallback cached_accessor_init_callback;
145 const WrapperTypeInfo* data; 145 const WrapperTypeInfo* data;
146 // v8::PropertyAttribute 146 // v8::PropertyAttribute
147 unsigned attribute : 8; 147 unsigned attribute : 8;
148 // PropertyLocationConfiguration 148 // PropertyLocationConfiguration
149 unsigned property_location_configuration : 3; 149 unsigned property_location_configuration : 3;
150 // HolderCheckConfiguration 150 // HolderCheckConfiguration
151 unsigned holder_check_configuration : 1; 151 unsigned holder_check_configuration : 1;
152 // WorldConfiguration 152 // WorldConfiguration
153 unsigned world_configuration : 2; 153 unsigned world_configuration : 2;
154 }; 154 };
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Sets the class string of platform objects, interface prototype objects, 328 // Sets the class string of platform objects, interface prototype objects,
329 // etc. See also http://heycam.github.io/webidl/#dfn-class-string 329 // etc. See also http://heycam.github.io/webidl/#dfn-class-string
330 static void SetClassString(v8::Isolate*, 330 static void SetClassString(v8::Isolate*,
331 v8::Local<v8::ObjectTemplate>, 331 v8::Local<v8::ObjectTemplate>,
332 const char* class_string); 332 const char* class_string);
333 }; 333 };
334 334
335 } // namespace blink 335 } // namespace blink
336 336
337 #endif // V8DOMConfiguration_h 337 #endif // V8DOMConfiguration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698