| 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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 void RenderFrameImpl::Initialize() { | 1164 void RenderFrameImpl::Initialize() { |
| 1165 is_main_frame_ = !frame_->parent(); | 1165 is_main_frame_ = !frame_->parent(); |
| 1166 | 1166 |
| 1167 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( | 1167 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( |
| 1168 frame_->parent()); | 1168 frame_->parent()); |
| 1169 if (parent_frame) { | 1169 if (parent_frame) { |
| 1170 is_using_lofi_ = parent_frame->IsUsingLoFi(); | 1170 is_using_lofi_ = parent_frame->IsUsingLoFi(); |
| 1171 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); | 1171 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 bool is_tracing = false; | 1174 bool is_tracing_rail = false; |
| 1175 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing); | 1175 bool is_tracing_navigation = false; |
| 1176 if (is_tracing) { | 1176 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); |
| 1177 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); |
| 1178 if (is_tracing_rail || is_tracing_navigation) { |
| 1177 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); | 1179 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); |
| 1178 TRACE_EVENT2("navigation", "RenderFrameImpl::Initialize", | 1180 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::Initialize", |
| 1179 "id", routing_id_, | 1181 "id", routing_id_, |
| 1180 "parent", parent_id); | 1182 "parent", parent_id); |
| 1181 } | 1183 } |
| 1182 | 1184 |
| 1183 MaybeEnableMojoBindings(); | 1185 MaybeEnableMojoBindings(); |
| 1184 | 1186 |
| 1185 #if defined(ENABLE_PLUGINS) | 1187 #if defined(ENABLE_PLUGINS) |
| 1186 new PepperBrowserConnection(this); | 1188 new PepperBrowserConnection(this); |
| 1187 #endif | 1189 #endif |
| 1188 new SharedWorkerRepository(this); | 1190 new SharedWorkerRepository(this); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 RenderFrameProxy::FromRoutingID(proxy_routing_id_); | 1571 RenderFrameProxy::FromRoutingID(proxy_routing_id_); |
| 1570 if (!proxy) | 1572 if (!proxy) |
| 1571 return; | 1573 return; |
| 1572 } | 1574 } |
| 1573 | 1575 |
| 1574 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 1576 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 1575 // Can be NULL in tests. | 1577 // Can be NULL in tests. |
| 1576 if (render_thread_impl) | 1578 if (render_thread_impl) |
| 1577 render_thread_impl->GetRendererScheduler()->OnNavigationStarted(); | 1579 render_thread_impl->GetRendererScheduler()->OnNavigationStarted(); |
| 1578 DCHECK(!IsBrowserSideNavigationEnabled()); | 1580 DCHECK(!IsBrowserSideNavigationEnabled()); |
| 1579 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, | 1581 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::OnNavigate", "id", |
| 1580 "url", common_params.url.possibly_invalid_spec()); | 1582 routing_id_, "url", common_params.url.possibly_invalid_spec()); |
| 1581 NavigateInternal(common_params, start_params, request_params, | 1583 NavigateInternal(common_params, start_params, request_params, |
| 1582 std::unique_ptr<StreamOverrideParameters>()); | 1584 std::unique_ptr<StreamOverrideParameters>()); |
| 1583 } | 1585 } |
| 1584 | 1586 |
| 1585 void RenderFrameImpl::Bind(mojom::FrameRequest request, | 1587 void RenderFrameImpl::Bind(mojom::FrameRequest request, |
| 1586 mojom::FrameHostPtr host) { | 1588 mojom::FrameHostPtr host) { |
| 1587 frame_binding_.Bind(std::move(request)); | 1589 frame_binding_.Bind(std::move(request)); |
| 1588 frame_host_ = std::move(host); | 1590 frame_host_ = std::move(host); |
| 1589 frame_host_->GetInterfaceProvider( | 1591 frame_host_->GetInterfaceProvider( |
| 1590 std::move(pending_remote_interface_provider_request_)); | 1592 std::move(pending_remote_interface_provider_request_)); |
| 1591 } | 1593 } |
| 1592 | 1594 |
| 1593 ManifestManager* RenderFrameImpl::manifest_manager() { | 1595 ManifestManager* RenderFrameImpl::manifest_manager() { |
| 1594 return manifest_manager_; | 1596 return manifest_manager_; |
| 1595 } | 1597 } |
| 1596 | 1598 |
| 1597 void RenderFrameImpl::SetPendingNavigationParams( | 1599 void RenderFrameImpl::SetPendingNavigationParams( |
| 1598 std::unique_ptr<NavigationParams> navigation_params) { | 1600 std::unique_ptr<NavigationParams> navigation_params) { |
| 1599 pending_navigation_params_ = std::move(navigation_params); | 1601 pending_navigation_params_ = std::move(navigation_params); |
| 1600 } | 1602 } |
| 1601 | 1603 |
| 1602 void RenderFrameImpl::OnBeforeUnload(bool is_reload) { | 1604 void RenderFrameImpl::OnBeforeUnload(bool is_reload) { |
| 1603 TRACE_EVENT1("navigation", "RenderFrameImpl::OnBeforeUnload", | 1605 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::OnBeforeUnload", |
| 1604 "id", routing_id_); | 1606 "id", routing_id_); |
| 1605 // TODO(creis): Right now, this is only called on the main frame. Make the | 1607 // TODO(creis): Right now, this is only called on the main frame. Make the |
| 1606 // browser process send dispatchBeforeUnloadEvent to every frame that needs | 1608 // browser process send dispatchBeforeUnloadEvent to every frame that needs |
| 1607 // it. | 1609 // it. |
| 1608 CHECK(!frame_->parent()); | 1610 CHECK(!frame_->parent()); |
| 1609 | 1611 |
| 1610 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); | 1612 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); |
| 1611 bool proceed = frame_->dispatchBeforeUnloadEvent(is_reload); | 1613 bool proceed = frame_->dispatchBeforeUnloadEvent(is_reload); |
| 1612 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); | 1614 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); |
| 1613 Send(new FrameHostMsg_BeforeUnload_ACK( | 1615 Send(new FrameHostMsg_BeforeUnload_ACK( |
| 1614 routing_id_, proceed, before_unload_start_time, before_unload_end_time)); | 1616 routing_id_, proceed, before_unload_start_time, before_unload_end_time)); |
| 1615 } | 1617 } |
| 1616 | 1618 |
| 1617 void RenderFrameImpl::OnSwapOut( | 1619 void RenderFrameImpl::OnSwapOut( |
| 1618 int proxy_routing_id, | 1620 int proxy_routing_id, |
| 1619 bool is_loading, | 1621 bool is_loading, |
| 1620 const FrameReplicationState& replicated_frame_state) { | 1622 const FrameReplicationState& replicated_frame_state) { |
| 1621 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); | 1623 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::OnSwapOut", |
| 1624 "id", routing_id_); |
| 1622 RenderFrameProxy* proxy = NULL; | 1625 RenderFrameProxy* proxy = NULL; |
| 1623 | 1626 |
| 1624 // This codepath should only be hit for subframes when in --site-per-process. | 1627 // This codepath should only be hit for subframes when in --site-per-process. |
| 1625 CHECK(is_main_frame_ || SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 1628 CHECK(is_main_frame_ || SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
| 1626 | 1629 |
| 1627 // Swap this RenderFrame out so the frame can navigate to a page rendered by | 1630 // Swap this RenderFrame out so the frame can navigate to a page rendered by |
| 1628 // a different process. This involves running the unload handler and | 1631 // a different process. This involves running the unload handler and |
| 1629 // clearing the page. We also allow this process to exit if there are no | 1632 // clearing the page. We also allow this process to exit if there are no |
| 1630 // other active RenderFrames in it. | 1633 // other active RenderFrames in it. |
| 1631 | 1634 |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 // happen if the synchronous IPC message above has failed. This can | 2777 // happen if the synchronous IPC message above has failed. This can |
| 2775 // legitimately happen when the browser process has already destroyed | 2778 // legitimately happen when the browser process has already destroyed |
| 2776 // RenderProcessHost, but the renderer process hasn't quit yet. | 2779 // RenderProcessHost, but the renderer process hasn't quit yet. |
| 2777 if (child_routing_id == MSG_ROUTING_NONE) | 2780 if (child_routing_id == MSG_ROUTING_NONE) |
| 2778 return nullptr; | 2781 return nullptr; |
| 2779 | 2782 |
| 2780 // This method is always called by local frames, never remote frames. | 2783 // This method is always called by local frames, never remote frames. |
| 2781 | 2784 |
| 2782 // Tracing analysis uses this to find main frames when this value is | 2785 // Tracing analysis uses this to find main frames when this value is |
| 2783 // MSG_ROUTING_NONE, and build the frame tree otherwise. | 2786 // MSG_ROUTING_NONE, and build the frame tree otherwise. |
| 2784 TRACE_EVENT2("navigation", "RenderFrameImpl::createChildFrame", | 2787 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::createChildFrame", |
| 2785 "id", routing_id_, | 2788 "id", routing_id_, |
| 2786 "child", child_routing_id); | 2789 "child", child_routing_id); |
| 2787 | 2790 |
| 2788 // Create the RenderFrame and WebLocalFrame, linking the two. | 2791 // Create the RenderFrame and WebLocalFrame, linking the two. |
| 2789 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( | 2792 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( |
| 2790 render_view_.get(), child_routing_id); | 2793 render_view_.get(), child_routing_id); |
| 2791 child_render_frame->InitializeBlameContext(this); | 2794 child_render_frame->InitializeBlameContext(this); |
| 2792 blink::WebLocalFrame* web_frame = | 2795 blink::WebLocalFrame* web_frame = |
| 2793 WebLocalFrame::create(scope, child_render_frame); | 2796 WebLocalFrame::create(scope, child_render_frame); |
| 2794 child_render_frame->BindToWebFrame(web_frame); | 2797 child_render_frame->BindToWebFrame(web_frame); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, | 3160 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| 3158 double triggering_event_time) { | 3161 double triggering_event_time) { |
| 3159 DCHECK_EQ(frame_, frame); | 3162 DCHECK_EQ(frame_, frame); |
| 3160 WebDataSource* ds = frame->provisionalDataSource(); | 3163 WebDataSource* ds = frame->provisionalDataSource(); |
| 3161 | 3164 |
| 3162 // In fast/loader/stop-provisional-loads.html, we abort the load before this | 3165 // In fast/loader/stop-provisional-loads.html, we abort the load before this |
| 3163 // callback is invoked. | 3166 // callback is invoked. |
| 3164 if (!ds) | 3167 if (!ds) |
| 3165 return; | 3168 return; |
| 3166 | 3169 |
| 3167 TRACE_EVENT2("navigation,benchmark", | 3170 TRACE_EVENT2("navigation,benchmark,rail", |
| 3168 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, | 3171 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, |
| 3169 "url", ds->request().url().string().utf8()); | 3172 "url", ds->request().url().string().utf8()); |
| 3170 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3173 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3171 | 3174 |
| 3172 // Update the request time if WebKit has better knowledge of it. | 3175 // Update the request time if WebKit has better knowledge of it. |
| 3173 if (document_state->request_time().is_null() && | 3176 if (document_state->request_time().is_null() && |
| 3174 triggering_event_time != 0.0) { | 3177 triggering_event_time != 0.0) { |
| 3175 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 3178 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); |
| 3176 } | 3179 } |
| 3177 | 3180 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 3215 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 3213 return; | 3216 return; |
| 3214 | 3217 |
| 3215 render_view_->history_controller()->RemoveChildrenForRedirect(this); | 3218 render_view_->history_controller()->RemoveChildrenForRedirect(this); |
| 3216 } | 3219 } |
| 3217 | 3220 |
| 3218 void RenderFrameImpl::didFailProvisionalLoad( | 3221 void RenderFrameImpl::didFailProvisionalLoad( |
| 3219 blink::WebLocalFrame* frame, | 3222 blink::WebLocalFrame* frame, |
| 3220 const blink::WebURLError& error, | 3223 const blink::WebURLError& error, |
| 3221 blink::WebHistoryCommitType commit_type) { | 3224 blink::WebHistoryCommitType commit_type) { |
| 3222 TRACE_EVENT1("navigation,benchmark", | 3225 TRACE_EVENT1("navigation,benchmark,rail", |
| 3223 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); | 3226 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); |
| 3224 DCHECK_EQ(frame_, frame); | 3227 DCHECK_EQ(frame_, frame); |
| 3225 WebDataSource* ds = frame->provisionalDataSource(); | 3228 WebDataSource* ds = frame->provisionalDataSource(); |
| 3226 DCHECK(ds); | 3229 DCHECK(ds); |
| 3227 | 3230 |
| 3228 const WebURLRequest& failed_request = ds->request(); | 3231 const WebURLRequest& failed_request = ds->request(); |
| 3229 | 3232 |
| 3230 // Notify the browser that we failed a provisional load with an error. | 3233 // Notify the browser that we failed a provisional load with an error. |
| 3231 // | 3234 // |
| 3232 // Note: It is important this notification occur before DidStopLoading so the | 3235 // Note: It is important this notification occur before DidStopLoading so the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 } | 3270 } |
| 3268 | 3271 |
| 3269 // Load an error page. | 3272 // Load an error page. |
| 3270 LoadNavigationErrorPage(failed_request, error, replace); | 3273 LoadNavigationErrorPage(failed_request, error, replace); |
| 3271 } | 3274 } |
| 3272 | 3275 |
| 3273 void RenderFrameImpl::didCommitProvisionalLoad( | 3276 void RenderFrameImpl::didCommitProvisionalLoad( |
| 3274 blink::WebLocalFrame* frame, | 3277 blink::WebLocalFrame* frame, |
| 3275 const blink::WebHistoryItem& item, | 3278 const blink::WebHistoryItem& item, |
| 3276 blink::WebHistoryCommitType commit_type) { | 3279 blink::WebHistoryCommitType commit_type) { |
| 3277 TRACE_EVENT2("navigation", "RenderFrameImpl::didCommitProvisionalLoad", | 3280 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::didCommitProvisionalLoad", |
| 3278 "id", routing_id_, | 3281 "id", routing_id_, |
| 3279 "url", GetLoadingUrl().possibly_invalid_spec()); | 3282 "url", GetLoadingUrl().possibly_invalid_spec()); |
| 3280 DCHECK_EQ(frame_, frame); | 3283 DCHECK_EQ(frame_, frame); |
| 3281 DocumentState* document_state = | 3284 DocumentState* document_state = |
| 3282 DocumentState::FromDataSource(frame->dataSource()); | 3285 DocumentState::FromDataSource(frame->dataSource()); |
| 3283 NavigationStateImpl* navigation_state = | 3286 NavigationStateImpl* navigation_state = |
| 3284 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3287 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 3285 WebURLResponseExtraDataImpl* extra_data = | 3288 WebURLResponseExtraDataImpl* extra_data = |
| 3286 GetExtraDataFromResponse(frame->dataSource()->response()); | 3289 GetExtraDataFromResponse(frame->dataSource()->response()); |
| 3287 // Only update the Lo-Fi and effective connection type states for new main | 3290 // Only update the Lo-Fi and effective connection type states for new main |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3547 } | 3550 } |
| 3548 | 3551 |
| 3549 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, | 3552 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, |
| 3550 blink::WebIconURL::Type icon_type) { | 3553 blink::WebIconURL::Type icon_type) { |
| 3551 DCHECK_EQ(frame_, frame); | 3554 DCHECK_EQ(frame_, frame); |
| 3552 // TODO(nasko): Investigate wheather implementation should move here. | 3555 // TODO(nasko): Investigate wheather implementation should move here. |
| 3553 render_view_->didChangeIcon(frame, icon_type); | 3556 render_view_->didChangeIcon(frame, icon_type); |
| 3554 } | 3557 } |
| 3555 | 3558 |
| 3556 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { | 3559 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { |
| 3557 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishDocumentLoad", | 3560 TRACE_EVENT1("navigation,benchmark,rail", |
| 3558 "id", routing_id_); | 3561 "RenderFrameImpl::didFinishDocumentLoad", "id", routing_id_); |
| 3559 DCHECK_EQ(frame_, frame); | 3562 DCHECK_EQ(frame_, frame); |
| 3560 WebDataSource* ds = frame->dataSource(); | 3563 WebDataSource* ds = frame->dataSource(); |
| 3561 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3564 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3562 document_state->set_finish_document_load_time(Time::Now()); | 3565 document_state->set_finish_document_load_time(Time::Now()); |
| 3563 | 3566 |
| 3564 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); | 3567 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); |
| 3565 | 3568 |
| 3566 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3569 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 3567 DidFinishDocumentLoad(frame)); | 3570 DidFinishDocumentLoad(frame)); |
| 3568 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); | 3571 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 frame->dataSource()->request().uiStartTime()); | 3637 frame->dataSource()->request().uiStartTime()); |
| 3635 | 3638 |
| 3636 Send(new FrameHostMsg_DocumentOnLoadCompleted( | 3639 Send(new FrameHostMsg_DocumentOnLoadCompleted( |
| 3637 routing_id_, report_type, ui_timestamp)); | 3640 routing_id_, report_type, ui_timestamp)); |
| 3638 } | 3641 } |
| 3639 } | 3642 } |
| 3640 | 3643 |
| 3641 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, | 3644 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, |
| 3642 const blink::WebURLError& error, | 3645 const blink::WebURLError& error, |
| 3643 blink::WebHistoryCommitType commit_type) { | 3646 blink::WebHistoryCommitType commit_type) { |
| 3644 TRACE_EVENT1("navigation", "RenderFrameImpl::didFailLoad", | 3647 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didFailLoad", |
| 3645 "id", routing_id_); | 3648 "id", routing_id_); |
| 3646 DCHECK_EQ(frame_, frame); | 3649 DCHECK_EQ(frame_, frame); |
| 3647 // TODO(nasko): Move implementation here. No state needed. | 3650 // TODO(nasko): Move implementation here. No state needed. |
| 3648 WebDataSource* ds = frame->dataSource(); | 3651 WebDataSource* ds = frame->dataSource(); |
| 3649 DCHECK(ds); | 3652 DCHECK(ds); |
| 3650 | 3653 |
| 3651 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3654 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 3652 DidFailLoad(frame, error)); | 3655 DidFailLoad(frame, error)); |
| 3653 | 3656 |
| 3654 const WebURLRequest& failed_request = ds->request(); | 3657 const WebURLRequest& failed_request = ds->request(); |
| 3655 base::string16 error_description; | 3658 base::string16 error_description; |
| 3656 GetContentClient()->renderer()->GetNavigationErrorStrings( | 3659 GetContentClient()->renderer()->GetNavigationErrorStrings( |
| 3657 this, | 3660 this, |
| 3658 failed_request, | 3661 failed_request, |
| 3659 error, | 3662 error, |
| 3660 nullptr, | 3663 nullptr, |
| 3661 &error_description); | 3664 &error_description); |
| 3662 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, | 3665 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, |
| 3663 failed_request.url(), | 3666 failed_request.url(), |
| 3664 error.reason, | 3667 error.reason, |
| 3665 error_description, | 3668 error_description, |
| 3666 error.wasIgnoredByHandler)); | 3669 error.wasIgnoredByHandler)); |
| 3667 } | 3670 } |
| 3668 | 3671 |
| 3669 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) { | 3672 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) { |
| 3670 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishLoad", "id", | 3673 TRACE_EVENT1("navigation,benchmark,rail", |
| 3671 routing_id_); | 3674 "RenderFrameImpl::didFinishLoad", "id", routing_id_); |
| 3672 DCHECK_EQ(frame_, frame); | 3675 DCHECK_EQ(frame_, frame); |
| 3673 WebDataSource* ds = frame->dataSource(); | 3676 WebDataSource* ds = frame->dataSource(); |
| 3674 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3677 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3675 if (document_state->finish_load_time().is_null()) { | 3678 if (document_state->finish_load_time().is_null()) { |
| 3676 if (!frame->parent()) { | 3679 if (!frame->parent()) { |
| 3677 TRACE_EVENT_INSTANT0("WebCore,benchmark", "LoadFinished", | 3680 TRACE_EVENT_INSTANT0("WebCore,benchmark,rail", "LoadFinished", |
| 3678 TRACE_EVENT_SCOPE_PROCESS); | 3681 TRACE_EVENT_SCOPE_PROCESS); |
| 3679 } | 3682 } |
| 3680 document_state->set_finish_load_time(Time::Now()); | 3683 document_state->set_finish_load_time(Time::Now()); |
| 3681 } | 3684 } |
| 3682 | 3685 |
| 3683 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3686 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 3684 DidFinishLoad(frame)); | 3687 DidFinishLoad(frame)); |
| 3685 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); | 3688 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); |
| 3686 | 3689 |
| 3687 Send(new FrameHostMsg_DidFinishLoad(routing_id_, | 3690 Send(new FrameHostMsg_DidFinishLoad(routing_id_, |
| 3688 ds->request().url())); | 3691 ds->request().url())); |
| 3689 } | 3692 } |
| 3690 | 3693 |
| 3691 void RenderFrameImpl::didNavigateWithinPage( | 3694 void RenderFrameImpl::didNavigateWithinPage( |
| 3692 blink::WebLocalFrame* frame, | 3695 blink::WebLocalFrame* frame, |
| 3693 const blink::WebHistoryItem& item, | 3696 const blink::WebHistoryItem& item, |
| 3694 blink::WebHistoryCommitType commit_type, | 3697 blink::WebHistoryCommitType commit_type, |
| 3695 bool content_initiated) { | 3698 bool content_initiated) { |
| 3696 TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage", | 3699 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didNavigateWithinPage", |
| 3697 "id", routing_id_); | 3700 "id", routing_id_); |
| 3698 DCHECK_EQ(frame_, frame); | 3701 DCHECK_EQ(frame_, frame); |
| 3699 DocumentState* document_state = | 3702 DocumentState* document_state = |
| 3700 DocumentState::FromDataSource(frame->dataSource()); | 3703 DocumentState::FromDataSource(frame->dataSource()); |
| 3701 UpdateNavigationState(document_state, true /* was_within_same_page */, | 3704 UpdateNavigationState(document_state, true /* was_within_same_page */, |
| 3702 content_initiated); | 3705 content_initiated); |
| 3703 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 3706 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
| 3704 ->set_was_within_same_page(true); | 3707 ->set_was_within_same_page(true); |
| 3705 | 3708 |
| 3706 didCommitProvisionalLoad(frame, item, commit_type); | 3709 didCommitProvisionalLoad(frame, item, commit_type); |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4745 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 4748 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
| 4746 // after the FrameHostMsg_DidCommitProvisionalLoad message. | 4749 // after the FrameHostMsg_DidCommitProvisionalLoad message. |
| 4747 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); | 4750 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); |
| 4748 | 4751 |
| 4749 // If we end up reusing this WebRequest (for example, due to a #ref click), | 4752 // If we end up reusing this WebRequest (for example, due to a #ref click), |
| 4750 // we don't want the transition type to persist. Just clear it. | 4753 // we don't want the transition type to persist. Just clear it. |
| 4751 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); | 4754 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); |
| 4752 } | 4755 } |
| 4753 | 4756 |
| 4754 void RenderFrameImpl::didStartLoading(bool to_different_document) { | 4757 void RenderFrameImpl::didStartLoading(bool to_different_document) { |
| 4755 TRACE_EVENT1("navigation", "RenderFrameImpl::didStartLoading", | 4758 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStartLoading", |
| 4756 "id", routing_id_); | 4759 "id", routing_id_); |
| 4757 render_view_->FrameDidStartLoading(frame_); | 4760 render_view_->FrameDidStartLoading(frame_); |
| 4758 | 4761 |
| 4759 // PlzNavigate: the browser is responsible for knowing the start of all | 4762 // PlzNavigate: the browser is responsible for knowing the start of all |
| 4760 // non-synchronous navigations. | 4763 // non-synchronous navigations. |
| 4761 if (!IsBrowserSideNavigationEnabled() || !to_different_document) | 4764 if (!IsBrowserSideNavigationEnabled() || !to_different_document) |
| 4762 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); | 4765 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); |
| 4763 } | 4766 } |
| 4764 | 4767 |
| 4765 void RenderFrameImpl::didStopLoading() { | 4768 void RenderFrameImpl::didStopLoading() { |
| 4766 TRACE_EVENT1("navigation", "RenderFrameImpl::didStopLoading", | 4769 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", |
| 4767 "id", routing_id_); | 4770 "id", routing_id_); |
| 4768 render_view_->FrameDidStopLoading(frame_); | 4771 render_view_->FrameDidStopLoading(frame_); |
| 4769 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 4772 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| 4770 } | 4773 } |
| 4771 | 4774 |
| 4772 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 4775 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
| 4773 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4776 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 4774 } | 4777 } |
| 4775 | 4778 |
| 4776 void RenderFrameImpl::HandleWebAccessibilityEvent( | 4779 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6296 // event target. Potentially a Pepper plugin will receive the event. | 6299 // event target. Potentially a Pepper plugin will receive the event. |
| 6297 // In order to tell whether a plugin gets the last mouse event and which it | 6300 // In order to tell whether a plugin gets the last mouse event and which it |
| 6298 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6301 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6299 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6302 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6300 // |pepper_last_mouse_event_target_|. | 6303 // |pepper_last_mouse_event_target_|. |
| 6301 pepper_last_mouse_event_target_ = nullptr; | 6304 pepper_last_mouse_event_target_ = nullptr; |
| 6302 #endif | 6305 #endif |
| 6303 } | 6306 } |
| 6304 | 6307 |
| 6305 } // namespace content | 6308 } // namespace content |
| OLD | NEW |