Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 1532873003: PlzNavigate: add initial traces for new TBM benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars 274 LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars
275 << " characters."; 275 << " characters.";
276 return false; 276 return false;
277 } 277 }
278 278
279 // This will be used to set the Navigation Timing API navigationStart 279 // This will be used to set the Navigation Timing API navigationStart
280 // parameter for browser navigations in new tabs (intents, tabs opened through 280 // parameter for browser navigations in new tabs (intents, tabs opened through
281 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to 281 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to
282 // capture the time needed for the RenderFrameHost initialization. 282 // capture the time needed for the RenderFrameHost initialization.
283 base::TimeTicks navigation_start = base::TimeTicks::Now(); 283 base::TimeTicks navigation_start = base::TimeTicks::Now();
284 284 TRACE_EVENT_INSTANT_WITH_TIMESTAMP0(
285 RenderFrameHostManager* manager = frame_tree_node->render_manager(); 285 "navigation", "NavigationTiming navigationStart",
286 TRACE_EVENT_SCOPE_GLOBAL, navigation_start.ToInternalValue());
286 287
287 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. 288 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate.
288 if (IsBrowserSideNavigationEnabled()) { 289 if (IsBrowserSideNavigationEnabled()) {
289 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, 290 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url,
290 entry.restore_type())); 291 entry.restore_type()));
291 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, 292 RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry,
292 entry, reload_type, is_same_document_history_load, 293 entry, reload_type, is_same_document_history_load,
293 navigation_start); 294 navigation_start);
295 if (frame_tree_node->IsMainFrame()) {
clamy 2015/12/22 10:55:24 nit: add a TODO to extend these to subframes as we
carlosk 2015/12/22 13:58:18 Done. In other places as well.
296 // For these traces below we're using the navigation handle as the async
297 // trace id, |navigation_start| as the timestamp and reporting the
298 // FrameTreeNode id as a parameter.
299 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(
300 "navigation", "Navigation timeToNetworkStack",
301 frame_tree_node->navigation_request()->navigation_handle(),
302 navigation_start.ToInternalValue(),
303 "FrameTreeNode id", frame_tree_node->frame_tree_node_id());
304 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1(
305 "navigation", "Navigation timeToCommit",
306 frame_tree_node->navigation_request()->navigation_handle(),
307 navigation_start.ToInternalValue(),
308 "FrameTreeNode id", frame_tree_node->frame_tree_node_id());
309 }
294 310
295 // Notify observers about navigation if this is for the pending entry. 311 // Notify observers about navigation if this is for the pending entry.
296 if (delegate_ && is_pending_entry) 312 if (delegate_ && is_pending_entry)
297 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type); 313 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type);
298 314
299 return true; 315 return true;
300 } 316 }
301 317
302 RenderFrameHostImpl* dest_render_frame_host = 318 RenderFrameHostImpl* dest_render_frame_host =
303 manager->Navigate(dest_url, frame_entry, entry); 319 frame_tree_node->render_manager()->Navigate(dest_url, frame_entry, entry);
304 if (!dest_render_frame_host) 320 if (!dest_render_frame_host)
305 return false; // Unable to create the desired RenderFrameHost. 321 return false; // Unable to create the desired RenderFrameHost.
306 322
307 // Make sure no code called via RFHM::Navigate clears the pending entry. 323 // Make sure no code called via RFHM::Navigate clears the pending entry.
308 if (is_pending_entry) 324 if (is_pending_entry)
309 CHECK_EQ(controller_->GetPendingEntry(), &entry); 325 CHECK_EQ(controller_->GetPendingEntry(), &entry);
310 326
311 // For security, we should never send non-Web-UI URLs to a Web UI renderer. 327 // For security, we should never send non-Web-UI URLs to a Web UI renderer.
312 // Double check that here. 328 // Double check that here.
313 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); 329 CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (ui::PageTransitionIsMainFrame(params.transition) && delegate_) 500 if (ui::PageTransitionIsMainFrame(params.transition) && delegate_)
485 delegate_->SetMainFrameMimeType(params.contents_mime_type); 501 delegate_->SetMainFrameMimeType(params.contents_mime_type);
486 502
487 LoadCommittedDetails details; 503 LoadCommittedDetails details;
488 bool did_navigate = controller_->RendererDidNavigate(render_frame_host, 504 bool did_navigate = controller_->RendererDidNavigate(render_frame_host,
489 params, &details); 505 params, &details);
490 506
491 // Keep track of each frame's URL in its FrameTreeNode. 507 // Keep track of each frame's URL in its FrameTreeNode.
492 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); 508 render_frame_host->frame_tree_node()->SetCurrentURL(params.url);
493 509
510 if (did_navigate && render_frame_host->frame_tree_node()->IsMainFrame() &&
511 IsBrowserSideNavigationEnabled()) {
512 TRACE_EVENT_ASYNC_END0("navigation", "Navigation timeToCommit",
513 render_frame_host->navigation_handle());
514 }
515
494 // Send notification about committed provisional loads. This notification is 516 // Send notification about committed provisional loads. This notification is
495 // different from the NAV_ENTRY_COMMITTED notification which doesn't include 517 // different from the NAV_ENTRY_COMMITTED notification which doesn't include
496 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. 518 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
497 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { 519 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) {
498 DCHECK_EQ(!render_frame_host->GetParent(), 520 DCHECK_EQ(!render_frame_host->GetParent(),
499 did_navigate ? details.is_main_frame : false); 521 did_navigate ? details.is_main_frame : false);
500 ui::PageTransition transition_type = params.transition; 522 ui::PageTransition transition_type = params.transition;
501 // Whether or not a page transition was triggered by going backward or 523 // Whether or not a page transition was triggered by going backward or
502 // forward in the history is only stored in the navigation controller's 524 // forward in the history is only stored in the navigation controller's
503 // entry list. 525 // entry list.
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 1035 entry->set_should_replace_entry(pending_entry->should_replace_entry());
1014 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 1036 entry->SetRedirectChain(pending_entry->GetRedirectChain());
1015 } 1037 }
1016 controller_->SetPendingEntry(entry.Pass()); 1038 controller_->SetPendingEntry(entry.Pass());
1017 if (delegate_) 1039 if (delegate_)
1018 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1040 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1019 } 1041 }
1020 } 1042 }
1021 1043
1022 } // namespace content 1044 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698