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

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

Issue 2781443002: [Bindings] Specialize WindowDocument symbol in V8PrivateProperty (Closed)
Patch Set: . Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h b/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h
index 9af86f546ffee2bd29fc49fe5ec736a78dd0cecf..08d9e42096ef86504f28a2c1af254e3f72a72af2 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h
@@ -39,8 +39,7 @@ class ScriptWrappable;
X(SameObject, NotificationData) \
X(SameObject, NotificationVibrate) \
X(SameObject, PerformanceLongTaskTimingAttribution) \
- X(V8NodeFilterCondition, Filter) \
- X(Window, DocumentCachedAccessor)
+ X(V8NodeFilterCondition, Filter)
// The getter's name for a private property.
#define V8_PRIVATE_PROPERTY_GETTER_NAME(InterfaceName, PrivateKeyName) \
@@ -165,6 +164,17 @@ class CORE_EXPORT V8PrivateProperty {
return Symbol(createV8Private(isolate, symbol, length));
}
+ static Symbol getWindowDocumentCachedAccessor(v8::Isolate* isolate) {
+ static constexpr char kSymbol[] = "Window#Document";
Yuki 2017/03/27 09:06:18 nit: Window#document?
peria 2017/03/28 08:10:03 Done. This string was created with V8_PRIVATE_P
+ V8PrivateProperty* privateProp =
+ V8PerIsolateData::from(isolate)->privateProperty();
+ if (UNLIKELY(privateProp->m_symbolWindowDocument.isEmpty())) {
+ privateProp->m_symbolWindowDocument.set(
+ isolate, createV8Private(isolate, kSymbol, sizeof(kSymbol)));
+ }
+ return Symbol(privateProp->m_symbolWindowDocument.newLocal(isolate));
+ }
+
private:
V8PrivateProperty() {}
@@ -177,6 +187,11 @@ class CORE_EXPORT V8PrivateProperty {
InterfaceName, KeyName); // NOLINT(readability/naming/underscores)
V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER)
#undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER
+
+ // TODO(peria): Do not use specialized hack for Window#Document.
Yuki 2017/03/27 09:06:18 nit: Window#document or [Ww]indow.document?
haraken 2017/03/27 09:49:56 a special hack
peria 2017/03/28 08:10:03 Done.
peria 2017/03/28 08:10:03 Done.
+ // This is required to put v8::Private key in snapshot, and it cannot
haraken 2017/03/27 09:49:56 in a snapshot
peria 2017/03/28 08:10:03 Done.
+ // be a v8::Eternal<> due to V8 serializer's requirement.
+ ScopedPersistent<v8::Private> m_symbolWindowDocument;
jbroman 2017/03/27 18:06:56 Can you explain to me why this is correct? If I un
peria 2017/03/28 08:10:03 Right. The difference between v8::Eternal<> and Sc
Yuki 2017/03/28 08:17:59 I'm okay to use ForApi as a short-term solution, b
};
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698