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

Side by Side Diff: chrome/browser/metrics/android_metrics_provider.cc

Issue 2838893002: Remove base::ListValue::Set(size_t, base::Value*) (Closed)
Patch Set: Fix Compilation Error Created 3 years, 7 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 | « base/values.cc ('k') | chrome/browser/speech/extension_api/tts_extension_api.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/android_metrics_provider.h" 5 #include "chrome/browser/metrics/android_metrics_provider.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/android/feature_utilities.h" 10 #include "chrome/browser/android/feature_utilities.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "components/prefs/pref_registry_simple.h" 12 #include "components/prefs/pref_registry_simple.h"
13 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
14 #include "components/prefs/scoped_user_pref_update.h" 14 #include "components/prefs/scoped_user_pref_update.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Increments a particular entry in the ListValue. 18 // Increments a particular entry in the ListValue.
19 void IncrementListValue(base::ListValue* counts, int index) { 19 void IncrementListValue(base::Value* counts, int index) {
20 int current_count = 0; 20 counts->GetList()[index] = base::Value(counts->GetList()[index].GetInt() + 1);
21 counts->GetInteger(index, &current_count);
22 counts->Set(index, new base::Value(current_count + 1));
23 } 21 }
24 22
25 // Takes an int corresponding to a Type and returns the corresponding flag. 23 // Takes an int corresponding to a Type and returns the corresponding flag.
26 int GetActivityFlag(int type_id) { 24 int GetActivityFlag(int type_id) {
27 ActivityTypeIds::Type type = ActivityTypeIds::GetActivityType(type_id); 25 ActivityTypeIds::Type type = ActivityTypeIds::GetActivityType(type_id);
28 DCHECK_LT(type, ActivityTypeIds::ACTIVITY_MAX_VALUE); 26 DCHECK_LT(type, ActivityTypeIds::ACTIVITY_MAX_VALUE);
29 return (1 << type); 27 return (1 << type);
30 } 28 }
31 29
32 } // namespace 30 } // namespace
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 for (int count = 0; count < crash_count; ++count) { 151 for (int count = 0; count < crash_count; ++count) {
154 UMA_STABILITY_HISTOGRAM_ENUMERATION("Chrome.Android.Activity.CrashCounts", 152 UMA_STABILITY_HISTOGRAM_ENUMERATION("Chrome.Android.Activity.CrashCounts",
155 activity_type, 153 activity_type,
156 ActivityTypeIds::ACTIVITY_MAX_VALUE); 154 ActivityTypeIds::ACTIVITY_MAX_VALUE);
157 } 155 }
158 } 156 }
159 157
160 launch_counts->Clear(); 158 launch_counts->Clear();
161 crash_counts->Clear(); 159 crash_counts->Clear();
162 } 160 }
OLDNEW
« no previous file with comments | « base/values.cc ('k') | chrome/browser/speech/extension_api/tts_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698