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

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

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove DOMWindowProperty changes Created 5 years, 11 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
Index: Source/core/frame/Location.h
diff --git a/Source/core/frame/Location.h b/Source/core/frame/Location.h
index 8b6f0a37be2716593c370d99d93ca53099bb4247..d9dda748cca84b28a3bbcf4cec9d620d295edc12 100644
--- a/Source/core/frame/Location.h
+++ b/Source/core/frame/Location.h
@@ -40,18 +40,25 @@ namespace blink {
class LocalDOMWindow;
class ExceptionState;
-class LocalFrame;
+class Frame;
class KURL;
-class Location final : public RefCountedWillBeGarbageCollected<Location>, public ScriptWrappable, public DOMWindowProperty {
+// This class corresponds to the JS Location API, which is the only DOM API besides Window that is operable
+// in a RemoteFrame. Rather than making DOMWindowProperty support RemoteFrames and generating a lot
+// code churn, Location is implemented as a one-off with some custom lifetime management code. Namely,
+// it needs a manual call to reset() from DOMWindow::reset() to ensure it doesn't retain a stale Frame pointer.
dcheng 2015/02/02 21:50:36 Would we still need reset() with Oilpan? I guess w
sof 2015/02/02 22:53:04 We normally keep such Oilpan-specific dispose/rese
haraken 2015/02/03 00:56:09 Right, in order not to make GC's behavior observab
Nate Chapin 2015/02/03 19:17:21 I added an unconditional reset() to ~DOMWindow. I
+class Location final : public RefCountedWillBeGarbageCollected<Location>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Location);
public:
- static PassRefPtrWillBeRawPtr<Location> create(LocalFrame* frame)
+ static PassRefPtrWillBeRawPtr<Location> create(Frame* frame)
{
return adoptRefWillBeNoop(new Location(frame));
}
+ Frame* frame() const { return m_frame.get(); }
+ void reset() { m_frame = nullptr; }
+
void setHref(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, const String&);
String href() const;
@@ -77,15 +84,17 @@ public:
PassRefPtrWillBeRawPtr<DOMStringList> ancestorOrigins() const;
- virtual void trace(Visitor*) override;
+ virtual void trace(Visitor*);
private:
- explicit Location(LocalFrame*);
+ explicit Location(Frame*);
enum class SetLocation { Normal, ReplaceThisFrame };
void setLocation(const String&, LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, SetLocation = SetLocation::Normal);
const KURL& url() const;
+
+ RawPtrWillBeWeakMember<Frame> m_frame;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698