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

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

Issue 2811943003: v8binding: Makes WindowProxy::global_proxy_ a weak reference when detached. (Closed)
Patch Set: Created 3 years, 8 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 | « third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp ('k') | 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/WindowProxy.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
index dab477433ef9875c93672ca166df80baad738984..79bcbb5c11c1585057fdf8f76509cbc23af327d3 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -206,7 +206,9 @@ class WindowProxy : public GarbageCollectedFinalized<WindowProxy> {
// to the context and hence author script may run in the context.
// The spec does not support some of web features such as setTimeout, etc. on
// a detached window. Blink supports less things than the spec.
- // V8PerContextData is cut off from the context.
+ // V8PerContextData is cut off from the context. |global_proxy_| becomes a
+ // weak reference so that it's collectable when author script has no
+ // reference.
// - Possible next states: n/a
enum class Lifecycle {
// v8::Context is not yet initialized.
@@ -249,6 +251,10 @@ class WindowProxy : public GarbageCollectedFinalized<WindowProxy> {
protected:
// TODO(dcheng): Consider making these private and using getters.
const RefPtr<DOMWrapperWorld> world_;
+ // |global_proxy_| is the root reference from Blink to v8::Context (a strong
+ // reference to the global proxy makes the entire context alive). In order to
+ // discard the v8::Context, |global_proxy_| needs to be a weak reference or
+ // to be destroyed.
haraken 2017/04/11 14:32:54 // |global_proxy_| needs to be made a weak referen
ScopedPersistent<v8::Object> global_proxy_;
Lifecycle lifecycle_;
};
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698