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

Unified Diff: Source/core/frame/Frame.h

Issue 538323003: Have window.closed return true when frame is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 | « LayoutTests/fast/dom/Window/resources/window-property-collector.js ('k') | Source/core/frame/Frame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/Frame.h
diff --git a/Source/core/frame/Frame.h b/Source/core/frame/Frame.h
index 498cb77c81bfd740d26d1fdc0c02b6131f656796..0648d6771a5bad260070ae83fb25b8076fe47813 100644
--- a/Source/core/frame/Frame.h
+++ b/Source/core/frame/Frame.h
@@ -98,6 +98,9 @@ public:
// method.
bool isRemoteFrameTemporary() const { return m_remotePlatformLayer; }
+ bool hasBeenClosed() const { return m_hasBeenClosed; }
+ void setHasBeenClosed() { ASSERT(!m_hasBeenClosed); m_hasBeenClosed = true; }
+
protected:
Frame(FrameClient*, FrameHost*, FrameOwner*);
@@ -111,6 +114,15 @@ protected:
private:
FrameClient* m_client;
blink::WebLayer* m_remotePlatformLayer;
+
+ // The closing of a frame by the embedder may not trigger the
+ // immediate release of this Frame object -- there might be
+ // other RefPtrs to the Frame, up the stack or elsewhere. For Oilpan,
Mads Ager (chromium) 2014/09/17 07:47:39 Remove the Oilpan reference in this patch since Fr
sof 2014/09/17 08:08:28 Thanks, that would premature to mention. Removed.
+ // any release will only happen at the next GC (at the earliest.)
+ //
+ // Hence, keep a separate flag that's set when the frame is
+ // closed. It is consulted by window.closed.
+ bool m_hasBeenClosed;
};
inline FrameClient* Frame::client() const
« no previous file with comments | « LayoutTests/fast/dom/Window/resources/window-property-collector.js ('k') | Source/core/frame/Frame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698