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 |