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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 return false; | 302 return false; |
303 } | 303 } |
304 | 304 |
305 // This will be used to set the Navigation Timing API navigationStart | 305 // This will be used to set the Navigation Timing API navigationStart |
306 // parameter for browser navigations in new tabs (intents, tabs opened through | 306 // parameter for browser navigations in new tabs (intents, tabs opened through |
307 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to | 307 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to |
308 // capture the time needed for the RenderFrameHost initialization. | 308 // capture the time needed for the RenderFrameHost initialization. |
309 base::TimeTicks navigation_start = base::TimeTicks::Now(); | 309 base::TimeTicks navigation_start = base::TimeTicks::Now(); |
310 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( | 310 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( |
311 "navigation,rail", "NavigationTiming navigationStart", | 311 "navigation,rail", "NavigationTiming navigationStart", |
312 TRACE_EVENT_SCOPE_GLOBAL, navigation_start.ToInternalValue()); | 312 TRACE_EVENT_SCOPE_GLOBAL, navigation_start); |
313 | 313 |
314 // Determine if LoFi should be used for the navigation. | 314 // Determine if LoFi should be used for the navigation. |
315 LoFiState lofi_state = LOFI_UNSPECIFIED; | 315 LoFiState lofi_state = LOFI_UNSPECIFIED; |
316 if (!frame_tree_node->IsMainFrame()) { | 316 if (!frame_tree_node->IsMainFrame()) { |
317 // For subframes, use the state of the top-level frame. | 317 // For subframes, use the state of the top-level frame. |
318 lofi_state = frame_tree_node->frame_tree() | 318 lofi_state = frame_tree_node->frame_tree() |
319 ->root() | 319 ->root() |
320 ->current_frame_host() | 320 ->current_frame_host() |
321 ->last_navigation_lofi_state(); | 321 ->last_navigation_lofi_state(); |
322 } else if (reload_type == ReloadType::DISABLE_LOFI_MODE) { | 322 } else if (reload_type == ReloadType::DISABLE_LOFI_MODE) { |
(...skipping 14 matching lines...) Expand all Loading... |
337 // TODO(carlosk): extend these traces to support subframes and | 337 // TODO(carlosk): extend these traces to support subframes and |
338 // non-PlzNavigate navigations. | 338 // non-PlzNavigate navigations. |
339 // For the trace below we're using the navigation handle as the async | 339 // For the trace below we're using the navigation handle as the async |
340 // trace id, |navigation_start| as the timestamp and reporting the | 340 // trace id, |navigation_start| as the timestamp and reporting the |
341 // FrameTreeNode id as a parameter. For navigations where no network | 341 // FrameTreeNode id as a parameter. For navigations where no network |
342 // request is made (data URLs, JavaScript URLs, etc) there is no handle | 342 // request is made (data URLs, JavaScript URLs, etc) there is no handle |
343 // and so no tracing is done. | 343 // and so no tracing is done. |
344 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 344 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
345 "navigation", "Navigation timeToNetworkStack", | 345 "navigation", "Navigation timeToNetworkStack", |
346 frame_tree_node->navigation_request()->navigation_handle(), | 346 frame_tree_node->navigation_request()->navigation_handle(), |
347 navigation_start.ToInternalValue(), | 347 navigation_start, |
348 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); | 348 "FrameTreeNode id", frame_tree_node->frame_tree_node_id()); |
349 } | 349 } |
350 | 350 |
351 } else { | 351 } else { |
352 RenderFrameHostImpl* dest_render_frame_host = | 352 RenderFrameHostImpl* dest_render_frame_host = |
353 frame_tree_node->render_manager()->Navigate( | 353 frame_tree_node->render_manager()->Navigate( |
354 dest_url, frame_entry, entry, reload_type != ReloadType::NONE); | 354 dest_url, frame_entry, entry, reload_type != ReloadType::NONE); |
355 if (!dest_render_frame_host) | 355 if (!dest_render_frame_host) |
356 return false; // Unable to create the desired RenderFrameHost. | 356 return false; // Unable to create the desired RenderFrameHost. |
357 | 357 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 if (pending_entry != controller_->GetVisibleEntry() || | 1202 if (pending_entry != controller_->GetVisibleEntry() || |
1203 !should_preserve_entry) { | 1203 !should_preserve_entry) { |
1204 controller_->DiscardPendingEntry(true); | 1204 controller_->DiscardPendingEntry(true); |
1205 | 1205 |
1206 // Also force the UI to refresh. | 1206 // Also force the UI to refresh. |
1207 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1207 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1208 } | 1208 } |
1209 } | 1209 } |
1210 | 1210 |
1211 } // namespace content | 1211 } // namespace content |
OLD | NEW |