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

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

Issue 1802953003: RemoteBridgeFrameOwner: keep better track of the attached frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Doing work in constructors is evil. Created 4 years, 9 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 // 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 "public/web/WebFrame.h" 5 #include "public/web/WebFrame.h"
6 6
7 #include "bindings/core/v8/WindowProxyManager.h" 7 #include "bindings/core/v8/WindowProxyManager.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (m_opener) { 65 if (m_opener) {
66 frame->setOpener(m_opener); 66 frame->setOpener(m_opener);
67 setOpener(nullptr); 67 setOpener(nullptr);
68 } 68 }
69 m_openedFrameTracker->transferTo(frame); 69 m_openedFrameTracker->transferTo(frame);
70 70
71 FrameHost* host = oldFrame->host(); 71 FrameHost* host = oldFrame->host();
72 AtomicString name = oldFrame->tree().name(); 72 AtomicString name = oldFrame->tree().name();
73 AtomicString uniqueName = oldFrame->tree().uniqueName(); 73 AtomicString uniqueName = oldFrame->tree().uniqueName();
74 FrameOwner* owner = oldFrame->owner(); 74 FrameOwner* owner = oldFrame->owner();
75 oldFrame->disconnectOwnerElement();
76 75
77 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); 76 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
78 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; 77 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals;
79 oldFrame->getWindowProxyManager()->clearForNavigation(); 78 oldFrame->getWindowProxyManager()->clearForNavigation();
80 oldFrame->getWindowProxyManager()->releaseGlobals(globals); 79 oldFrame->getWindowProxyManager()->releaseGlobals(globals);
81 80
82 // Although the Document in this frame is now unloaded, many resources 81 // Although the Document in this frame is now unloaded, many resources
83 // associated with the frame itself have not yet been freed yet. 82 // associated with the frame itself have not yet been freed yet.
84 oldFrame->detach(FrameDetachType::Swap); 83 oldFrame->detach(FrameDetachType::Swap);
85 84
86 // Finally, clone the state of the current Frame into one matching 85 // Clone the state of the current Frame into the one being swapped in.
87 // the type of the passed in WebFrame.
88 // FIXME: This is a bit clunky; this results in pointless decrements and 86 // FIXME: This is a bit clunky; this results in pointless decrements and
89 // increments of connected subframes. 87 // increments of connected subframes.
90 if (frame->isWebLocalFrame()) { 88 if (frame->isWebLocalFrame()) {
89 // TODO(dcheng): in an ideal world, both branches would just use
90 // WebFrameImplBase's initializeCoreFrame() helper. However, Blink
91 // currently requires a 'provisional' local frame to serve as a
92 // placeholder for loading state when swapping to a local frame.
93 // In this case, the core LocalFrame is already initialized, so just
94 // update a bit of state.
91 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); 95 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame();
92 ASSERT(owner == localFrame.owner()); 96 ASSERT(owner == localFrame.owner());
93 if (owner) { 97 if (owner) {
94 if (owner->isLocal()) { 98 owner->setContentFrame(localFrame);
95 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(ow ner); 99 if (owner->isLocal())
96 ownerElement->setContentFrame(localFrame); 100 toHTMLFrameOwnerElement(owner)->setWidget(localFrame.view());
97 ownerElement->setWidget(localFrame.view());
98 } else {
99 toRemoteBridgeFrameOwner(owner)->setContentFrame(toWebLocalFrame Impl(frame));
100 }
101 } else { 101 } else {
102 localFrame.page()->setMainFrame(&localFrame); 102 localFrame.page()->setMainFrame(&localFrame);
103 } 103 }
104 } else { 104 } else {
105 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq ueName); 105 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq ueName);
106 } 106 }
107 107
108 frame->toImplBase()->frame()->getWindowProxyManager()->setGlobals(globals); 108 frame->toImplBase()->frame()->getWindowProxyManager()->setGlobals(globals);
109 109
110 m_parent = nullptr; 110 m_parent = nullptr;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \ 357 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \
358 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); } 358 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); }
359 359
360 DEFINE_VISITOR_METHOD(Visitor*) 360 DEFINE_VISITOR_METHOD(Visitor*)
361 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) 361 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor)
362 362
363 #undef DEFINE_VISITOR_METHOD 363 #undef DEFINE_VISITOR_METHOD
364 #endif 364 #endif
365 365
366 } // namespace blink 366 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/RemoteBridgeFrameOwner.cpp ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698