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

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

Issue 1141283002: Replicate whether a frame is in a document or shadow tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 5 years, 7 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 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/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 blink::WebFrame* previous_sibling_web_frame = nullptr; 588 blink::WebFrame* previous_sibling_web_frame = nullptr;
589 RenderFrameProxy* previous_sibling_proxy = 589 RenderFrameProxy* previous_sibling_proxy =
590 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 590 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
591 if (previous_sibling_proxy) 591 if (previous_sibling_proxy)
592 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 592 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
593 593
594 // Create the RenderFrame and WebLocalFrame, linking the two. 594 // Create the RenderFrame and WebLocalFrame, linking the two.
595 render_frame = 595 render_frame =
596 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 596 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
597 web_frame = parent_web_frame->createLocalChild( 597 web_frame = parent_web_frame->createLocalChild(
598 WebString::fromUTF8(replicated_state.name), 598 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
599 ContentToWebSandboxFlags(replicated_state.sandbox_flags), render_frame, 599 ContentToWebSandboxFlags(replicated_state.sandbox_flags), render_frame,
600 previous_sibling_web_frame); 600 previous_sibling_web_frame);
601 } else { 601 } else {
602 RenderFrameProxy* proxy = 602 RenderFrameProxy* proxy =
603 RenderFrameProxy::FromRoutingID(proxy_routing_id); 603 RenderFrameProxy::FromRoutingID(proxy_routing_id);
604 CHECK(proxy); 604 CHECK(proxy);
605 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 605 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
606 web_frame = blink::WebLocalFrame::create(render_frame); 606 web_frame =
607 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
607 render_frame->proxy_routing_id_ = proxy_routing_id; 608 render_frame->proxy_routing_id_ = proxy_routing_id;
608 web_frame->initializeToReplaceRemoteFrame( 609 web_frame->initializeToReplaceRemoteFrame(
609 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 610 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
610 ContentToWebSandboxFlags(replicated_state.sandbox_flags)); 611 ContentToWebSandboxFlags(replicated_state.sandbox_flags));
611 } 612 }
612 render_frame->SetWebFrame(web_frame); 613 render_frame->SetWebFrame(web_frame);
613 614
614 if (widget_params.routing_id != MSG_ROUTING_NONE) { 615 if (widget_params.routing_id != MSG_ROUTING_NONE) {
615 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 616 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
616 switches::kSitePerProcess)); 617 switches::kSitePerProcess));
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 // a different process. This involves running the unload handler and 1158 // a different process. This involves running the unload handler and
1158 // clearing the page. We also allow this process to exit if there are no 1159 // clearing the page. We also allow this process to exit if there are no
1159 // other active RenderFrames in it. 1160 // other active RenderFrames in it.
1160 1161
1161 // Send an UpdateState message before we get swapped out. 1162 // Send an UpdateState message before we get swapped out.
1162 render_view_->SyncNavigationState(); 1163 render_view_->SyncNavigationState();
1163 1164
1164 // If we need a proxy to replace this, create it now so its routing id is 1165 // If we need a proxy to replace this, create it now so its routing id is
1165 // registered for receiving IPC messages. 1166 // registered for receiving IPC messages.
1166 if (proxy_routing_id != MSG_ROUTING_NONE) { 1167 if (proxy_routing_id != MSG_ROUTING_NONE) {
1167 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(this, 1168 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
1168 proxy_routing_id); 1169 this, proxy_routing_id, replicated_frame_state.scope);
1169 } 1170 }
1170 1171
1171 // Synchronously run the unload handler before sending the ACK. 1172 // Synchronously run the unload handler before sending the ACK.
1172 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support 1173 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support
1173 // unload on subframes as well. 1174 // unload on subframes as well.
1174 if (is_main_frame) 1175 if (is_main_frame)
1175 frame_->dispatchUnloadEvent(); 1176 frame_->dispatchUnloadEvent();
1176 1177
1177 // Swap out and stop sending any IPC messages that are not ACKs. 1178 // Swap out and stop sending any IPC messages that are not ACKs.
1178 if (is_main_frame) 1179 if (is_main_frame)
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 2104 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2104 2105
2105 if (!navigation_state->request_committed()) { 2106 if (!navigation_state->request_committed()) {
2106 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2107 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2107 } 2108 }
2108 } 2109 }
2109 } 2110 }
2110 2111
2111 blink::WebFrame* RenderFrameImpl::createChildFrame( 2112 blink::WebFrame* RenderFrameImpl::createChildFrame(
2112 blink::WebLocalFrame* parent, 2113 blink::WebLocalFrame* parent,
2114 blink::WebTreeScopeType scope,
2113 const blink::WebString& name, 2115 const blink::WebString& name,
2114 blink::WebSandboxFlags sandbox_flags) { 2116 blink::WebSandboxFlags sandbox_flags) {
2115 // Synchronously notify the browser of a child frame creation to get the 2117 // Synchronously notify the browser of a child frame creation to get the
2116 // routing_id for the RenderFrame. 2118 // routing_id for the RenderFrame.
2117 int child_routing_id = MSG_ROUTING_NONE; 2119 int child_routing_id = MSG_ROUTING_NONE;
2118 Send(new FrameHostMsg_CreateChildFrame( 2120 Send(new FrameHostMsg_CreateChildFrame(
2119 routing_id_, base::UTF16ToUTF8(name), 2121 routing_id_, scope, base::UTF16ToUTF8(name),
2120 WebToContentSandboxFlags(sandbox_flags), &child_routing_id)); 2122 WebToContentSandboxFlags(sandbox_flags), &child_routing_id));
2121 2123
2122 // Allocation of routing id failed, so we can't create a child frame. This can 2124 // Allocation of routing id failed, so we can't create a child frame. This can
2123 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2125 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2124 // out state or synchronous IPC message above has failed. 2126 // out state or synchronous IPC message above has failed.
2125 if (child_routing_id == MSG_ROUTING_NONE) { 2127 if (child_routing_id == MSG_ROUTING_NONE) {
2126 NOTREACHED() << "Failed to allocate routing id for child frame."; 2128 NOTREACHED() << "Failed to allocate routing id for child frame.";
2127 return nullptr; 2129 return nullptr;
2128 } 2130 }
2129 2131
2130 // Create the RenderFrame and WebLocalFrame, linking the two. 2132 // Create the RenderFrame and WebLocalFrame, linking the two.
2131 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( 2133 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(
2132 render_view_.get(), child_routing_id); 2134 render_view_.get(), child_routing_id);
2133 blink::WebLocalFrame* web_frame = WebLocalFrame::create(child_render_frame); 2135 blink::WebLocalFrame* web_frame =
2136 WebLocalFrame::create(scope, child_render_frame);
2134 child_render_frame->SetWebFrame(web_frame); 2137 child_render_frame->SetWebFrame(web_frame);
2135 2138
2136 // Add the frame to the frame tree and initialize it. 2139 // Add the frame to the frame tree and initialize it.
2137 parent->appendChild(web_frame); 2140 parent->appendChild(web_frame);
2138 child_render_frame->Initialize(); 2141 child_render_frame->Initialize();
2139 2142
2140 return web_frame; 2143 return web_frame;
2141 } 2144 }
2142 2145
2146 blink::WebFrame* RenderFrameImpl::createChildFrame(
2147 blink::WebLocalFrame* parent,
2148 const blink::WebString& name,
2149 blink::WebSandboxFlags sandbox_flags) {
2150 return createChildFrame(parent, blink::WebTreeScopeType::Document, name,
2151 sandbox_flags);
2152 }
2153
2143 void RenderFrameImpl::didDisownOpener(blink::WebLocalFrame* frame) { 2154 void RenderFrameImpl::didDisownOpener(blink::WebLocalFrame* frame) {
2144 DCHECK(!frame_ || frame_ == frame); 2155 DCHECK(!frame_ || frame_ == frame);
2145 // We only need to notify the browser if the active, top-level frame clears 2156 // We only need to notify the browser if the active, top-level frame clears
2146 // its opener. We can ignore cases where a swapped out frame clears its 2157 // its opener. We can ignore cases where a swapped out frame clears its
2147 // opener after hearing about it from the browser, and the browser does not 2158 // opener after hearing about it from the browser, and the browser does not
2148 // (yet) care about subframe openers. 2159 // (yet) care about subframe openers.
2149 if (is_swapped_out_ || frame->parent()) 2160 if (is_swapped_out_ || frame->parent())
2150 return; 2161 return;
2151 2162
2152 // Notify WebContents and all its swapped out RenderViews. 2163 // Notify WebContents and all its swapped out RenderViews.
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
4906 #elif defined(ENABLE_BROWSER_CDMS) 4917 #elif defined(ENABLE_BROWSER_CDMS)
4907 cdm_manager_, 4918 cdm_manager_,
4908 #endif 4919 #endif
4909 this); 4920 this);
4910 } 4921 }
4911 4922
4912 return cdm_factory_; 4923 return cdm_factory_;
4913 } 4924 }
4914 4925
4915 } // namespace content 4926 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698