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

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

Issue 1199313006: Disable support for swapped out RenderFrame(Host) on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 // static 536 // static
537 void RenderFrameImpl::CreateFrame( 537 void RenderFrameImpl::CreateFrame(
538 int routing_id, 538 int routing_id,
539 int parent_routing_id, 539 int parent_routing_id,
540 int previous_sibling_routing_id, 540 int previous_sibling_routing_id,
541 int proxy_routing_id, 541 int proxy_routing_id,
542 const FrameReplicationState& replicated_state, 542 const FrameReplicationState& replicated_state,
543 CompositorDependencies* compositor_deps, 543 CompositorDependencies* compositor_deps,
544 const FrameMsg_NewFrame_WidgetParams& widget_params) { 544 const FrameMsg_NewFrame_WidgetParams& widget_params) {
545 // TODO(nasko): For now, this message is only sent for subframes, as the
546 // top level frame is created when the RenderView is created through the
547 // ViewMsg_New IPC.
548 // CHECK_NE(MSG_ROUTING_NONE, parent_routing_id);
549
550 LOG(ERROR) << "RF::CreateFrame:"
551 << " routing_id:" << routing_id
552 << " parent:" << parent_routing_id
553 << " proxy:" << proxy_routing_id
554 << " sibling:" << previous_sibling_routing_id;
555
545 blink::WebLocalFrame* web_frame; 556 blink::WebLocalFrame* web_frame;
546 RenderFrameImpl* render_frame; 557 RenderFrameImpl* render_frame;
547 if (proxy_routing_id == MSG_ROUTING_NONE) { 558 if (proxy_routing_id == MSG_ROUTING_NONE) {
548 RenderFrameProxy* parent_proxy = 559 RenderFrameProxy* parent_proxy =
549 RenderFrameProxy::FromRoutingID(parent_routing_id); 560 RenderFrameProxy::FromRoutingID(parent_routing_id);
550 // If the browser is sending a valid parent routing id, it should already 561 // If the browser is sending a valid parent routing id, it should already
551 // be created and registered. 562 // be created and registered.
552 CHECK(parent_proxy); 563 CHECK(parent_proxy);
553 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); 564 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame();
554 565
555 blink::WebFrame* previous_sibling_web_frame = nullptr; 566 blink::WebFrame* previous_sibling_web_frame = nullptr;
556 RenderFrameProxy* previous_sibling_proxy = 567 RenderFrameProxy* previous_sibling_proxy =
557 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 568 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
558 if (previous_sibling_proxy) 569 if (previous_sibling_proxy)
559 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 570 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
560 571
561 // Create the RenderFrame and WebLocalFrame, linking the two. 572 // Create the RenderFrame and WebLocalFrame, linking the two.
562 render_frame = 573 render_frame =
563 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 574 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
564 web_frame = parent_web_frame->createLocalChild( 575 web_frame = parent_web_frame->createLocalChild(
565 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 576 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
566 replicated_state.sandbox_flags, render_frame, 577 replicated_state.sandbox_flags, render_frame,
567 previous_sibling_web_frame); 578 previous_sibling_web_frame);
568 } else { 579 } else {
569 RenderFrameProxy* proxy = 580 RenderFrameProxy* proxy =
570 RenderFrameProxy::FromRoutingID(proxy_routing_id); 581 RenderFrameProxy::FromRoutingID(proxy_routing_id);
571 CHECK(proxy); 582 CHECK(proxy);
583 LOG(ERROR) << "RF::CreateFrame:"
584 << " parent_routing_id:" << parent_routing_id
585 << " proxy->web_frame->parent():" << proxy->web_frame()->parent();
572 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 586 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
573 web_frame = 587 web_frame =
574 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 588 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
575 render_frame->proxy_routing_id_ = proxy_routing_id; 589 render_frame->proxy_routing_id_ = proxy_routing_id;
576 web_frame->initializeToReplaceRemoteFrame( 590 web_frame->initializeToReplaceRemoteFrame(
577 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 591 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
578 replicated_state.sandbox_flags); 592 replicated_state.sandbox_flags);
579 } 593 }
580 render_frame->SetWebFrame(web_frame); 594 render_frame->SetWebFrame(web_frame);
581 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); 595 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 #endif 664 #endif
651 devtools_agent_(nullptr), 665 devtools_agent_(nullptr),
652 geolocation_dispatcher_(NULL), 666 geolocation_dispatcher_(NULL),
653 push_messaging_dispatcher_(NULL), 667 push_messaging_dispatcher_(NULL),
654 presentation_dispatcher_(NULL), 668 presentation_dispatcher_(NULL),
655 screen_orientation_dispatcher_(NULL), 669 screen_orientation_dispatcher_(NULL),
656 manifest_manager_(NULL), 670 manifest_manager_(NULL),
657 accessibility_mode_(AccessibilityModeOff), 671 accessibility_mode_(AccessibilityModeOff),
658 renderer_accessibility_(NULL), 672 renderer_accessibility_(NULL),
659 weak_factory_(this) { 673 weak_factory_(this) {
674 LOG(ERROR) << "RF[" << this << "]::RF:"
675 << " routing_id:" << routing_id_;
676
660 std::pair<RoutingIDFrameMap::iterator, bool> result = 677 std::pair<RoutingIDFrameMap::iterator, bool> result =
661 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); 678 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
662 CHECK(result.second) << "Inserting a duplicate item."; 679 CHECK(result.second) << "Inserting a duplicate item.";
663 680
664 RenderThread::Get()->AddRoute(routing_id_, this); 681 RenderThread::Get()->AddRoute(routing_id_, this);
665 682
666 render_view_->RegisterRenderFrame(this); 683 render_view_->RegisterRenderFrame(this);
667 684
668 // Everything below subclasses RenderFrameObserver and is automatically 685 // Everything below subclasses RenderFrameObserver and is automatically
669 // deleted when the RenderFrame gets deleted. 686 // deleted when the RenderFrame gets deleted.
(...skipping 11 matching lines...) Expand all
681 RenderFrameImpl::~RenderFrameImpl() { 698 RenderFrameImpl::~RenderFrameImpl() {
682 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); 699 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone());
683 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); 700 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct());
684 701
685 #if defined(VIDEO_HOLE) 702 #if defined(VIDEO_HOLE)
686 if (contains_media_player_) 703 if (contains_media_player_)
687 render_view_->UnregisterVideoHoleFrame(this); 704 render_view_->UnregisterVideoHoleFrame(this);
688 #endif 705 #endif
689 706
690 if (!is_subframe_) { 707 if (!is_subframe_) {
691 // When not using --site-per-process, RenderFrameProxy is "owned" by
692 // RenderFrameImpl in the case it is the main frame. Ensure it is deleted
693 // along with this object.
694 if (render_frame_proxy_ &&
695 !base::CommandLine::ForCurrentProcess()->HasSwitch(
696 switches::kSitePerProcess)) {
697 // The following method calls back into this object and clears
698 // |render_frame_proxy_|.
699 render_frame_proxy_->frameDetached(
700 blink::WebRemoteFrameClient::DetachType::Remove);
701 }
702
703 // Ensure the RenderView doesn't point to this object, once it is destroyed. 708 // Ensure the RenderView doesn't point to this object, once it is destroyed.
704 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| 709 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_|
705 // is |this|, once the object is no longer leaked. 710 // is |this|, once the object is no longer leaked.
706 // See https://crbug.com/464764. 711 // See https://crbug.com/464764.
707 render_view_->main_render_frame_ = nullptr; 712 render_view_->main_render_frame_ = nullptr;
708 } 713 }
709 714
710 render_view_->UnregisterRenderFrame(this); 715 render_view_->UnregisterRenderFrame(this);
711 g_routing_id_frame_map.Get().erase(routing_id_); 716 g_routing_id_frame_map.Get().erase(routing_id_);
712 RenderThread::Get()->RemoveRoute(routing_id_); 717 RenderThread::Get()->RemoveRoute(routing_id_);
718 LOG(ERROR) << "RF[" << this << "]::~RF";
713 } 719 }
714 720
715 void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) { 721 void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) {
716 DCHECK(!frame_); 722 DCHECK(!frame_);
717 723
718 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( 724 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert(
719 std::make_pair(web_frame, this)); 725 std::make_pair(web_frame, this));
720 CHECK(result.second) << "Inserting a duplicate item."; 726 CHECK(result.second) << "Inserting a duplicate item.";
721 727
722 frame_ = web_frame; 728 frame_ = web_frame;
723 } 729 }
724 730
725 void RenderFrameImpl::Initialize() { 731 void RenderFrameImpl::Initialize() {
726 is_subframe_ = !!frame_->parent(); 732 is_subframe_ = !!frame_->parent();
727 is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame(); 733 is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame();
734 LOG(ERROR) << "RF[" << this << "]::Init:"
735 << " is_subframe_:" << is_subframe_
736 << " is_local_root_:" << is_local_root_
737 << " rv:" << render_view_.get();
728 738
729 #if defined(ENABLE_PLUGINS) 739 #if defined(ENABLE_PLUGINS)
730 new PepperBrowserConnection(this); 740 new PepperBrowserConnection(this);
731 #endif 741 #endif
732 new SharedWorkerRepository(this); 742 new SharedWorkerRepository(this);
733 743
734 if (!frame_->parent()) 744 if (!frame_->parent())
735 new ImageLoadingHelper(this); 745 new ImageLoadingHelper(this);
736 746
737 if (is_local_root_ && !render_frame_proxy_) { 747 if (is_local_root_ && !render_frame_proxy_) {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); 1112 base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
1103 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, 1113 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed,
1104 before_unload_start_time, 1114 before_unload_start_time,
1105 before_unload_end_time)); 1115 before_unload_end_time));
1106 } 1116 }
1107 1117
1108 void RenderFrameImpl::OnSwapOut( 1118 void RenderFrameImpl::OnSwapOut(
1109 int proxy_routing_id, 1119 int proxy_routing_id,
1110 bool is_loading, 1120 bool is_loading,
1111 const FrameReplicationState& replicated_frame_state) { 1121 const FrameReplicationState& replicated_frame_state) {
1122 LOG(ERROR) << "RF[" << this << "]::OnSwapOut:"
1123 << " proxy:" << proxy_routing_id
1124 << " is loading:" << is_loading;
1125
1112 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1126 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1113 RenderFrameProxy* proxy = NULL; 1127 RenderFrameProxy* proxy = NULL;
1114 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( 1128 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch(
1115 switches::kSitePerProcess); 1129 switches::kSitePerProcess);
1116 bool is_main_frame = !frame_->parent(); 1130 bool is_main_frame = !frame_->parent();
1131 bool swapped_out_forbidden = true;
1132
1133 // Chrome no longer supports swapped out RenderFrameImpl.
1134 // TODO(nasko): Remove this check and the associated boolean variable once
1135 // the removal work has had enough time to verify it works.
1136 CHECK(!is_swapped_out_);
1137
1138 // This codepath should only be hit for subframes when in --site-per-process.
1139 CHECK_IMPLIES(!is_main_frame, is_site_per_process);
1117 1140
1118 // Only run unload if we're not swapped out yet, but send the ack either way. 1141 // Only run unload if we're not swapped out yet, but send the ack either way.
1119 if (!is_swapped_out_) { 1142 if (!is_swapped_out_) {
1120 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1143 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1121 // a different process. This involves running the unload handler and 1144 // a different process. This involves running the unload handler and
1122 // clearing the page. We also allow this process to exit if there are no 1145 // clearing the page. We also allow this process to exit if there are no
1123 // other active RenderFrames in it. 1146 // other active RenderFrames in it.
1124 1147
1125 // Send an UpdateState message before we get swapped out. 1148 // Send an UpdateState message before we get swapped out.
1126 render_view_->SyncNavigationState(); 1149 render_view_->SyncNavigationState();
(...skipping 21 matching lines...) Expand all
1148 // willCheckAndDispatchMessageEvent() that needs the proxy. 1171 // willCheckAndDispatchMessageEvent() that needs the proxy.
1149 if (proxy) 1172 if (proxy)
1150 set_render_frame_proxy(proxy); 1173 set_render_frame_proxy(proxy);
1151 1174
1152 // Now that we're swapped out and filtering IPC messages, stop loading to 1175 // Now that we're swapped out and filtering IPC messages, stop loading to
1153 // ensure that no other in-progress navigation continues. We do this here 1176 // ensure that no other in-progress navigation continues. We do this here
1154 // to avoid sending a DidStopLoading message to the browser process. 1177 // to avoid sending a DidStopLoading message to the browser process.
1155 // TODO(creis): Should we be stopping all frames here and using 1178 // TODO(creis): Should we be stopping all frames here and using
1156 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this 1179 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this
1157 // frame? 1180 // frame?
1158 if (!is_site_per_process) 1181 if (!swapped_out_forbidden)
1159 OnStop(); 1182 OnStop();
1160 1183
1161 // Transfer settings such as initial drawing parameters to the remote frame, 1184 // Transfer settings such as initial drawing parameters to the remote frame,
1162 // if one is created, that will replace this frame. 1185 // if one is created, that will replace this frame.
1163 if (!is_main_frame && proxy) 1186 if (!is_main_frame && proxy)
1164 proxy->web_frame()->initializeFromFrame(frame_); 1187 proxy->web_frame()->initializeFromFrame(frame_);
1165 1188
1166 // Replace the page with a blank dummy URL. The unload handler will not be 1189 // Replace the page with a blank dummy URL. The unload handler will not be
1167 // run a second time, thanks to a check in FrameLoader::stopLoading. 1190 // run a second time, thanks to a check in FrameLoader::stopLoading.
1168 // TODO(creis): Need to add a better way to do this that avoids running the 1191 // TODO(creis): Need to add a better way to do this that avoids running the
1169 // beforeunload handler. For now, we just run it a second time silently. 1192 // beforeunload handler. For now, we just run it a second time silently.
1170 if (!is_site_per_process) 1193 if (!swapped_out_forbidden)
1171 NavigateToSwappedOutURL(); 1194 NavigateToSwappedOutURL();
1172 1195
1173 // Let WebKit know that this view is hidden so it can drop resources and 1196 // Let WebKit know that this view is hidden so it can drop resources and
1174 // stop compositing. 1197 // stop compositing.
1175 // TODO(creis): Support this for subframes as well. 1198 // TODO(creis): Support this for subframes as well.
1176 if (is_main_frame) { 1199 if (is_main_frame) {
1177 render_view_->webview()->setVisibilityState( 1200 render_view_->webview()->setVisibilityState(
1178 blink::WebPageVisibilityStateHidden, false); 1201 blink::WebPageVisibilityStateHidden, false);
1179 } 1202 }
1180 } 1203 }
1181 1204
1182 // It is now safe to show modal dialogs again. 1205 // It is now safe to show modal dialogs again.
1183 // TODO(creis): Deal with modal dialogs from subframes. 1206 // TODO(creis): Deal with modal dialogs from subframes.
1184 if (is_main_frame) 1207 if (is_main_frame)
1185 render_view_->suppress_dialogs_until_swap_out_ = false; 1208 render_view_->suppress_dialogs_until_swap_out_ = false;
1186 1209
1187 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); 1210 Send(new FrameHostMsg_SwapOut_ACK(routing_id_));
1188 1211
1189 RenderViewImpl* render_view = render_view_.get(); 1212 RenderViewImpl* render_view = render_view_.get();
1190 1213
1191 // Now that all of the cleanup is complete and the browser side is notified, 1214 // Now that all of the cleanup is complete and the browser side is notified,
1192 // start using the RenderFrameProxy, if one is created. 1215 // start using the RenderFrameProxy, if one is created.
1193 if (proxy) { 1216 if (proxy) {
1194 if (is_site_per_process || !is_main_frame) { 1217 if (swapped_out_forbidden) {
1195 frame_->swap(proxy->web_frame()); 1218 frame_->swap(proxy->web_frame());
1196 1219
1197 if (is_loading) 1220 if (is_loading)
1198 proxy->OnDidStartLoading(); 1221 proxy->OnDidStartLoading();
1199 } 1222 }
1200 } 1223 }
1201 1224
1202 // In --site-per-process, initialize the WebRemoteFrame with the replication 1225 // In --site-per-process, initialize the WebRemoteFrame with the replication
1203 // state passed by the process that is now rendering the frame. 1226 // state passed by the process that is now rendering the frame.
1204 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because 1227 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because
1205 // in that case we leave the LocalFrame as the main frame visible to Blink 1228 // in that case we leave the LocalFrame as the main frame visible to Blink
1206 // and don't call swap() above. Because swap() is what creates a RemoteFrame 1229 // and don't call swap() above. Because swap() is what creates a RemoteFrame
1207 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. 1230 // in proxy->web_frame(), the RemoteFrame will not exist for main frames.
1208 // When we do an unconditional swap for all frames, we can remove 1231 // When we do an unconditional swap for all frames, we can remove
1209 // !is_main_frame below. 1232 // !is_main_frame below.
1210 if (is_site_per_process && proxy) 1233 if (swapped_out_forbidden && proxy)
1211 proxy->SetReplicatedState(replicated_frame_state); 1234 proxy->SetReplicatedState(replicated_frame_state);
1212 1235
1213 // Safe to exit if no one else is using the process. 1236 // Safe to exit if no one else is using the process.
1214 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count 1237 // TODO(nasko): Remove the dependency on RenderViewImpl here and ref count
1215 // the process based on the lifetime of this RenderFrameImpl object. 1238 // the process based on the lifetime of this RenderFrameImpl object.
1216 if (is_main_frame) { 1239 if (is_main_frame) {
1217 render_view->WasSwappedOut(); 1240 render_view->WasSwappedOut();
1218 } 1241 }
1219 } 1242 }
1220 1243
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 } 1391 }
1369 1392
1370 void RenderFrameImpl::OnJavaScriptExecuteRequestForTests( 1393 void RenderFrameImpl::OnJavaScriptExecuteRequestForTests(
1371 const base::string16& jscript, 1394 const base::string16& jscript,
1372 int id, 1395 int id,
1373 bool notify_result, 1396 bool notify_result,
1374 bool has_user_gesture) { 1397 bool has_user_gesture) {
1375 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests", 1398 TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests",
1376 TRACE_EVENT_SCOPE_THREAD); 1399 TRACE_EVENT_SCOPE_THREAD);
1377 1400
1401 LOG(ERROR) << "RF[" << this << "]::OnJSExecForTests: "
1402 << " id:" << id
1403 << " script:|" << jscript << "|";
1404
1378 // A bunch of tests expect to run code in the context of a user gesture, which 1405 // A bunch of tests expect to run code in the context of a user gesture, which
1379 // can grant additional privileges (e.g. the ability to create popups). 1406 // can grant additional privileges (e.g. the ability to create popups).
1380 scoped_ptr<blink::WebScopedUserGesture> gesture( 1407 scoped_ptr<blink::WebScopedUserGesture> gesture(
1381 has_user_gesture ? new blink::WebScopedUserGesture : nullptr); 1408 has_user_gesture ? new blink::WebScopedUserGesture : nullptr);
1382 v8::HandleScope handle_scope(blink::mainThreadIsolate()); 1409 v8::HandleScope handle_scope(blink::mainThreadIsolate());
1383 v8::Local<v8::Value> result = 1410 v8::Local<v8::Value> result =
1384 frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); 1411 frame_->executeScriptAndReturnValue(WebScriptSource(jscript));
1385 1412
1386 HandleJavascriptExecutionResult(jscript, id, notify_result, result); 1413 HandleJavascriptExecutionResult(jscript, id, notify_result, result);
1387 } 1414 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 } 1567 }
1541 1568
1542 void RenderFrameImpl::OnSnapshotAccessibilityTree(int callback_id) { 1569 void RenderFrameImpl::OnSnapshotAccessibilityTree(int callback_id) {
1543 ui::AXTreeUpdate response; 1570 ui::AXTreeUpdate response;
1544 RendererAccessibility::SnapshotAccessibilityTree(this, &response); 1571 RendererAccessibility::SnapshotAccessibilityTree(this, &response);
1545 Send(new AccessibilityHostMsg_SnapshotResponse( 1572 Send(new AccessibilityHostMsg_SnapshotResponse(
1546 routing_id_, callback_id, response)); 1573 routing_id_, callback_id, response));
1547 } 1574 }
1548 1575
1549 void RenderFrameImpl::OnDisownOpener() { 1576 void RenderFrameImpl::OnDisownOpener() {
1577 LOG(ERROR) << "RF[" << this << "]::OnDisownOpener";
1550 // TODO(creis): We should only see this for main frames for now. To support 1578 // TODO(creis): We should only see this for main frames for now. To support
1551 // disowning the opener on subframes, we will need to move WebContentsImpl's 1579 // disowning the opener on subframes, we will need to move WebContentsImpl's
1552 // opener_ to FrameTreeNode. 1580 // opener_ to FrameTreeNode.
1553 CHECK(!frame_->parent()); 1581 CHECK(!frame_->parent());
1554 1582
1555 if (frame_->opener()) 1583 if (frame_->opener())
1556 frame_->setOpener(NULL); 1584 frame_->setOpener(NULL);
1557 } 1585 }
1558 1586
1559 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) { 1587 void RenderFrameImpl::OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 2143
2116 blink::WebFrame* RenderFrameImpl::createChildFrame( 2144 blink::WebFrame* RenderFrameImpl::createChildFrame(
2117 blink::WebLocalFrame* parent, 2145 blink::WebLocalFrame* parent,
2118 const blink::WebString& name, 2146 const blink::WebString& name,
2119 blink::WebSandboxFlags sandbox_flags) { 2147 blink::WebSandboxFlags sandbox_flags) {
2120 return createChildFrame(parent, blink::WebTreeScopeType::Document, name, 2148 return createChildFrame(parent, blink::WebTreeScopeType::Document, name,
2121 sandbox_flags); 2149 sandbox_flags);
2122 } 2150 }
2123 2151
2124 void RenderFrameImpl::didDisownOpener(blink::WebLocalFrame* frame) { 2152 void RenderFrameImpl::didDisownOpener(blink::WebLocalFrame* frame) {
2153 LOG(ERROR) << "RF[" << this << "]::didDisownOpener";
2154
2125 DCHECK(!frame_ || frame_ == frame); 2155 DCHECK(!frame_ || frame_ == frame);
2126 // 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
2127 // 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
2128 // 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
2129 // (yet) care about subframe openers. 2159 // (yet) care about subframe openers.
2130 if (is_swapped_out_ || frame->parent()) 2160 if (is_swapped_out_ || frame->parent()) {
2161 LOG(ERROR) << "RF[" << this << "]::didDisownOpener:"
2162 << " swapped_out:" << is_swapped_out_
2163 << " parent:" << frame->parent();
2131 return; 2164 return;
2165 }
2132 2166
2133 // Notify WebContents and all its swapped out RenderViews. 2167 // Notify WebContents and all its swapped out RenderViews.
2134 Send(new FrameHostMsg_DidDisownOpener(routing_id_)); 2168 Send(new FrameHostMsg_DidDisownOpener(routing_id_));
2135 } 2169 }
2136 2170
2137 void RenderFrameImpl::frameDetached(blink::WebFrame* frame) { 2171 void RenderFrameImpl::frameDetached(blink::WebFrame* frame) {
2138 frameDetached(frame, DetachType::Remove); 2172 frameDetached(frame, DetachType::Remove);
2139 } 2173 }
2140 2174
2141 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) { 2175 void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 2513
2480 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad", 2514 TRACE_EVENT2("navigation", "RenderFrameImpl::didStartProvisionalLoad",
2481 "id", routing_id_, "url", ds->request().url().string().utf8()); 2515 "id", routing_id_, "url", ds->request().url().string().utf8());
2482 DocumentState* document_state = DocumentState::FromDataSource(ds); 2516 DocumentState* document_state = DocumentState::FromDataSource(ds);
2483 2517
2484 // We should only navigate to swappedout:// when is_swapped_out_ is true. 2518 // We should only navigate to swappedout:// when is_swapped_out_ is true.
2485 CHECK((ds->request().url() != GURL(kSwappedOutURL)) || 2519 CHECK((ds->request().url() != GURL(kSwappedOutURL)) ||
2486 is_swapped_out_) << 2520 is_swapped_out_) <<
2487 "Heard swappedout:// when not swapped out."; 2521 "Heard swappedout:// when not swapped out.";
2488 2522
2523 LOG(ERROR) << "RF[" << this << "]::didStartProvLoad:"
2524 << " url:" << ds->request().url();
2525
2489 // Update the request time if WebKit has better knowledge of it. 2526 // Update the request time if WebKit has better knowledge of it.
2490 if (document_state->request_time().is_null() && 2527 if (document_state->request_time().is_null() &&
2491 triggering_event_time != 0.0) { 2528 triggering_event_time != 0.0) {
2492 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); 2529 document_state->set_request_time(Time::FromDoubleT(triggering_event_time));
2493 } 2530 }
2494 2531
2495 // Start time is only set after request time. 2532 // Start time is only set after request time.
2496 document_state->set_start_load_time(Time::Now()); 2533 document_state->set_start_load_time(Time::Now());
2497 2534
2498 bool is_top_most = !frame->parent(); 2535 bool is_top_most = !frame->parent();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 blink::WebHistoryCommitType commit_type) { 2620 blink::WebHistoryCommitType commit_type) {
2584 TRACE_EVENT2("navigation", "RenderFrameImpl::didCommitProvisionalLoad", 2621 TRACE_EVENT2("navigation", "RenderFrameImpl::didCommitProvisionalLoad",
2585 "id", routing_id_, 2622 "id", routing_id_,
2586 "url", GetLoadingUrl().possibly_invalid_spec()); 2623 "url", GetLoadingUrl().possibly_invalid_spec());
2587 DCHECK(!frame_ || frame_ == frame); 2624 DCHECK(!frame_ || frame_ == frame);
2588 DocumentState* document_state = 2625 DocumentState* document_state =
2589 DocumentState::FromDataSource(frame->dataSource()); 2626 DocumentState::FromDataSource(frame->dataSource());
2590 NavigationStateImpl* navigation_state = 2627 NavigationStateImpl* navigation_state =
2591 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 2628 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2592 2629
2630 LOG(ERROR) << "RF[" << this << "]::didCommitProvLoad:"
2631 << " url:" << GetLoadingUrl()
2632 << " proxy_routing_id_:" << proxy_routing_id_;
2633
2593 if (proxy_routing_id_ != MSG_ROUTING_NONE) { 2634 if (proxy_routing_id_ != MSG_ROUTING_NONE) {
2594 RenderFrameProxy* proxy = 2635 RenderFrameProxy* proxy =
2595 RenderFrameProxy::FromRoutingID(proxy_routing_id_); 2636 RenderFrameProxy::FromRoutingID(proxy_routing_id_);
2596 CHECK(proxy); 2637 CHECK(proxy);
2597 proxy->web_frame()->swap(frame_); 2638 proxy->web_frame()->swap(frame_);
2598 proxy_routing_id_ = MSG_ROUTING_NONE; 2639 proxy_routing_id_ = MSG_ROUTING_NONE;
2599 2640
2600 // If this is the main frame going from a remote frame to a local frame, 2641 // If this is the main frame going from a remote frame to a local frame,
2601 // it needs to set RenderViewImpl's pointer for the main frame to itself 2642 // it needs to set RenderViewImpl's pointer for the main frame to itself
2602 // and ensure RenderWidget is no longer in swapped out mode. 2643 // and ensure RenderWidget is no longer in swapped out mode.
2603 if (!is_subframe_) { 2644 if (!is_subframe_) {
2604 CHECK(!render_view_->main_render_frame_); 2645 CHECK(!render_view_->main_render_frame_);
2605 render_view_->main_render_frame_ = this; 2646 render_view_->main_render_frame_ = this;
2606 if (render_view_->is_swapped_out()) 2647 LOG(ERROR) << "RF[" << this << "]::didCommitProvLoad:"
2648 << " main frame, rv swapped_out:" << render_view_->is_swapped_out();
2649 if (render_view_->is_swapped_out()) {
2607 render_view_->SetSwappedOut(false); 2650 render_view_->SetSwappedOut(false);
2651 }
2608 } 2652 }
2609 } 2653 }
2610 2654
2611 // When we perform a new navigation, we need to update the last committed 2655 // When we perform a new navigation, we need to update the last committed
2612 // session history entry with state for the page we are leaving. Do this 2656 // session history entry with state for the page we are leaving. Do this
2613 // before updating the HistoryController state. 2657 // before updating the HistoryController state.
2614 render_view_->UpdateSessionHistory(frame); 2658 render_view_->UpdateSessionHistory(frame);
2615 2659
2616 render_view_->history_controller()->UpdateForCommit( 2660 render_view_->history_controller()->UpdateForCommit(
2617 this, item, commit_type, navigation_state->WasWithinSamePage()); 2661 this, item, commit_type, navigation_state->WasWithinSamePage());
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
4443 if (!browser_side_navigation) { 4487 if (!browser_side_navigation) {
4444 scoped_ptr<NavigationParams> navigation_params( 4488 scoped_ptr<NavigationParams> navigation_params(
4445 new NavigationParams(*pending_navigation_params_.get())); 4489 new NavigationParams(*pending_navigation_params_.get()));
4446 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 4490 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
4447 switches::kSitePerProcess)) { 4491 switches::kSitePerProcess)) {
4448 // By default, tell the HistoryController to go the deserialized 4492 // By default, tell the HistoryController to go the deserialized
4449 // HistoryEntry. This only works if all frames are in the same 4493 // HistoryEntry. This only works if all frames are in the same
4450 // process. 4494 // process.
4451 DCHECK(!frame_->parent()); 4495 DCHECK(!frame_->parent());
4452 render_view_->history_controller()->GoToEntry( 4496 render_view_->history_controller()->GoToEntry(
4453 entry.Pass(), navigation_params.Pass(), cache_policy); 4497 frame_, entry.Pass(), navigation_params.Pass(), cache_policy);
4454 } else { 4498 } else {
4455 // In --site-per-process, the browser process sends a single 4499 // In --site-per-process, the browser process sends a single
4456 // WebHistoryItem destined for this frame. 4500 // WebHistoryItem destined for this frame.
4457 // TODO(creis): Change PageState to FrameState. In the meantime, we 4501 // TODO(creis): Change PageState to FrameState. In the meantime, we
4458 // store the relevant frame's WebHistoryItem in the root of the 4502 // store the relevant frame's WebHistoryItem in the root of the
4459 // PageState. 4503 // PageState.
4460 SetPendingNavigationParams(navigation_params.Pass()); 4504 SetPendingNavigationParams(navigation_params.Pass());
4461 blink::WebHistoryItem history_item = entry->root(); 4505 blink::WebHistoryItem history_item = entry->root();
4462 blink::WebHistoryLoadType load_type = 4506 blink::WebHistoryLoadType load_type =
4463 request_params.is_same_document_history_load 4507 request_params.is_same_document_history_load
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
4970 #elif defined(ENABLE_BROWSER_CDMS) 5014 #elif defined(ENABLE_BROWSER_CDMS)
4971 cdm_manager_, 5015 cdm_manager_,
4972 #endif 5016 #endif
4973 this); 5017 this);
4974 } 5018 }
4975 5019
4976 return cdm_factory_; 5020 return cdm_factory_;
4977 } 5021 }
4978 5022
4979 } // namespace content 5023 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698