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

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: simplify type checking Created 3 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
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void DataTypeManagerImpl::Restart(ConfigureReason reason) { 246 void DataTypeManagerImpl::Restart(ConfigureReason reason) {
247 DVLOG(1) << "Restarting..."; 247 DVLOG(1) << "Restarting...";
248 248
249 // Only record the type histograms for user-triggered configurations or 249 // Only record the type histograms for user-triggered configurations or
250 // restarts. 250 // restarts.
251 if (reason == CONFIGURE_REASON_RECONFIGURATION || 251 if (reason == CONFIGURE_REASON_RECONFIGURATION ||
252 reason == CONFIGURE_REASON_NEW_CLIENT || 252 reason == CONFIGURE_REASON_NEW_CLIENT ||
253 reason == CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE) { 253 reason == CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE) {
254 for (ModelTypeSet::Iterator iter = last_requested_types_.First(); 254 for (ModelTypeSet::Iterator iter = last_requested_types_.First();
255 iter.Good(); iter.Inc()) { 255 iter.Good(); iter.Inc()) {
256 // TODO(wychen): enum uma should be strongly typed. crbug.com/661401
256 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureDataTypes", 257 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureDataTypes",
257 ModelTypeToHistogramInt(iter.Get()), 258 ModelTypeToHistogramInt(iter.Get()),
258 MODEL_TYPE_COUNT); 259 static_cast<int>(MODEL_TYPE_COUNT));
259 } 260 }
260 } 261 }
261 262
262 // Check for new or resolved data type crypto errors. 263 // Check for new or resolved data type crypto errors.
263 if (encryption_handler_->IsPassphraseRequired()) { 264 if (encryption_handler_->IsPassphraseRequired()) {
264 ModelTypeSet encrypted_types = encryption_handler_->GetEncryptedDataTypes(); 265 ModelTypeSet encrypted_types = encryption_handler_->GetEncryptedDataTypes();
265 encrypted_types.RetainAll(last_requested_types_); 266 encrypted_types.RetainAll(last_requested_types_);
266 encrypted_types.RemoveAll(data_type_status_table_.GetCryptoErrorTypes()); 267 encrypted_types.RemoveAll(data_type_status_table_.GetCryptoErrorTypes());
267 DataTypeStatusTable::TypeErrorMap crypto_errors = 268 DataTypeStatusTable::TypeErrorMap crypto_errors =
268 GenerateCryptoErrorsForTypes(encrypted_types); 269 GenerateCryptoErrorsForTypes(encrypted_types);
(...skipping 590 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
« no previous file with comments | « components/sync/driver/async_directory_type_controller.cc ('k') | components/sync/driver/frontend_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698