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

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

Issue 2789783003: Fix incorrect assert in PageLoadTracker. (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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // interpreted as the abort time for other provisional loads in the tab. 703 // interpreted as the abort time for other provisional loads in the tab.
704 // However, this only makes sense if the committed load started after the 704 // However, this only makes sense if the committed load started after the
705 // aborted provisional loads started. Thus we ignore cases where the committed 705 // aborted provisional loads started. Thus we ignore cases where the committed
706 // load started before the aborted provisional load, as this would result in 706 // load started before the aborted provisional load, as this would result in
707 // recording a negative time-to-abort. The real issue here is that we have to 707 // recording a negative time-to-abort. The real issue here is that we have to
708 // infer the cause of aborts. It would be better if the navigation code could 708 // infer the cause of aborts. It would be better if the navigation code could
709 // instead report the actual cause of an aborted navigation. See crbug/571647 709 // instead report the actual cause of an aborted navigation. See crbug/571647
710 // for details. 710 // for details.
711 if (timestamp < navigation_start_) { 711 if (timestamp < navigation_start_) {
712 RecordInternalError(ERR_END_BEFORE_NAVIGATION_START); 712 RecordInternalError(ERR_END_BEFORE_NAVIGATION_START);
713 page_end_reason_ = END_NONE; 713 page_end_reason_ = END_OTHER;
714 page_end_time_ = base::TimeTicks(); 714 page_end_time_ = base::TimeTicks();
715 return; 715 return;
716 } 716 }
717 page_end_reason_ = page_end_reason; 717 page_end_reason_ = page_end_reason;
718 page_end_time_ = timestamp; 718 page_end_time_ = timestamp;
719 // A client redirect can never be user initiated. Due to the way Blink 719 // A client redirect can never be user initiated. Due to the way Blink
720 // implements user gesture tracking, where all events that occur within 1 720 // implements user gesture tracking, where all events that occur within 1
721 // second after a user interaction are considered to be triggered by user 721 // second after a user interaction are considered to be triggered by user
722 // activation (based on HTML spec: 722 // activation (based on HTML spec:
723 // https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-a ctivation), 723 // https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-a ctivation),
724 // these navs may sometimes be reported as user initiated by Blink. Thus, we 724 // these navs may sometimes be reported as user initiated by Blink. Thus, we
725 // explicitly filter these types of aborts out when deciding if the abort was 725 // explicitly filter these types of aborts out when deciding if the abort was
726 // user initiated. 726 // user initiated.
727 if (page_end_reason != END_CLIENT_REDIRECT) 727 if (page_end_reason != END_CLIENT_REDIRECT)
728 page_end_user_initiated_info_ = user_initiated_info; 728 page_end_user_initiated_info_ = user_initiated_info;
729 729
730 if (is_certainly_browser_timestamp) { 730 if (is_certainly_browser_timestamp) {
731 ClampBrowserTimestampIfInterProcessTimeTickSkew(&page_end_time_); 731 ClampBrowserTimestampIfInterProcessTimeTickSkew(&page_end_time_);
732 } 732 }
733 } 733 }
734 734
735 void PageLoadTracker::MediaStartedPlaying( 735 void PageLoadTracker::MediaStartedPlaying(
736 const content::WebContentsObserver::MediaPlayerInfo& video_type, 736 const content::WebContentsObserver::MediaPlayerInfo& video_type,
737 bool is_in_main_frame) { 737 bool is_in_main_frame) {
738 for (const auto& observer : observers_) 738 for (const auto& observer : observers_)
739 observer->MediaStartedPlaying(video_type, is_in_main_frame); 739 observer->MediaStartedPlaying(video_type, is_in_main_frame);
740 } 740 }
741 741
742 } // namespace page_load_metrics 742 } // 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