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

Unified Diff: chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc

Issue 1675483002: Allow use of container cbegin() and cend() methods, plus sample uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add note about non-member cbegin() and cend(). Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
index 5db6a72cf4bfa36862741ddbeb47e754b02d502f..61f6cf658ce70c4cfc64a2a18c67cb73f428d2b0 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_stats_recorder.cc
@@ -137,14 +137,14 @@ void TabStripModelStatsRecorder::ActiveTabChanged(
// A UMA Histogram must be bounded by some number.
// We chose 64 as our bound as 99.5% of the users open <64 tabs.
const int kMaxTabHistory = 64;
- auto it = std::find(active_tab_history_.begin(), active_tab_history_.end(),
+ auto it = std::find(active_tab_history_.cbegin(), active_tab_history_.cend(),
new_contents);
- int age = it != active_tab_history_.end() ? (it - active_tab_history_.begin())
- : (kMaxTabHistory - 1);
+ int age = (it != active_tab_history_.cend()) ?
+ (it - active_tab_history_.cbegin()) : (kMaxTabHistory - 1);
if (was_inactive) {
UMA_HISTOGRAM_ENUMERATION(
"Tabs.StateTransfer.NumberOfOtherTabsActivatedBeforeMadeActive",
- std::min(age, kMaxTabHistory), kMaxTabHistory);
+ std::min(age, kMaxTabHistory - 1), kMaxTabHistory);
}
active_tab_history_.insert(active_tab_history_.begin(), new_contents);
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698