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

Side by Side Diff: components/policy/core/common/cloud/device_management_service.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/policy/core/common/cloud/device_management_service.h" 5 #include "components/policy/core/common/cloud/device_management_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return; 293 return;
294 } 294 }
295 295
296 if (response_code != kSuccess) { 296 if (response_code != kSuccess) {
297 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess", 297 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess",
298 DMServerRequestSuccess::REQUEST_ERROR, 298 DMServerRequestSuccess::REQUEST_ERROR,
299 DMServerRequestSuccess::REQUEST_MAX); 299 DMServerRequestSuccess::REQUEST_MAX);
300 LOG(WARNING) << "DMServer sent an error response: " << response_code; 300 LOG(WARNING) << "DMServer sent an error response: " << response_code;
301 } else { 301 } else {
302 // Success with retries_count_ retries. 302 // Success with retries_count_ retries.
303 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess", 303 UMA_HISTOGRAM_EXACT_LINEAR(
304 retries_count_, 304 "Enterprise.DMServerRequestSuccess", retries_count_,
305 DMServerRequestSuccess::REQUEST_MAX); 305 static_cast<int>(DMServerRequestSuccess::REQUEST_MAX));
306 } 306 }
307 307
308 switch (response_code) { 308 switch (response_code) {
309 case kSuccess: { 309 case kSuccess: {
310 em::DeviceManagementResponse response; 310 em::DeviceManagementResponse response;
311 if (!response.ParseFromString(data)) { 311 if (!response.ParseFromString(data)) {
312 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR); 312 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR);
313 return; 313 return;
314 } 314 }
315 callback_.Run(DM_STATUS_SUCCESS, net::OK, response); 315 callback_.Run(DM_STATUS_SUCCESS, net::OK, response);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 706 }
707 } 707 }
708 708
709 const JobQueue::iterator elem = 709 const JobQueue::iterator elem =
710 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 710 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
711 if (elem != queued_jobs_.end()) 711 if (elem != queued_jobs_.end())
712 queued_jobs_.erase(elem); 712 queued_jobs_.erase(elem);
713 } 713 }
714 714
715 } // namespace policy 715 } // namespace policy
OLDNEW
« no previous file with comments | « components/payments/core/journey_logger.cc ('k') | components/search_provider_logos/logo_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698