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

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

Issue 2199953002: Add CLIENT_REDIRECT variants for page load metrics abort types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aborts
Patch Set: fix histogram name Created 4 years, 4 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 | « no previous file | chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.h » ('j') | 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 "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) { 186 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) {
187 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground, 187 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground,
188 completed_after_background); 188 completed_after_background);
189 } 189 }
190 190
191 // TODO(csharrison): Add a case for client side redirects, which is what JS 191 // TODO(csharrison): Add a case for client side redirects, which is what JS
192 // initiated window.location / window.history navigations get set to. 192 // initiated window.location / window.history navigations get set to.
193 UserAbortType AbortTypeForPageTransition(ui::PageTransition transition) { 193 UserAbortType AbortTypeForPageTransition(ui::PageTransition transition) {
194 if (transition & ui::PAGE_TRANSITION_CLIENT_REDIRECT) {
195 return ABORT_CLIENT_REDIRECT;
196 }
194 if (ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD)) 197 if (ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD))
195 return ABORT_RELOAD; 198 return ABORT_RELOAD;
196 if (transition & ui::PAGE_TRANSITION_FORWARD_BACK) 199 if (transition & ui::PAGE_TRANSITION_FORWARD_BACK)
197 return ABORT_FORWARD_BACK; 200 return ABORT_FORWARD_BACK;
198 if (ui::PageTransitionIsNewNavigation(transition)) 201 if (ui::PageTransitionIsNewNavigation(transition))
199 return ABORT_NEW_NAVIGATION; 202 return ABORT_NEW_NAVIGATION;
200 NOTREACHED() 203 NOTREACHED()
201 << "AbortTypeForPageTransition received unexpected ui::PageTransition: " 204 << "AbortTypeForPageTransition received unexpected ui::PageTransition: "
202 << transition; 205 << transition;
203 return ABORT_OTHER; 206 return ABORT_OTHER;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 final_navigation->GetPageTransition(); 330 final_navigation->GetPageTransition();
328 switch (AbortTypeForPageTransition(committed_transition)) { 331 switch (AbortTypeForPageTransition(committed_transition)) {
329 case ABORT_RELOAD: 332 case ABORT_RELOAD:
330 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeReload, 333 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeReload,
331 aborted_chain_size_); 334 aborted_chain_size_);
332 return; 335 return;
333 case ABORT_FORWARD_BACK: 336 case ABORT_FORWARD_BACK:
334 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeForwardBack, 337 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeForwardBack,
335 aborted_chain_size_); 338 aborted_chain_size_);
336 return; 339 return;
340 // TODO(csharrison): Refactor this code so it is based on the WillStart*
341 // code path instead of the committed load code path. Then, for every abort
342 // chain, log a histogram of the counts of each of these metrics. For now,
343 // merge client redirects with new navigations, which was (basically) the
344 // previous behavior.
345 case ABORT_CLIENT_REDIRECT:
337 case ABORT_NEW_NAVIGATION: 346 case ABORT_NEW_NAVIGATION:
338 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeNewNavigation, 347 UMA_HISTOGRAM_COUNTS(internal::kAbortChainSizeNewNavigation,
339 aborted_chain_size_); 348 aborted_chain_size_);
340 return; 349 return;
341 default: 350 default:
342 NOTREACHED() 351 NOTREACHED()
343 << "LogAbortChainHistograms received unexpected ui::PageTransition: " 352 << "LogAbortChainHistograms received unexpected ui::PageTransition: "
344 << committed_transition; 353 << committed_transition;
345 return; 354 return;
346 } 355 }
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) 996 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage())
988 return false; 997 return false;
989 const std::string& mime_type = web_contents()->GetContentsMimeType(); 998 const std::string& mime_type = web_contents()->GetContentsMimeType();
990 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") 999 if (mime_type != "text/html" && mime_type != "application/xhtml+xml")
991 return false; 1000 return false;
992 } 1001 }
993 return true; 1002 return true;
994 } 1003 }
995 1004
996 } // namespace page_load_metrics 1005 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698