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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 172063002: Unify frame IDs with RenderFrameHost routing IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 make_scoped_ptr(client)); 958 make_scoped_ptr(client));
959 } 959 }
960 960
961 void RenderFrameImpl::didAccessInitialDocument(blink::WebFrame* frame) { 961 void RenderFrameImpl::didAccessInitialDocument(blink::WebFrame* frame) {
962 render_view_->didAccessInitialDocument(frame); 962 render_view_->didAccessInitialDocument(frame);
963 } 963 }
964 964
965 blink::WebFrame* RenderFrameImpl::createChildFrame( 965 blink::WebFrame* RenderFrameImpl::createChildFrame(
966 blink::WebFrame* parent, 966 blink::WebFrame* parent,
967 const blink::WebString& name) { 967 const blink::WebString& name) {
968 long long child_frame_identifier = WebFrame::generateEmbedderIdentifier();
969 // Synchronously notify the browser of a child frame creation to get the 968 // Synchronously notify the browser of a child frame creation to get the
970 // routing_id for the RenderFrame. 969 // routing_id for the RenderFrame.
971 int routing_id = MSG_ROUTING_NONE; 970 int child_routing_id = MSG_ROUTING_NONE;
972 Send(new FrameHostMsg_CreateChildFrame(routing_id_, 971 Send(new FrameHostMsg_CreateChildFrame(routing_id_,
973 parent->identifier(),
974 child_frame_identifier,
975 base::UTF16ToUTF8(name), 972 base::UTF16ToUTF8(name),
976 &routing_id)); 973 &child_routing_id));
977 // Allocation of routing id failed, so we can't create a child frame. This can 974 // Allocation of routing id failed, so we can't create a child frame. This can
978 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 975 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
979 // out state. 976 // out state.
980 if (routing_id == MSG_ROUTING_NONE) { 977 if (child_routing_id == MSG_ROUTING_NONE) {
981 base::debug::Alias(parent); 978 base::debug::Alias(parent);
982 base::debug::Alias(&routing_id_); 979 base::debug::Alias(&routing_id_);
983 bool render_view_is_swapped_out = GetRenderWidget()->is_swapped_out(); 980 bool render_view_is_swapped_out = GetRenderWidget()->is_swapped_out();
984 base::debug::Alias(&render_view_is_swapped_out); 981 base::debug::Alias(&render_view_is_swapped_out);
985 bool render_view_is_closing = GetRenderWidget()->closing(); 982 bool render_view_is_closing = GetRenderWidget()->closing();
986 base::debug::Alias(&render_view_is_closing); 983 base::debug::Alias(&render_view_is_closing);
987 base::debug::Alias(&is_swapped_out_); 984 base::debug::Alias(&is_swapped_out_);
988 base::debug::DumpWithoutCrashing(); 985 base::debug::DumpWithoutCrashing();
989 return NULL; 986 return NULL;
990 } 987 }
991 988
992 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( 989 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(
993 render_view_.get(), routing_id); 990 render_view_.get(), child_routing_id);
994 blink::WebFrame* web_frame = WebFrame::create(child_render_frame, 991 blink::WebFrame* web_frame = WebFrame::create(child_render_frame,
995 child_frame_identifier); 992 child_routing_id);
996 parent->appendChild(web_frame); 993 parent->appendChild(web_frame);
997 child_render_frame->SetWebFrame(web_frame); 994 child_render_frame->SetWebFrame(web_frame);
998 995
999 return web_frame; 996 return web_frame;
1000 } 997 }
1001 998
1002 void RenderFrameImpl::didDisownOpener(blink::WebFrame* frame) { 999 void RenderFrameImpl::didDisownOpener(blink::WebFrame* frame) {
1003 render_view_->didDisownOpener(frame); 1000 render_view_->didDisownOpener(frame);
1004 } 1001 }
1005 1002
1006 void RenderFrameImpl::frameDetached(blink::WebFrame* frame) { 1003 void RenderFrameImpl::frameDetached(blink::WebFrame* frame) {
1007 // NOTE: This function is called on the frame that is being detached and not 1004 // NOTE: This function is called on the frame that is being detached and not
1008 // the parent frame. This is different from createChildFrame() which is 1005 // the parent frame. This is different from createChildFrame() which is
1009 // called on the parent frame. 1006 // called on the parent frame.
1010 CHECK(!is_detaching_); 1007 CHECK(!is_detaching_);
1011 1008
1012 bool is_subframe = !!frame->parent(); 1009 bool is_subframe = !!frame->parent();
1013 1010
1014 int64 parent_frame_id = -1; 1011 Send(new FrameHostMsg_Detach(routing_id_));
1015 if (is_subframe)
1016 parent_frame_id = frame->parent()->identifier();
1017
1018 Send(new FrameHostMsg_Detach(routing_id_, parent_frame_id,
1019 frame->identifier()));
1020 1012
1021 render_view_->UnregisterSwappedOutChildFrame(this); 1013 render_view_->UnregisterSwappedOutChildFrame(this);
1022 1014
1023 // The |is_detaching_| flag disables Send(). FrameHostMsg_Detach must be 1015 // The |is_detaching_| flag disables Send(). FrameHostMsg_Detach must be
1024 // sent before setting |is_detaching_| to true. In contrast, Observers 1016 // sent before setting |is_detaching_| to true. In contrast, Observers
1025 // should only be notified afterwards so they cannot call back into here and 1017 // should only be notified afterwards so they cannot call back into here and
1026 // have IPCs fired off. 1018 // have IPCs fired off.
1027 is_detaching_ = true; 1019 is_detaching_ = true;
1028 1020
1029 // Call back to RenderViewImpl for observers to be notified. 1021 // Call back to RenderViewImpl for observers to be notified.
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 2196
2205 void RenderFrameImpl::didStartLoading() { 2197 void RenderFrameImpl::didStartLoading() {
2206 Send(new FrameHostMsg_DidStartLoading(routing_id_)); 2198 Send(new FrameHostMsg_DidStartLoading(routing_id_));
2207 } 2199 }
2208 2200
2209 void RenderFrameImpl::didStopLoading() { 2201 void RenderFrameImpl::didStopLoading() {
2210 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 2202 Send(new FrameHostMsg_DidStopLoading(routing_id_));
2211 } 2203 }
2212 2204
2213 } // namespace content 2205 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698