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/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (IsBrowserSideNavigationEnabled()) { | 309 if (IsBrowserSideNavigationEnabled()) { |
310 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, | 310 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, |
311 entry.restore_type())); | 311 entry.restore_type())); |
312 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, | 312 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, |
313 entry, reload_type, lofi_state, | 313 entry, reload_type, lofi_state, |
314 is_same_document_history_load, navigation_start); | 314 is_same_document_history_load, navigation_start); |
315 if (frame_tree_node->IsMainFrame() && | 315 if (frame_tree_node->IsMainFrame() && |
316 frame_tree_node->navigation_request()) { | 316 frame_tree_node->navigation_request()) { |
317 // TODO(carlosk): extend these traces to support subframes and | 317 // TODO(carlosk): extend these traces to support subframes and |
318 // non-PlzNavigate navigations. | 318 // non-PlzNavigate navigations. |
319 // For these traces below we're using the navigation handle as the async | 319 // For the trace below we're using the navigation handle as the async |
320 // trace id, |navigation_start| as the timestamp and reporting the | 320 // trace id, |navigation_start| as the timestamp and reporting the |
321 // FrameTreeNode id as a parameter. For navigations where no network | 321 // FrameTreeNode id as a parameter. For navigations where no network |
322 // request is made (data URLs, JavaScript URLs, etc) there is no handle | 322 // request is made (data URLs, JavaScript URLs, etc) there is no handle |
323 // and so no tracing is done. | 323 // and so no tracing is done. |
324 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 324 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
325 "navigation", "Navigation timeToNetworkStack", | 325 "navigation", "Navigation timeToNetworkStack", |
326 frame_tree_node->navigation_request()->navigation_handle(), | 326 frame_tree_node->navigation_request()->navigation_handle(), |
327 navigation_start.ToInternalValue(), | 327 navigation_start.ToInternalValue(), |
328 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 328 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
329 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | |
330 "navigation", "Navigation timeToCommit", | |
331 frame_tree_node->navigation_request()->navigation_handle(), | |
332 navigation_start.ToInternalValue(), | |
333 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | |
334 } | 329 } |
335 | 330 |
336 } else { | 331 } else { |
337 RenderFrameHostImpl* dest_render_frame_host = | 332 RenderFrameHostImpl* dest_render_frame_host = |
338 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, | 333 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, |
339 entry); | 334 entry); |
340 if (!dest_render_frame_host) | 335 if (!dest_render_frame_host) |
341 return false; // Unable to create the desired RenderFrameHost. | 336 return false; // Unable to create the desired RenderFrameHost. |
342 | 337 |
343 // Make sure no code called via RFHM::Navigate clears the pending entry. | 338 // Make sure no code called via RFHM::Navigate clears the pending entry. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 // Separately, update the frame's last successful URL except for net error | 556 // Separately, update the frame's last successful URL except for net error |
562 // pages, since those do not end up in the correct process after transfers | 557 // pages, since those do not end up in the correct process after transfers |
563 // (see https://crbug.com/560511). Instead, the next cross-process navigation | 558 // (see https://crbug.com/560511). Instead, the next cross-process navigation |
564 // or transfer should decide whether to swap as if the net error had not | 559 // or transfer should decide whether to swap as if the net error had not |
565 // occurred. | 560 // occurred. |
566 // TODO(creis): Remove this block and always set the URL once transfers handle | 561 // TODO(creis): Remove this block and always set the URL once transfers handle |
567 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. | 562 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. |
568 if (!params.url_is_unreachable) | 563 if (!params.url_is_unreachable) |
569 render_frame_host->set_last_successful_url(params.url); | 564 render_frame_host->set_last_successful_url(params.url); |
570 | 565 |
571 if (did_navigate && render_frame_host->frame_tree_node()->IsMainFrame() && | |
572 IsBrowserSideNavigationEnabled()) { | |
573 TRACE_EVENT_ASYNC_END0("navigation", "Navigation timeToCommit", | |
574 render_frame_host->navigation_handle()); | |
575 } | |
576 | |
577 // Send notification about committed provisional loads. This notification is | 566 // Send notification about committed provisional loads. This notification is |
578 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 567 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
579 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 568 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
580 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { | 569 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { |
581 DCHECK_EQ(!render_frame_host->GetParent(), | 570 DCHECK_EQ(!render_frame_host->GetParent(), |
582 did_navigate ? details.is_main_frame : false); | 571 did_navigate ? details.is_main_frame : false); |
583 ui::PageTransition transition_type = params.transition; | 572 ui::PageTransition transition_type = params.transition; |
584 // Whether or not a page transition was triggered by going backward or | 573 // Whether or not a page transition was triggered by going backward or |
585 // forward in the history is only stored in the navigation controller's | 574 // forward in the history is only stored in the navigation controller's |
586 // entry list. | 575 // entry list. |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 if (pending_entry != controller_->GetVisibleEntry() || | 1078 if (pending_entry != controller_->GetVisibleEntry() || |
1090 !should_preserve_entry) { | 1079 !should_preserve_entry) { |
1091 controller_->DiscardPendingEntry(true); | 1080 controller_->DiscardPendingEntry(true); |
1092 | 1081 |
1093 // Also force the UI to refresh. | 1082 // Also force the UI to refresh. |
1094 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1083 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1095 } | 1084 } |
1096 } | 1085 } |
1097 | 1086 |
1098 } // namespace content | 1087 } // namespace content |
OLD | NEW |