Chromium Code Reviews

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

Issue 2794453002: [Bindings] Replace V8HiddenValue in generated code with V8PrivateProperty (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8PrivateProperty_h 5 #ifndef V8PrivateProperty_h
6 #define V8PrivateProperty_h 6 #define V8PrivateProperty_h
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "bindings/core/v8/ScriptPromiseProperties.h" 10 #include "bindings/core/v8/ScriptPromiseProperties.h"
(...skipping 150 matching lines...)
161 privateProp->m_symbolWindowDocumentCachedAccessor.set( 161 privateProp->m_symbolWindowDocumentCachedAccessor.set(
162 isolate, createCachedV8Private( 162 isolate, createCachedV8Private(
163 isolate, V8_PRIVATE_PROPERTY_SYMBOL_STRING( 163 isolate, V8_PRIVATE_PROPERTY_SYMBOL_STRING(
164 "Window", "DocumentCachedAccessor"))); 164 "Window", "DocumentCachedAccessor")));
165 } 165 }
166 return Symbol( 166 return Symbol(
167 isolate, 167 isolate,
168 privateProp->m_symbolWindowDocumentCachedAccessor.newLocal(isolate)); 168 privateProp->m_symbolWindowDocumentCachedAccessor.newLocal(isolate));
169 } 169 }
170 170
171 static Symbol createSymbol(v8::Isolate* isolate, const char* symbol) { 171 static Symbol createSymbol(v8::Isolate* isolate, const char* symbol) {
Yuki 2017/03/31 13:38:29 This method should be renamed to getOrCreateSymbol
peria 2017/04/03 04:58:43 Done.
172 return Symbol(isolate, createCachedV8Private(isolate, symbol)); 172 return Symbol(isolate, createCachedV8Private(isolate, symbol));
173 } 173 }
174 174
175 private: 175 private:
176 V8PrivateProperty() {} 176 V8PrivateProperty() {}
177 177
178 static v8::Local<v8::Private> createV8Private(v8::Isolate*, 178 static v8::Local<v8::Private> createV8Private(v8::Isolate*,
179 const char* symbol); 179 const char* symbol);
180 // TODO(peria): Remove this method. We should not use v8::Private::ForApi().
180 static v8::Local<v8::Private> createCachedV8Private(v8::Isolate*, 181 static v8::Local<v8::Private> createCachedV8Private(v8::Isolate*,
181 const char* symbol); 182 const char* symbol);
182 183
183 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ 184 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \
184 v8::Eternal<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \ 185 v8::Eternal<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \
185 InterfaceName, KeyName); // NOLINT(readability/naming/underscores) 186 InterfaceName, KeyName); // NOLINT(readability/naming/underscores)
186 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) 187 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER)
187 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER 188 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER
188 189
189 // TODO(peria): Do not use this specialized hack for 190 // TODO(peria): Do not use this specialized hack for
190 // Window#DocumentCachedAccessor. This is required to put v8::Private key in 191 // Window#DocumentCachedAccessor. This is required to put v8::Private key in
191 // a snapshot, and it cannot be a v8::Eternal<> due to V8 serializer's 192 // a snapshot, and it cannot be a v8::Eternal<> due to V8 serializer's
192 // requirement. 193 // requirement.
193 ScopedPersistent<v8::Private> m_symbolWindowDocumentCachedAccessor; 194 ScopedPersistent<v8::Private> m_symbolWindowDocumentCachedAccessor;
194 }; 195 };
195 196
196 } // namespace blink 197 } // namespace blink
197 198
198 #endif // V8PrivateProperty_h 199 #endif // V8PrivateProperty_h
OLDNEW

Powered by Google App Engine