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

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

Issue 346403002: Initialize WebCore::Frame when swapping frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests, less leaks Created 6 years, 5 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
« no previous file with comments | « Source/web/WebRemoteFrameImpl.h ('k') | Source/web/WebViewImpl.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 // 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 "web/WebRemoteFrameImpl.h" 6 #include "web/WebRemoteFrameImpl.h"
7 7
8 #include "core/frame/FrameOwner.h" 8 #include "core/frame/FrameOwner.h"
9 #include "core/frame/RemoteFrame.h" 9 #include "core/frame/RemoteFrame.h"
10 #include "core/page/Page.h" 10 #include "core/page/Page.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return true; 123 return true;
124 } 124 }
125 125
126 WebRemoteFrame* WebRemoteFrameImpl::toWebRemoteFrame() 126 WebRemoteFrame* WebRemoteFrameImpl::toWebRemoteFrame()
127 { 127 {
128 return this; 128 return this;
129 } 129 }
130 130
131 void WebRemoteFrameImpl::close() 131 void WebRemoteFrameImpl::close()
132 { 132 {
133 ASSERT_NOT_REACHED(); 133 deref();
134 } 134 }
135 135
136 WebString WebRemoteFrameImpl::uniqueName() const 136 WebString WebRemoteFrameImpl::uniqueName() const
137 { 137 {
138 ASSERT_NOT_REACHED(); 138 ASSERT_NOT_REACHED();
139 return WebString(); 139 return WebString();
140 } 140 }
141 141
142 WebString WebRemoteFrameImpl::assignedName() const 142 WebString WebRemoteFrameImpl::assignedName() const
143 { 143 {
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) 786 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client)
787 { 787 {
788 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); 788 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) );
789 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = 789 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result =
790 m_ownersForChildren.add(child, adoptPtr(new RemoteBridgeFrameOwner(child ))); 790 m_ownersForChildren.add(child, adoptPtr(new RemoteBridgeFrameOwner(child )));
791 appendChild(child); 791 appendChild(child);
792 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may 792 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may
793 // result in the browser observing two navigations to about:blank (one from the initial 793 // result in the browser observing two navigations to about:blank (one from the initial
794 // frame creation, and one from swapping it into the remote process). FrameL oader might 794 // frame creation, and one from swapping it into the remote process). FrameL oader might
795 // need a special initialization function for this case to avoid that duplic ate navigation. 795 // need a special initialization function for this case to avoid that duplic ate navigation.
796 child->initializeAsChildFrame(frame()->host(), result.storedValue->value.get (), name, AtomicString()); 796 child->initializeWebCoreFrame(frame()->host(), result.storedValue->value.get (), name, nullAtom);
797 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, 797 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However,
798 // if the parent is remote, it should never be detached synchronously... 798 // if the parent is remote, it should never be detached synchronously...
799 ASSERT(child->frame()); 799 ASSERT(child->frame());
800 return child; 800 return child;
801 } 801 }
802 802
803 void WebRemoteFrameImpl::initializeAsMainFrame(Page* page) 803 void WebRemoteFrameImpl::initializeWebCoreFrame(FrameHost* host, FrameOwner* own er, const AtomicString& name)
804 { 804 {
805 setWebCoreFrame(RemoteFrame::create(&m_frameClient, &page->frameHost(), 0)); 805 setWebCoreFrame(RemoteFrame::create(&m_frameClient, host, owner));
806 m_frame->tree().setName(name, nullAtom);
806 } 807 }
807 808
808 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web FrameClient* client) 809 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web FrameClient* client)
809 { 810 {
810 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie nt)); 811 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie nt));
811 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = 812 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result =
812 m_ownersForChildren.add(child, adoptPtr(new PlaceholderFrameOwner)); 813 m_ownersForChildren.add(child, adoptPtr(new PlaceholderFrameOwner));
813 appendChild(child); 814 appendChild(child);
814 RefPtr<RemoteFrame> childFrame = RemoteFrame::create(&child->m_frameClient, frame()->host(), result.storedValue->value.get()); 815 child->initializeWebCoreFrame(frame()->host(), result.storedValue->value.get (), name);
815 child->setWebCoreFrame(childFrame);
816 childFrame->tree().setName(name, AtomicString());
817 return child; 816 return child;
818 } 817 }
819 818
820 void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame) 819 void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame)
821 { 820 {
822 m_frame = frame; 821 m_frame = frame;
823 } 822 }
824 823
825 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) 824 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame)
826 { 825 {
827 if (!frame.client()) 826 if (!frame.client())
828 return 0; 827 return 0;
829 return static_cast<RemoteFrameClient*>(frame.client())->webFrame(); 828 return static_cast<RemoteFrameClient*>(frame.client())->webFrame();
830 } 829 }
831 830
832 } // namespace blink 831 } // namespace blink
833 832
OLDNEW
« no previous file with comments | « Source/web/WebRemoteFrameImpl.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698