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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_tracker.cc

Issue 2800873002: Update both end time and end reason when we don't have an end time. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/extensions/isolated_app_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/page_load_metrics/page_load_tracker.h" 5 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 PageLoadTracker::~PageLoadTracker() { 316 PageLoadTracker::~PageLoadTracker() {
317 if (app_entered_background_) { 317 if (app_entered_background_) {
318 RecordAppBackgroundPageLoadCompleted(true); 318 RecordAppBackgroundPageLoadCompleted(true);
319 } 319 }
320 320
321 if (did_stop_tracking_) 321 if (did_stop_tracking_)
322 return; 322 return;
323 323
324 if (page_end_time_.is_null()) { 324 if (page_end_time_.is_null()) {
325 // page_end_time_ can be unset in some cases, such as when a navigation is
326 // aborted by a navigation that started before it. In these cases, set the
327 // end time to the current time.
325 RecordInternalError(ERR_NO_PAGE_LOAD_END_TIME); 328 RecordInternalError(ERR_NO_PAGE_LOAD_END_TIME);
326 page_end_time_ = base::TimeTicks::Now(); 329 NotifyPageEnd(END_OTHER, UserInitiatedInfo::NotUserInitiated(),
330 base::TimeTicks::Now(), true);
327 } 331 }
328 332
329 if (!did_commit_) { 333 if (!did_commit_) {
330 if (!failed_provisional_load_info_) 334 if (!failed_provisional_load_info_)
331 RecordInternalError(ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD); 335 RecordInternalError(ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD);
332 336
333 // Don't include any aborts that resulted in a new navigation, as the chain 337 // Don't include any aborts that resulted in a new navigation, as the chain
334 // length will be included in the aborter PageLoadTracker. 338 // length will be included in the aborter PageLoadTracker.
335 if (page_end_reason_ != END_RELOAD && 339 if (page_end_reason_ != END_RELOAD &&
336 page_end_reason_ != END_FORWARD_BACK && 340 page_end_reason_ != END_FORWARD_BACK &&
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 737 }
734 738
735 void PageLoadTracker::MediaStartedPlaying( 739 void PageLoadTracker::MediaStartedPlaying(
736 const content::WebContentsObserver::MediaPlayerInfo& video_type, 740 const content::WebContentsObserver::MediaPlayerInfo& video_type,
737 bool is_in_main_frame) { 741 bool is_in_main_frame) {
738 for (const auto& observer : observers_) 742 for (const auto& observer : observers_)
739 observer->MediaStartedPlaying(video_type, is_in_main_frame); 743 observer->MediaStartedPlaying(video_type, is_in_main_frame);
740 } 744 }
741 745
742 } // namespace page_load_metrics 746 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « chrome/browser/extensions/isolated_app_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698