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

Side by Side Diff: Source/core/html/HTMLFrameOwnerElement.h

Issue 53303002: Have HTMLFrameOwnerElement / SubframeLoadingDisabler deal with references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tiny fix Created 7 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLFrameElementBase.cpp ('k') | Source/core/html/HTMLFrameOwnerElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 22 matching lines...) Expand all
33 class SVGDocument; 33 class SVGDocument;
34 34
35 class HTMLFrameOwnerElement : public HTMLElement { 35 class HTMLFrameOwnerElement : public HTMLElement {
36 public: 36 public:
37 virtual ~HTMLFrameOwnerElement(); 37 virtual ~HTMLFrameOwnerElement();
38 38
39 Frame* contentFrame() const { return m_contentFrame; } 39 Frame* contentFrame() const { return m_contentFrame; }
40 DOMWindow* contentWindow() const; 40 DOMWindow* contentWindow() const;
41 Document* contentDocument() const; 41 Document* contentDocument() const;
42 42
43 void setContentFrame(Frame*); 43 void setContentFrame(Frame&);
44 void clearContentFrame(); 44 void clearContentFrame();
45 45
46 void disconnectContentFrame(); 46 void disconnectContentFrame();
47 47
48 // Most subclasses use RenderPart (either RenderEmbeddedObject or RenderIFra me) 48 // Most subclasses use RenderPart (either RenderEmbeddedObject or RenderIFra me)
49 // except for HTMLObjectElement and HTMLEmbedElement which may return any 49 // except for HTMLObjectElement and HTMLEmbedElement which may return any
50 // RenderObject when using fallback content. 50 // RenderObject when using fallback content.
51 RenderPart* renderPart() const; 51 RenderPart* renderPart() const;
52 52
53 SVGDocument* getSVGDocument(ExceptionState&) const; 53 SVGDocument* getSVGDocument(ExceptionState&) const;
(...skipping 20 matching lines...) Expand all
74 virtual bool isFrameOwnerElement() const OVERRIDE { return true; } 74 virtual bool isFrameOwnerElement() const OVERRIDE { return true; }
75 75
76 Frame* m_contentFrame; 76 Frame* m_contentFrame;
77 SandboxFlags m_sandboxFlags; 77 SandboxFlags m_sandboxFlags;
78 }; 78 };
79 79
80 DEFINE_NODE_TYPE_CASTS(HTMLFrameOwnerElement, isFrameOwnerElement()); 80 DEFINE_NODE_TYPE_CASTS(HTMLFrameOwnerElement, isFrameOwnerElement());
81 81
82 class SubframeLoadingDisabler { 82 class SubframeLoadingDisabler {
83 public: 83 public:
84 explicit SubframeLoadingDisabler(Node* root) 84 explicit SubframeLoadingDisabler(Node& root)
85 : m_root(root) 85 : m_root(root)
86 { 86 {
87 disabledSubtreeRoots().add(m_root); 87 disabledSubtreeRoots().add(&m_root);
88 } 88 }
89 89
90 ~SubframeLoadingDisabler() 90 ~SubframeLoadingDisabler()
91 { 91 {
92 disabledSubtreeRoots().remove(m_root); 92 disabledSubtreeRoots().remove(&m_root);
93 } 93 }
94 94
95 static bool canLoadFrame(HTMLFrameOwnerElement* owner) 95 static bool canLoadFrame(HTMLFrameOwnerElement& owner)
96 { 96 {
97 for (Node* node = owner; node; node = node->parentOrShadowHostNode()) { 97 for (Node* node = &owner; node; node = node->parentOrShadowHostNode()) {
98 if (disabledSubtreeRoots().contains(node)) 98 if (disabledSubtreeRoots().contains(node))
99 return false; 99 return false;
100 } 100 }
101 return true; 101 return true;
102 } 102 }
103 103
104 private: 104 private:
105 static HashCountedSet<Node*>& disabledSubtreeRoots() 105 static HashCountedSet<Node*>& disabledSubtreeRoots()
106 { 106 {
107 DEFINE_STATIC_LOCAL(HashCountedSet<Node*>, nodes, ()); 107 DEFINE_STATIC_LOCAL(HashCountedSet<Node*>, nodes, ());
108 return nodes; 108 return nodes;
109 } 109 }
110 110
111 Node* m_root; 111 Node& m_root;
112 }; 112 };
113 113
114 } // namespace WebCore 114 } // namespace WebCore
115 115
116 #endif // HTMLFrameOwnerElement_h 116 #endif // HTMLFrameOwnerElement_h
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameElementBase.cpp ('k') | Source/core/html/HTMLFrameOwnerElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698