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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Review feedback (and rebase) Created 4 years, 1 month 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 OnInstance = 1 << 0, 56 OnInstance = 1 << 0,
57 OnPrototype = 1 << 1, 57 OnPrototype = 1 << 1,
58 OnInterface = 1 << 2, 58 OnInterface = 1 << 2,
59 }; 59 };
60 60
61 enum HolderCheckConfiguration { 61 enum HolderCheckConfiguration {
62 CheckHolder, 62 CheckHolder,
63 DoNotCheckHolder, 63 DoNotCheckHolder,
64 }; 64 };
65 65
66 typedef v8::Local<v8::Private> (*CachedAccessorCallback)(v8::Isolate*);
67
66 // AttributeConfiguration translates into calls to SetNativeDataProperty() on 68 // AttributeConfiguration translates into calls to SetNativeDataProperty() on
67 // either the instance or the prototype ObjectTemplate, based on 69 // either the instance or the prototype ObjectTemplate, based on
68 // |instanceOrPrototypeConfiguration|. 70 // |instanceOrPrototypeConfiguration|.
69 struct AttributeConfiguration { 71 struct AttributeConfiguration {
70 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete; 72 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete;
71 DISALLOW_NEW(); 73 DISALLOW_NEW();
72 const char* const name; 74 const char* const name;
73 v8::AccessorNameGetterCallback getter; 75 v8::AccessorNameGetterCallback getter;
74 v8::AccessorNameSetterCallback setter; 76 v8::AccessorNameSetterCallback setter;
75 v8::AccessorNameGetterCallback getterForMainWorld; 77 v8::AccessorNameGetterCallback getterForMainWorld;
76 v8::AccessorNameSetterCallback setterForMainWorld; 78 v8::AccessorNameSetterCallback setterForMainWorld;
79 // TODO(vogelheim): This has to be removed too since it's only used in
80 // accessors.
81 // The accessor's 'result' is stored in a private property.
82 CachedAccessorCallback cachedAccessorCallback;
77 const WrapperTypeInfo* data; 83 const WrapperTypeInfo* data;
78 unsigned settings : 8; // v8::AccessControl 84 unsigned settings : 8; // v8::AccessControl
79 unsigned attribute : 8; // v8::PropertyAttribute 85 unsigned attribute : 8; // v8::PropertyAttribute
80 unsigned exposeConfiguration : 1; // ExposeConfiguration 86 unsigned exposeConfiguration : 1; // ExposeConfiguration
81 unsigned 87 unsigned
82 propertyLocationConfiguration : 3; // PropertyLocationConfiguration 88 propertyLocationConfiguration : 3; // PropertyLocationConfiguration
83 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration 89 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
84 }; 90 };
85 91
86 static void installAttributes(v8::Isolate*, 92 static void installAttributes(v8::Isolate*,
(...skipping 18 matching lines...) Expand all
105 // AccessorConfiguration translates into calls to SetAccessorProperty() 111 // AccessorConfiguration translates into calls to SetAccessorProperty()
106 // on prototype ObjectTemplate. 112 // on prototype ObjectTemplate.
107 struct AccessorConfiguration { 113 struct AccessorConfiguration {
108 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; 114 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete;
109 DISALLOW_NEW(); 115 DISALLOW_NEW();
110 const char* const name; 116 const char* const name;
111 v8::FunctionCallback getter; 117 v8::FunctionCallback getter;
112 v8::FunctionCallback setter; 118 v8::FunctionCallback setter;
113 v8::FunctionCallback getterForMainWorld; 119 v8::FunctionCallback getterForMainWorld;
114 v8::FunctionCallback setterForMainWorld; 120 v8::FunctionCallback setterForMainWorld;
121 // The accessor's 'result' is stored in a private property.
122 CachedAccessorCallback cachedAccessorCallback;
115 const WrapperTypeInfo* data; 123 const WrapperTypeInfo* data;
116 unsigned settings : 8; // v8::AccessControl 124 unsigned settings : 8; // v8::AccessControl
117 unsigned attribute : 8; // v8::PropertyAttribute 125 unsigned attribute : 8; // v8::PropertyAttribute
118 unsigned exposeConfiguration : 1; // ExposeConfiguration 126 unsigned exposeConfiguration : 1; // ExposeConfiguration
119 unsigned 127 unsigned
120 propertyLocationConfiguration : 3; // PropertyLocationConfiguration 128 propertyLocationConfiguration : 3; // PropertyLocationConfiguration
121 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration 129 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
122 }; 130 };
123 131
124 static void installAccessors( 132 static void installAccessors(
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Sets the class string of platform objects, interface prototype objects, 300 // Sets the class string of platform objects, interface prototype objects,
293 // etc. See also http://heycam.github.io/webidl/#dfn-class-string 301 // etc. See also http://heycam.github.io/webidl/#dfn-class-string
294 static void setClassString(v8::Isolate*, 302 static void setClassString(v8::Isolate*,
295 v8::Local<v8::ObjectTemplate>, 303 v8::Local<v8::ObjectTemplate>,
296 const char* classString); 304 const char* classString);
297 }; 305 };
298 306
299 } // namespace blink 307 } // namespace blink
300 308
301 #endif // V8DOMConfiguration_h 309 #endif // V8DOMConfiguration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698