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

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

Issue 1312213010: PageLoadMetrics renderer and browser implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Relax DCHECK constraints slightly for tests Created 5 years, 3 months 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 *controller_->GetPendingEntry(), reload_type, 383 *controller_->GetPendingEntry(), reload_type,
384 is_same_document_history_load); 384 is_same_document_history_load);
385 } 385 }
386 386
387 void NavigatorImpl::DidNavigate( 387 void NavigatorImpl::DidNavigate(
388 RenderFrameHostImpl* render_frame_host, 388 RenderFrameHostImpl* render_frame_host,
389 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 389 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
390 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); 390 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
391 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); 391 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible();
392 392
393 bool is_navigation_within_page = controller_->IsURLInPageNavigation(
394 params.url, params.was_within_same_page, render_frame_host);
393 if (ui::PageTransitionIsMainFrame(params.transition)) { 395 if (ui::PageTransitionIsMainFrame(params.transition)) {
394 if (delegate_) { 396 if (delegate_) {
395 // When overscroll navigation gesture is enabled, a screenshot of the page 397 // When overscroll navigation gesture is enabled, a screenshot of the page
396 // in its current state is taken so that it can be used during the 398 // in its current state is taken so that it can be used during the
397 // nav-gesture. It is necessary to take the screenshot here, before 399 // nav-gesture. It is necessary to take the screenshot here, before
398 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can 400 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can
399 // change WebContents::GetRenderViewHost to return the new host, instead 401 // change WebContents::GetRenderViewHost to return the new host, instead
400 // of the one that may have just been swapped out. 402 // of the one that may have just been swapped out.
401 if (delegate_->CanOverscrollContent()) { 403 if (delegate_->CanOverscrollContent()) {
402 // Don't take screenshots if we are staying on the same page. We want 404 // Don't take screenshots if we are staying on the same page. We want
403 // in-page navigations to be super fast, and taking a screenshot 405 // in-page navigations to be super fast, and taking a screenshot
404 // currently blocks GPU for a longer time than we are willing to 406 // currently blocks GPU for a longer time than we are willing to
405 // tolerate in this use case. 407 // tolerate in this use case.
406 if (!params.was_within_same_page) 408 if (!params.was_within_same_page)
407 controller_->TakeScreenshot(); 409 controller_->TakeScreenshot();
408 } 410 }
409 411
410 // Run tasks that must execute just before the commit. 412 // Run tasks that must execute just before the commit.
411 bool is_navigation_within_page = controller_->IsURLInPageNavigation(
412 params.url, params.was_within_same_page, render_frame_host);
413 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); 413 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page);
414 } 414 }
415 415
416 if (!oopifs_possible) 416 if (!oopifs_possible)
417 frame_tree->root()->render_manager()->DidNavigateFrame( 417 frame_tree->root()->render_manager()->DidNavigateFrame(
418 render_frame_host, params.gesture == NavigationGestureUser); 418 render_frame_host, params.gesture == NavigationGestureUser);
419 } 419 }
420 420
421 // Save the origin of the new page. Do this before calling 421 // Save the origin of the new page. Do this before calling
422 // DidNavigateFrame(), because the origin needs to be included in the SwapOut 422 // DidNavigateFrame(), because the origin needs to be included in the SwapOut
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 if (did_navigate && 478 if (did_navigate &&
479 (controller_->GetLastCommittedEntry()->GetTransitionType() & 479 (controller_->GetLastCommittedEntry()->GetTransitionType() &
480 ui::PAGE_TRANSITION_FORWARD_BACK)) { 480 ui::PAGE_TRANSITION_FORWARD_BACK)) {
481 transition_type = ui::PageTransitionFromInt( 481 transition_type = ui::PageTransitionFromInt(
482 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); 482 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK);
483 } 483 }
484 484
485 delegate_->DidCommitProvisionalLoad(render_frame_host, 485 delegate_->DidCommitProvisionalLoad(render_frame_host,
486 params.url, 486 params.url,
487 transition_type); 487 transition_type);
488 render_frame_host->navigation_handle()->DidCommitNavigation(); 488 render_frame_host->navigation_handle()->DidCommitNavigation(
489 is_navigation_within_page);
489 } 490 }
490 491
491 if (!did_navigate) 492 if (!did_navigate)
492 return; // No navigation happened. 493 return; // No navigation happened.
493 494
494 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen 495 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen
495 // for the appropriate notification (best) or you can add it to 496 // for the appropriate notification (best) or you can add it to
496 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if 497 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if
497 // necessary, please). 498 // necessary, please).
498 499
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 946 entry->set_should_replace_entry(pending_entry->should_replace_entry());
946 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 947 entry->SetRedirectChain(pending_entry->GetRedirectChain());
947 } 948 }
948 controller_->SetPendingEntry(entry.Pass()); 949 controller_->SetPendingEntry(entry.Pass());
949 if (delegate_) 950 if (delegate_)
950 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 951 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
951 } 952 }
952 } 953 }
953 954
954 } // namespace content 955 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698