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

Side by Side Diff: components/sync/driver/data_type_manager_impl.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: nocompile test Created 3 years, 6 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
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 "components/sync/driver/data_type_manager_impl.h" 5 #include "components/sync/driver/data_type_manager_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 void DataTypeManagerImpl::Restart(ConfigureReason reason) { 247 void DataTypeManagerImpl::Restart(ConfigureReason reason) {
248 DVLOG(1) << "Restarting..."; 248 DVLOG(1) << "Restarting...";
249 249
250 // Only record the type histograms for user-triggered configurations or 250 // Only record the type histograms for user-triggered configurations or
251 // restarts. 251 // restarts.
252 if (reason == CONFIGURE_REASON_RECONFIGURATION || 252 if (reason == CONFIGURE_REASON_RECONFIGURATION ||
253 reason == CONFIGURE_REASON_NEW_CLIENT || 253 reason == CONFIGURE_REASON_NEW_CLIENT ||
254 reason == CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE) { 254 reason == CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE) {
255 for (ModelTypeSet::Iterator iter = last_requested_types_.First(); 255 for (ModelTypeSet::Iterator iter = last_requested_types_.First();
256 iter.Good(); iter.Inc()) { 256 iter.Good(); iter.Inc()) {
257 // TODO(wychen): enum uma should be strongly typed. crbug.com/661401
257 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureDataTypes", 258 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureDataTypes",
258 ModelTypeToHistogramInt(iter.Get()), 259 ModelTypeToHistogramInt(iter.Get()),
259 MODEL_TYPE_COUNT); 260 static_cast<int>(MODEL_TYPE_COUNT));
260 } 261 }
261 } 262 }
262 263
263 // Check for new or resolved data type crypto errors. 264 // Check for new or resolved data type crypto errors.
264 if (encryption_handler_->IsPassphraseRequired()) { 265 if (encryption_handler_->IsPassphraseRequired()) {
265 ModelTypeSet encrypted_types = encryption_handler_->GetEncryptedDataTypes(); 266 ModelTypeSet encrypted_types = encryption_handler_->GetEncryptedDataTypes();
266 encrypted_types.RetainAll(last_requested_types_); 267 encrypted_types.RetainAll(last_requested_types_);
267 encrypted_types.RemoveAll(data_type_status_table_.GetCryptoErrorTypes()); 268 encrypted_types.RemoveAll(data_type_status_table_.GetCryptoErrorTypes());
268 DataTypeStatusTable::TypeErrorMap crypto_errors = 269 DataTypeStatusTable::TypeErrorMap crypto_errors =
269 GenerateCryptoErrorsForTypes(encrypted_types); 270 GenerateCryptoErrorsForTypes(encrypted_types);
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 860
860 void DataTypeManagerImpl::SetTypeDownloaded(ModelType type, bool downloaded) { 861 void DataTypeManagerImpl::SetTypeDownloaded(ModelType type, bool downloaded) {
861 if (downloaded) { 862 if (downloaded) {
862 downloaded_types_.Put(type); 863 downloaded_types_.Put(type);
863 } else { 864 } else {
864 downloaded_types_.Remove(type); 865 downloaded_types_.Remove(type);
865 } 866 }
866 } 867 }
867 868
868 } // namespace syncer 869 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698