| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (IsBrowserSideNavigationEnabled()) { | 280 if (IsBrowserSideNavigationEnabled()) { |
| 281 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, | 281 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, |
| 282 entry.restore_type())); | 282 entry.restore_type())); |
| 283 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, | 283 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, |
| 284 entry, reload_type, lofi_state, | 284 entry, reload_type, lofi_state, |
| 285 is_same_document_history_load, navigation_start); | 285 is_same_document_history_load, navigation_start); |
| 286 if (frame_tree_node->IsMainFrame() && | 286 if (frame_tree_node->IsMainFrame() && |
| 287 frame_tree_node->navigation_request()) { | 287 frame_tree_node->navigation_request()) { |
| 288 // TODO(carlosk): extend these traces to support subframes and | 288 // TODO(carlosk): extend these traces to support subframes and |
| 289 // non-PlzNavigate navigations. | 289 // non-PlzNavigate navigations. |
| 290 // For these traces below we're using the navigation handle as the async | 290 // For the trace below we're using the navigation handle as the async |
| 291 // trace id, |navigation_start| as the timestamp and reporting the | 291 // trace id, |navigation_start| as the timestamp and reporting the |
| 292 // FrameTreeNode id as a parameter. For navigations where no network | 292 // FrameTreeNode id as a parameter. For navigations where no network |
| 293 // request is made (data URLs, JavaScript URLs, etc) there is no handle | 293 // request is made (data URLs, JavaScript URLs, etc) there is no handle |
| 294 // and so no tracing is done. | 294 // and so no tracing is done. |
| 295 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 295 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
| 296 "navigation", "Navigation timeToNetworkStack", | 296 "navigation", "Navigation timeToNetworkStack", |
| 297 frame_tree_node->navigation_request()->navigation_handle(), | 297 frame_tree_node->navigation_request()->navigation_handle(), |
| 298 navigation_start.ToInternalValue(), | 298 navigation_start.ToInternalValue(), |
| 299 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 299 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
| 300 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | |
| 301 "navigation", "Navigation timeToCommit", | |
| 302 frame_tree_node->navigation_request()->navigation_handle(), | |
| 303 navigation_start.ToInternalValue(), | |
| 304 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | |
| 305 } | 300 } |
| 306 | 301 |
| 307 } else { | 302 } else { |
| 308 RenderFrameHostImpl* dest_render_frame_host = | 303 RenderFrameHostImpl* dest_render_frame_host = |
| 309 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, | 304 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, |
| 310 entry); | 305 entry); |
| 311 if (!dest_render_frame_host) | 306 if (!dest_render_frame_host) |
| 312 return false; // Unable to create the desired RenderFrameHost. | 307 return false; // Unable to create the desired RenderFrameHost. |
| 313 | 308 |
| 314 // Make sure no code called via RFHM::Navigate clears the pending entry. | 309 // 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... |
| 532 // Separately, update the frame's last successful URL except for net error | 527 // Separately, update the frame's last successful URL except for net error |
| 533 // pages, since those do not end up in the correct process after transfers | 528 // pages, since those do not end up in the correct process after transfers |
| 534 // (see https://crbug.com/560511). Instead, the next cross-process navigation | 529 // (see https://crbug.com/560511). Instead, the next cross-process navigation |
| 535 // or transfer should decide whether to swap as if the net error had not | 530 // or transfer should decide whether to swap as if the net error had not |
| 536 // occurred. | 531 // occurred. |
| 537 // TODO(creis): Remove this block and always set the URL once transfers handle | 532 // TODO(creis): Remove this block and always set the URL once transfers handle |
| 538 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. | 533 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. |
| 539 if (!params.url_is_unreachable) | 534 if (!params.url_is_unreachable) |
| 540 render_frame_host->set_last_successful_url(params.url); | 535 render_frame_host->set_last_successful_url(params.url); |
| 541 | 536 |
| 542 if (did_navigate && render_frame_host->frame_tree_node()->IsMainFrame() && | |
| 543 IsBrowserSideNavigationEnabled()) { | |
| 544 TRACE_EVENT_ASYNC_END0("navigation", "Navigation timeToCommit", | |
| 545 render_frame_host->navigation_handle()); | |
| 546 } | |
| 547 | |
| 548 // Send notification about committed provisional loads. This notification is | 537 // Send notification about committed provisional loads. This notification is |
| 549 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 538 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
| 550 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 539 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
| 551 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { | 540 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { |
| 552 DCHECK_EQ(!render_frame_host->GetParent(), | 541 DCHECK_EQ(!render_frame_host->GetParent(), |
| 553 did_navigate ? details.is_main_frame : false); | 542 did_navigate ? details.is_main_frame : false); |
| 554 ui::PageTransition transition_type = params.transition; | 543 ui::PageTransition transition_type = params.transition; |
| 555 // Whether or not a page transition was triggered by going backward or | 544 // Whether or not a page transition was triggered by going backward or |
| 556 // forward in the history is only stored in the navigation controller's | 545 // forward in the history is only stored in the navigation controller's |
| 557 // entry list. | 546 // entry list. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 if (pending_entry != controller_->GetVisibleEntry() || | 1121 if (pending_entry != controller_->GetVisibleEntry() || |
| 1133 !should_preserve_entry) { | 1122 !should_preserve_entry) { |
| 1134 controller_->DiscardPendingEntry(true); | 1123 controller_->DiscardPendingEntry(true); |
| 1135 | 1124 |
| 1136 // Also force the UI to refresh. | 1125 // Also force the UI to refresh. |
| 1137 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1126 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
| 1138 } | 1127 } |
| 1139 } | 1128 } |
| 1140 | 1129 |
| 1141 } // namespace content | 1130 } // namespace content |
| OLD | NEW |