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

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 642293004: Use C++11 range-based loop in core/frame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use meaningful names Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // frame object keep weak references to the frame; those will be 127 // frame object keep weak references to the frame; those will be
128 // automatically cleared by the garbage collector. Hence, explicit 128 // automatically cleared by the garbage collector. Hence, explicit
129 // frameDestroyed() notifications aren't needed. 129 // frameDestroyed() notifications aren't needed.
130 #else 130 #else
131 // FIXME: follow Oilpan and clear the FrameView and FrameLoader 131 // FIXME: follow Oilpan and clear the FrameView and FrameLoader
132 // during FrameOwner detachment instead, see LocalFrame::disconnectOwnerElem ent(). 132 // during FrameOwner detachment instead, see LocalFrame::disconnectOwnerElem ent().
133 setView(nullptr); 133 setView(nullptr);
134 m_loader.clear(); 134 m_loader.clear();
135 setDOMWindow(nullptr); 135 setDOMWindow(nullptr);
136 136
137 HashSet<RawPtr<FrameDestructionObserver> >::iterator stop = m_destructionObs ervers.end(); 137 for (const auto& frameDestructionObserver : m_destructionObservers)
138 for (HashSet<RawPtr<FrameDestructionObserver> >::iterator it = m_destruction Observers.begin(); it != stop; ++it) 138 frameDestructionObserver->frameDestroyed();
139 (*it)->frameDestroyed();
140 #endif 139 #endif
141 } 140 }
142 141
143 void LocalFrame::trace(Visitor* visitor) 142 void LocalFrame::trace(Visitor* visitor)
144 { 143 {
145 #if ENABLE(OILPAN) 144 #if ENABLE(OILPAN)
146 visitor->trace(m_destructionObservers); 145 visitor->trace(m_destructionObservers);
147 visitor->trace(m_loader); 146 visitor->trace(m_loader);
148 visitor->trace(m_navigationScheduler); 147 visitor->trace(m_navigationScheduler);
149 visitor->trace(m_view); 148 visitor->trace(m_view);
150 visitor->trace(m_pagePopupOwner); 149 visitor->trace(m_pagePopupOwner);
151 visitor->trace(m_script); 150 visitor->trace(m_script);
152 visitor->trace(m_editor); 151 visitor->trace(m_editor);
153 visitor->trace(m_spellChecker); 152 visitor->trace(m_spellChecker);
154 visitor->trace(m_selection); 153 visitor->trace(m_selection);
155 visitor->trace(m_eventHandler); 154 visitor->trace(m_eventHandler);
156 visitor->trace(m_console); 155 visitor->trace(m_console);
157 visitor->trace(m_inputMethodController); 156 visitor->trace(m_inputMethodController);
158 visitor->registerWeakMembers<LocalFrame, &LocalFrame::clearWeakMembers>(this ); 157 visitor->registerWeakMembers<LocalFrame, &LocalFrame::clearWeakMembers>(this );
159 HeapSupplementable<LocalFrame>::trace(visitor); 158 HeapSupplementable<LocalFrame>::trace(visitor);
160 #endif 159 #endif
161 Frame::trace(visitor); 160 Frame::trace(visitor);
162 } 161 }
163 162
164 #if ENABLE(OILPAN) 163 #if ENABLE(OILPAN)
165 void LocalFrame::clearWeakMembers(Visitor* visitor) 164 void LocalFrame::clearWeakMembers(Visitor* visitor)
166 { 165 {
167 Vector<HTMLPlugInElement*> deadPlugins; 166 Vector<HTMLPlugInElement*> deadPlugins;
168 for (HashSet<HTMLPlugInElement*>::const_iterator it = m_pluginElements.begin (); it != m_pluginElements.end(); ++it) { 167 for (const auto& pluginElement : m_pluginElements) {
169 if (!visitor->isAlive(*it)) { 168 if (!visitor->isAlive(pluginElement)) {
170 (*it)->shouldDisposePlugin(); 169 pluginElement->shouldDisposePlugin();
171 deadPlugins.append(*it); 170 deadPlugins.append(pluginElement);
172 } 171 }
173 } 172 }
174 for (unsigned i = 0; i < deadPlugins.size(); ++i) 173 for (unsigned i = 0; i < deadPlugins.size(); ++i)
175 m_pluginElements.remove(deadPlugins[i]); 174 m_pluginElements.remove(deadPlugins[i]);
176 } 175 }
177 #endif 176 #endif
178 177
179 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList) 178 void LocalFrame::navigate(Document& originDocument, const KURL& url, bool lockBa ckForwardList)
180 { 179 {
181 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList); 180 m_navigationScheduler.scheduleLocationChange(&originDocument, url.string(), lockBackForwardList);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 343
345 void LocalFrame::willDetachFrameHost() 344 void LocalFrame::willDetachFrameHost()
346 { 345 {
347 // We should never be detatching the page during a Layout. 346 // We should never be detatching the page during a Layout.
348 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout()); 347 RELEASE_ASSERT(!m_view || !m_view->isInPerformLayout());
349 348
350 Frame* parent = tree().parent(); 349 Frame* parent = tree().parent();
351 if (parent && parent->isLocalFrame()) 350 if (parent && parent->isLocalFrame())
352 toLocalFrame(parent)->loader().checkLoadComplete(); 351 toLocalFrame(parent)->loader().checkLoadComplete();
353 352
354 WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::iterat or stop = m_destructionObservers.end(); 353 for (const auto& frameDestructionObserver : m_destructionObservers)
355 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<FrameDestructionObserver> >::i terator it = m_destructionObservers.begin(); it != stop; ++it) 354 frameDestructionObserver->willDetachFrameHost();
356 (*it)->willDetachFrameHost();
357 355
358 // FIXME: Page should take care of updating focus/scrolling instead of Frame . 356 // FIXME: Page should take care of updating focus/scrolling instead of Frame .
359 // FIXME: It's unclear as to why this is called more than once, but it is, 357 // FIXME: It's unclear as to why this is called more than once, but it is,
360 // so page() could be null. 358 // so page() could be null.
361 if (page() && page()->focusController().focusedFrame() == this) 359 if (page() && page()->focusController().focusedFrame() == this)
362 page()->focusController().setFocusedFrame(nullptr); 360 page()->focusController().setFocusedFrame(nullptr);
363 script().clearScriptObjects(); 361 script().clearScriptObjects();
364 362
365 if (page() && page()->scrollingCoordinator() && m_view) 363 if (page() && page()->scrollingCoordinator() && m_view)
366 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get()); 364 page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 735 }
738 736
739 void LocalFrame::disconnectOwnerElement() 737 void LocalFrame::disconnectOwnerElement()
740 { 738 {
741 if (owner()) { 739 if (owner()) {
742 if (Document* document = this->document()) 740 if (Document* document = this->document())
743 document->topDocument().clearAXObjectCache(); 741 document->topDocument().clearAXObjectCache();
744 #if ENABLE(OILPAN) 742 #if ENABLE(OILPAN)
745 // First give the plugin elements holding persisted, 743 // First give the plugin elements holding persisted,
746 // renderer-less plugins the opportunity to dispose of them. 744 // renderer-less plugins the opportunity to dispose of them.
747 for (HashSet<HTMLPlugInElement*>::const_iterator it = m_pluginElements.b egin(); it != m_pluginElements.end(); ++it) 745 for (const auto& pluginElement : m_pluginElements)
748 (*it)->disconnectContentFrame(); 746 pluginElement->disconnectContentFrame();
749 m_pluginElements.clear(); 747 m_pluginElements.clear();
750 748
751 // Clear the FrameView and FrameLoader right here rather than 749 // Clear the FrameView and FrameLoader right here rather than
752 // during finalization. Too late to access various heap objects 750 // during finalization. Too late to access various heap objects
753 // at that stage. 751 // at that stage.
754 setView(nullptr); 752 setView(nullptr);
755 loader().clear(); 753 loader().clear();
756 #endif 754 #endif
757 } 755 }
758 Frame::disconnectOwnerElement(); 756 Frame::disconnectOwnerElement();
(...skipping 20 matching lines...) Expand all
779 } 777 }
780 778
781 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin) 779 void LocalFrame::unregisterPluginElement(HTMLPlugInElement* plugin)
782 { 780 {
783 ASSERT(m_pluginElements.contains(plugin)); 781 ASSERT(m_pluginElements.contains(plugin));
784 m_pluginElements.remove(plugin); 782 m_pluginElements.remove(plugin);
785 } 783 }
786 #endif 784 #endif
787 785
788 } // namespace blink 786 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698