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

Side by Side Diff: Source/web/WebFrame.cpp

Issue 645623004: Reland "Streamline frame detach" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "public/web/WebFrame.h" 6 #include "public/web/WebFrame.h"
7 7
8 #include "core/frame/RemoteFrame.h" 8 #include "core/frame/RemoteFrame.h"
9 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
10 #include "platform/UserGestureIndicator.h" 10 #include "platform/UserGestureIndicator.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 m_opener->m_openedFrameTracker->add(frame); 67 m_opener->m_openedFrameTracker->add(frame);
68 swap(m_opener, frame->m_opener); 68 swap(m_opener, frame->m_opener);
69 } 69 }
70 if (!m_openedFrameTracker->isEmpty()) { 70 if (!m_openedFrameTracker->isEmpty()) {
71 m_openedFrameTracker->updateOpener(frame); 71 m_openedFrameTracker->updateOpener(frame);
72 frame->m_openedFrameTracker.reset(m_openedFrameTracker.release()); 72 frame->m_openedFrameTracker.reset(m_openedFrameTracker.release());
73 } 73 }
74 74
75 // Finally, clone the state of the current Frame into one matching 75 // Finally, clone the state of the current Frame into one matching
76 // the type of the passed in WebFrame. 76 // the type of the passed in WebFrame.
77 // FIXME: This is a bit clunky; this results in pointless decrements and
78 // increments of connected subframes.
79 FrameOwner* owner = oldFrame->owner(); 77 FrameOwner* owner = oldFrame->owner();
80 oldFrame->disconnectOwnerElement(); 78 if (frame->isWebLocalFrame())
81 if (frame->isWebLocalFrame()) {
82 toWebLocalFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name(), nullAtom); 79 toWebLocalFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name(), nullAtom);
83 } else { 80 else
84 toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner , oldFrame->tree().name()); 81 toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner , oldFrame->tree().name());
85 }
86 82
87 return true; 83 return true;
88 } 84 }
89 85
90 void WebFrame::detach() 86 void WebFrame::detach()
91 { 87 {
92 toCoreFrame(this)->detach(); 88 toCoreFrame(this)->detach();
93 } 89 }
94 90
95 WebFrame* WebFrame::opener() const 91 WebFrame* WebFrame::opener() const
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 256 }
261 257
262 void WebFrame::clearWeakFrames(Visitor* visitor) 258 void WebFrame::clearWeakFrames(Visitor* visitor)
263 { 259 {
264 if (!isFrameAlive(visitor, m_opener)) 260 if (!isFrameAlive(visitor, m_opener))
265 m_opener = nullptr; 261 m_opener = nullptr;
266 } 262 }
267 #endif 263 #endif
268 264
269 } // namespace blink 265 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698