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

Side by Side Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 2142743002: Stop tracking user input events without a relevant load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 5 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 | « components/page_load_metrics/browser/metrics_web_contents_observer.h ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 void MetricsWebContentsObserver::NavigationStopped() { 779 void MetricsWebContentsObserver::NavigationStopped() {
780 NotifyAbortAllLoads(ABORT_STOP); 780 NotifyAbortAllLoads(ABORT_STOP);
781 } 781 }
782 782
783 void MetricsWebContentsObserver::OnInputEvent( 783 void MetricsWebContentsObserver::OnInputEvent(
784 const blink::WebInputEvent& event) { 784 const blink::WebInputEvent& event) {
785 // Ignore browser navigation or reload which comes with type Undefined. 785 // Ignore browser navigation or reload which comes with type Undefined.
786 if (event.type == blink::WebInputEvent::Type::Undefined) 786 if (event.type == blink::WebInputEvent::Type::Undefined)
787 return; 787 return;
788 788
789 if (!committed_load_) { 789 if (committed_load_)
790 RecordInternalError(ERR_USER_INPUT_WITH_NO_RELEVANT_LOAD); 790 committed_load_->OnInputEvent(event);
791 return;
792 }
793
794 committed_load_->OnInputEvent(event);
795 } 791 }
796 792
797 void MetricsWebContentsObserver::DidRedirectNavigation( 793 void MetricsWebContentsObserver::DidRedirectNavigation(
798 content::NavigationHandle* navigation_handle) { 794 content::NavigationHandle* navigation_handle) {
799 if (!navigation_handle->IsInMainFrame()) 795 if (!navigation_handle->IsInMainFrame())
800 return; 796 return;
801 auto it = provisional_loads_.find(navigation_handle); 797 auto it = provisional_loads_.find(navigation_handle);
802 if (it == provisional_loads_.end()) 798 if (it == provisional_loads_.end())
803 return; 799 return;
804 it->second->Redirect(navigation_handle); 800 it->second->Redirect(navigation_handle);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 919
924 if (!committed_load_->UpdateTiming(timing, metadata)) { 920 if (!committed_load_->UpdateTiming(timing, metadata)) {
925 // If the page load tracker cannot update its timing, something is wrong 921 // If the page load tracker cannot update its timing, something is wrong
926 // with the IPC (it's from another load, or it's invalid in some other way). 922 // with the IPC (it's from another load, or it's invalid in some other way).
927 // We expect this to be a rare occurrence. 923 // We expect this to be a rare occurrence.
928 RecordInternalError(ERR_BAD_TIMING_IPC); 924 RecordInternalError(ERR_BAD_TIMING_IPC);
929 } 925 }
930 } 926 }
931 927
932 } // namespace page_load_metrics 928 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « components/page_load_metrics/browser/metrics_web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698