OLD | NEW |
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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 is_pasting_(false), | 1111 is_pasting_(false), |
1112 suppress_further_dialogs_(false), | 1112 suppress_further_dialogs_(false), |
1113 blame_context_(nullptr), | 1113 blame_context_(nullptr), |
1114 #if defined(ENABLE_PLUGINS) | 1114 #if defined(ENABLE_PLUGINS) |
1115 focused_pepper_plugin_(nullptr), | 1115 focused_pepper_plugin_(nullptr), |
1116 pepper_last_mouse_event_target_(nullptr), | 1116 pepper_last_mouse_event_target_(nullptr), |
1117 #endif | 1117 #endif |
1118 frame_binding_(this), | 1118 frame_binding_(this), |
1119 has_accessed_initial_document_(false), | 1119 has_accessed_initial_document_(false), |
1120 weak_factory_(this) { | 1120 weak_factory_(this) { |
| 1121 LOG(ERROR) << "RF[" << this << "]::RF: " |
| 1122 << " routing_id:" << routing_id_; |
| 1123 |
1121 // We don't have a service_manager::Connection at this point, so use nullptr. | 1124 // We don't have a service_manager::Connection at this point, so use nullptr. |
1122 // TODO(beng): We should fix this, so we can apply policy about which | 1125 // TODO(beng): We should fix this, so we can apply policy about which |
1123 // interfaces get exposed. | 1126 // interfaces get exposed. |
1124 interface_registry_.reset(new service_manager::InterfaceRegistry); | 1127 interface_registry_.reset(new service_manager::InterfaceRegistry); |
1125 service_manager::mojom::InterfaceProviderPtr remote_interfaces; | 1128 service_manager::mojom::InterfaceProviderPtr remote_interfaces; |
1126 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); | 1129 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); |
1127 remote_interfaces_.reset(new service_manager::InterfaceProvider); | 1130 remote_interfaces_.reset(new service_manager::InterfaceProvider); |
1128 remote_interfaces_->Bind(std::move(remote_interfaces)); | 1131 remote_interfaces_->Bind(std::move(remote_interfaces)); |
1129 blink_interface_provider_.reset(new BlinkInterfaceProviderImpl( | 1132 blink_interface_provider_.reset(new BlinkInterfaceProviderImpl( |
1130 remote_interfaces_->GetWeakPtr())); | 1133 remote_interfaces_->GetWeakPtr())); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 // Ensure the RenderView doesn't point to this object, once it is destroyed. | 1184 // Ensure the RenderView doesn't point to this object, once it is destroyed. |
1182 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| | 1185 // TODO(nasko): Add a check that the |main_render_frame_| of |render_view_| |
1183 // is |this|, once the object is no longer leaked. | 1186 // is |this|, once the object is no longer leaked. |
1184 // See https://crbug.com/464764. | 1187 // See https://crbug.com/464764. |
1185 render_view_->main_render_frame_ = nullptr; | 1188 render_view_->main_render_frame_ = nullptr; |
1186 } | 1189 } |
1187 | 1190 |
1188 render_view_->UnregisterRenderFrame(this); | 1191 render_view_->UnregisterRenderFrame(this); |
1189 g_routing_id_frame_map.Get().erase(routing_id_); | 1192 g_routing_id_frame_map.Get().erase(routing_id_); |
1190 RenderThread::Get()->RemoveRoute(routing_id_); | 1193 RenderThread::Get()->RemoveRoute(routing_id_); |
| 1194 LOG(ERROR) << "RF[" << this << "]::~RF"; |
1191 } | 1195 } |
1192 | 1196 |
1193 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) { | 1197 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) { |
1194 DCHECK(!frame_); | 1198 DCHECK(!frame_); |
1195 | 1199 |
1196 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( | 1200 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( |
1197 std::make_pair(web_frame, this)); | 1201 std::make_pair(web_frame, this)); |
1198 CHECK(result.second) << "Inserting a duplicate item."; | 1202 CHECK(result.second) << "Inserting a duplicate item."; |
1199 | 1203 |
1200 frame_ = web_frame; | 1204 frame_ = web_frame; |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 // the process based on the lifetime of this RenderFrameImpl object. | 1781 // the process based on the lifetime of this RenderFrameImpl object. |
1778 if (is_main_frame) | 1782 if (is_main_frame) |
1779 render_view->WasSwappedOut(); | 1783 render_view->WasSwappedOut(); |
1780 | 1784 |
1781 // Notify the browser that this frame was swapped. Use the RenderThread | 1785 // Notify the browser that this frame was swapped. Use the RenderThread |
1782 // directly because |this| is deleted. | 1786 // directly because |this| is deleted. |
1783 RenderThread::Get()->Send(new FrameHostMsg_SwapOut_ACK(routing_id)); | 1787 RenderThread::Get()->Send(new FrameHostMsg_SwapOut_ACK(routing_id)); |
1784 } | 1788 } |
1785 | 1789 |
1786 void RenderFrameImpl::OnDeleteFrame() { | 1790 void RenderFrameImpl::OnDeleteFrame() { |
| 1791 LOG(ERROR) << "RF[" << this << "]::OnDeleteFrame:"; |
| 1792 |
1787 // TODO(nasko): If this message is received right after a commit has | 1793 // TODO(nasko): If this message is received right after a commit has |
1788 // swapped a RenderFrameProxy with this RenderFrame, the proxy needs to be | 1794 // swapped a RenderFrameProxy with this RenderFrame, the proxy needs to be |
1789 // recreated in addition to the RenderFrame being deleted. | 1795 // recreated in addition to the RenderFrame being deleted. |
1790 // See https://crbug.com/569683 for details. | 1796 // See https://crbug.com/569683 for details. |
1791 in_browser_initiated_detach_ = true; | 1797 in_browser_initiated_detach_ = true; |
1792 | 1798 |
1793 // This will result in a call to RendeFrameImpl::frameDetached, which | 1799 // This will result in a call to RendeFrameImpl::frameDetached, which |
1794 // deletes the object. Do not access |this| after detach. | 1800 // deletes the object. Do not access |this| after detach. |
1795 frame_->detach(); | 1801 frame_->detach(); |
1796 } | 1802 } |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 DCHECK(!opener || opener->isWebLocalFrame()); | 2968 DCHECK(!opener || opener->isWebLocalFrame()); |
2963 | 2969 |
2964 int opener_routing_id = opener ? | 2970 int opener_routing_id = opener ? |
2965 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() : | 2971 RenderFrameImpl::FromWebFrame(opener->toWebLocalFrame())->GetRoutingID() : |
2966 MSG_ROUTING_NONE; | 2972 MSG_ROUTING_NONE; |
2967 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 2973 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
2968 } | 2974 } |
2969 | 2975 |
2970 void RenderFrameImpl::frameDetached(blink::WebLocalFrame* frame, | 2976 void RenderFrameImpl::frameDetached(blink::WebLocalFrame* frame, |
2971 DetachType type) { | 2977 DetachType type) { |
| 2978 LOG(ERROR) << "RF[" << this << "]::frameDetached: " |
| 2979 << " type:" << static_cast<int>(type); |
| 2980 |
2972 // NOTE: This function is called on the frame that is being detached and not | 2981 // NOTE: This function is called on the frame that is being detached and not |
2973 // the parent frame. This is different from createChildFrame() which is | 2982 // the parent frame. This is different from createChildFrame() which is |
2974 // called on the parent frame. | 2983 // called on the parent frame. |
2975 DCHECK_EQ(frame_, frame); | 2984 DCHECK_EQ(frame_, frame); |
2976 | 2985 |
2977 #if defined(ENABLE_PLUGINS) | 2986 #if defined(ENABLE_PLUGINS) |
2978 if (focused_pepper_plugin_) | 2987 if (focused_pepper_plugin_) |
2979 GetRenderWidget()->set_focused_pepper_plugin(nullptr); | 2988 GetRenderWidget()->set_focused_pepper_plugin(nullptr); |
2980 #endif | 2989 #endif |
2981 | 2990 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 // In fast/loader/stop-provisional-loads.html, we abort the load before this | 3337 // In fast/loader/stop-provisional-loads.html, we abort the load before this |
3329 // callback is invoked. | 3338 // callback is invoked. |
3330 if (!ds) | 3339 if (!ds) |
3331 return; | 3340 return; |
3332 | 3341 |
3333 TRACE_EVENT2("navigation,benchmark,rail", | 3342 TRACE_EVENT2("navigation,benchmark,rail", |
3334 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, | 3343 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, |
3335 "url", ds->request().url().string().utf8()); | 3344 "url", ds->request().url().string().utf8()); |
3336 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3345 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3337 | 3346 |
| 3347 LOG(ERROR) << "RF[" << this << "]::didStartProvisionalLoad: " |
| 3348 << " url:" << ds->request().url().string().utf8().substr(0, 250); |
| 3349 |
3338 // Update the request time if WebKit has better knowledge of it. | 3350 // Update the request time if WebKit has better knowledge of it. |
3339 if (document_state->request_time().is_null() && | 3351 if (document_state->request_time().is_null() && |
3340 triggering_event_time != 0.0) { | 3352 triggering_event_time != 0.0) { |
3341 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 3353 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); |
3342 } | 3354 } |
3343 | 3355 |
3344 // Start time is only set after request time. | 3356 // Start time is only set after request time. |
3345 document_state->set_start_load_time(Time::Now()); | 3357 document_state->set_start_load_time(Time::Now()); |
3346 | 3358 |
3347 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( | 3359 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( |
(...skipping 20 matching lines...) Expand all Loading... |
3368 observer.DidStartProvisionalLoad(); | 3380 observer.DidStartProvisionalLoad(); |
3369 | 3381 |
3370 Send(new FrameHostMsg_DidStartProvisionalLoad( | 3382 Send(new FrameHostMsg_DidStartProvisionalLoad( |
3371 routing_id_, ds->request().url(), navigation_start)); | 3383 routing_id_, ds->request().url(), navigation_start)); |
3372 } | 3384 } |
3373 | 3385 |
3374 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 3386 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
3375 blink::WebLocalFrame* frame) { | 3387 blink::WebLocalFrame* frame) { |
3376 DCHECK_EQ(frame_, frame); | 3388 DCHECK_EQ(frame_, frame); |
3377 | 3389 |
| 3390 LOG(ERROR) << "RF[" << this |
| 3391 << "]::didReceiveServerRedirectForProvisionalLoad:"; |
| 3392 |
3378 // We don't use HistoryController in OOPIF enabled modes. | 3393 // We don't use HistoryController in OOPIF enabled modes. |
3379 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 3394 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
3380 return; | 3395 return; |
3381 | 3396 |
3382 render_view_->history_controller()->RemoveChildrenForRedirect(this); | 3397 render_view_->history_controller()->RemoveChildrenForRedirect(this); |
3383 } | 3398 } |
3384 | 3399 |
3385 void RenderFrameImpl::didFailProvisionalLoad( | 3400 void RenderFrameImpl::didFailProvisionalLoad( |
3386 blink::WebLocalFrame* frame, | 3401 blink::WebLocalFrame* frame, |
3387 const blink::WebURLError& error, | 3402 const blink::WebURLError& error, |
3388 blink::WebHistoryCommitType commit_type) { | 3403 blink::WebHistoryCommitType commit_type) { |
3389 TRACE_EVENT1("navigation,benchmark,rail", | 3404 TRACE_EVENT1("navigation,benchmark,rail", |
3390 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); | 3405 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); |
3391 DCHECK_EQ(frame_, frame); | 3406 DCHECK_EQ(frame_, frame); |
3392 WebDataSource* ds = frame->provisionalDataSource(); | 3407 WebDataSource* ds = frame->provisionalDataSource(); |
3393 DCHECK(ds); | 3408 DCHECK(ds); |
3394 | 3409 |
| 3410 LOG(ERROR) << "RF[" << this << "]::didFailProvisionalLoad: " |
| 3411 << " url:" << ds->request().url().string().utf8().substr(0, 250); |
| 3412 |
3395 const WebURLRequest& failed_request = ds->request(); | 3413 const WebURLRequest& failed_request = ds->request(); |
3396 | 3414 |
3397 // Notify the browser that we failed a provisional load with an error. | 3415 // Notify the browser that we failed a provisional load with an error. |
3398 // | 3416 // |
3399 // Note: It is important this notification occur before DidStopLoading so the | 3417 // Note: It is important this notification occur before DidStopLoading so the |
3400 // SSL manager can react to the provisional load failure before being | 3418 // SSL manager can react to the provisional load failure before being |
3401 // notified the load stopped. | 3419 // notified the load stopped. |
3402 // | 3420 // |
3403 for (auto& observer : render_view_->observers()) | 3421 for (auto& observer : render_view_->observers()) |
3404 observer.DidFailProvisionalLoad(frame, error); | 3422 observer.DidFailProvisionalLoad(frame, error); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3493 // change at commit time. | 3511 // change at commit time. |
3494 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { | 3512 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { |
3495 is_using_lofi_ = extra_data && extra_data->is_using_lofi(); | 3513 is_using_lofi_ = extra_data && extra_data->is_using_lofi(); |
3496 if (extra_data) { | 3514 if (extra_data) { |
3497 effective_connection_type_ = | 3515 effective_connection_type_ = |
3498 EffectiveConnectionTypeToWebEffectiveConnectionType( | 3516 EffectiveConnectionTypeToWebEffectiveConnectionType( |
3499 extra_data->effective_connection_type()); | 3517 extra_data->effective_connection_type()); |
3500 } | 3518 } |
3501 } | 3519 } |
3502 | 3520 |
| 3521 LOG(ERROR) << "RF[" << this << "]::didCommitProvisionalLoad: " |
| 3522 << " url:" << GetLoadingUrl().spec().substr(0, 250); |
| 3523 |
3503 if (proxy_routing_id_ != MSG_ROUTING_NONE) { | 3524 if (proxy_routing_id_ != MSG_ROUTING_NONE) { |
3504 RenderFrameProxy* proxy = | 3525 RenderFrameProxy* proxy = |
3505 RenderFrameProxy::FromRoutingID(proxy_routing_id_); | 3526 RenderFrameProxy::FromRoutingID(proxy_routing_id_); |
3506 | 3527 |
3507 // The proxy might have been detached while the provisional LocalFrame was | 3528 // The proxy might have been detached while the provisional LocalFrame was |
3508 // being navigated. In that case, don't swap the frame back in the tree | 3529 // being navigated. In that case, don't swap the frame back in the tree |
3509 // and return early (to avoid sending confusing IPCs to the browser | 3530 // and return early (to avoid sending confusing IPCs to the browser |
3510 // process). See https://crbug.com/526304 and https://crbug.com/568676. | 3531 // process). See https://crbug.com/526304 and https://crbug.com/568676. |
3511 // TODO(nasko, alexmos): Eventually, the browser process will send an IPC | 3532 // TODO(nasko, alexmos): Eventually, the browser process will send an IPC |
3512 // to clean this frame up after https://crbug.com/548275 is fixed. | 3533 // to clean this frame up after https://crbug.com/548275 is fixed. |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3743 } | 3764 } |
3744 | 3765 |
3745 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { | 3766 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { |
3746 TRACE_EVENT1("navigation,benchmark,rail", | 3767 TRACE_EVENT1("navigation,benchmark,rail", |
3747 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); | 3768 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); |
3748 DCHECK_EQ(frame_, frame); | 3769 DCHECK_EQ(frame_, frame); |
3749 WebDataSource* ds = frame->dataSource(); | 3770 WebDataSource* ds = frame->dataSource(); |
3750 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3771 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3751 document_state->set_finish_document_load_time(Time::Now()); | 3772 document_state->set_finish_document_load_time(Time::Now()); |
3752 | 3773 |
| 3774 LOG(ERROR) << "RF[" << this << "]::didFinishDocumentLoad: " |
| 3775 << " url:" |
| 3776 << frame->document().url().string().utf8().substr(0, 250); |
| 3777 |
3753 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); | 3778 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); |
3754 | 3779 |
3755 for (auto& observer : render_view_->observers()) | 3780 for (auto& observer : render_view_->observers()) |
3756 observer.DidFinishDocumentLoad(frame); | 3781 observer.DidFinishDocumentLoad(frame); |
3757 for (auto& observer : observers_) | 3782 for (auto& observer : observers_) |
3758 observer.DidFinishDocumentLoad(); | 3783 observer.DidFinishDocumentLoad(); |
3759 | 3784 |
3760 // Check whether we have new encoding name. | 3785 // Check whether we have new encoding name. |
3761 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3786 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
3762 } | 3787 } |
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6568 // event target. Potentially a Pepper plugin will receive the event. | 6593 // event target. Potentially a Pepper plugin will receive the event. |
6569 // In order to tell whether a plugin gets the last mouse event and which it | 6594 // In order to tell whether a plugin gets the last mouse event and which it |
6570 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6595 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6571 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6596 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6572 // |pepper_last_mouse_event_target_|. | 6597 // |pepper_last_mouse_event_target_|. |
6573 pepper_last_mouse_event_target_ = nullptr; | 6598 pepper_last_mouse_event_target_ = nullptr; |
6574 #endif | 6599 #endif |
6575 } | 6600 } |
6576 | 6601 |
6577 } // namespace content | 6602 } // namespace content |
OLD | NEW |