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

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: 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 (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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return; 291 return;
292 } 292 }
293 293
294 if (response_code != kSuccess) { 294 if (response_code != kSuccess) {
295 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess", 295 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess",
296 DMServerRequestSuccess::REQUEST_ERROR, 296 DMServerRequestSuccess::REQUEST_ERROR,
297 DMServerRequestSuccess::REQUEST_MAX); 297 DMServerRequestSuccess::REQUEST_MAX);
298 LOG(WARNING) << "DMServer sent an error response: " << response_code; 298 LOG(WARNING) << "DMServer sent an error response: " << response_code;
299 } else { 299 } else {
300 // Success with retries_count_ retries. 300 // Success with retries_count_ retries.
301 UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess", 301 UMA_HISTOGRAM_EXACT_LINEAR(
302 retries_count_, 302 "Enterprise.DMServerRequestSuccess", retries_count_,
303 DMServerRequestSuccess::REQUEST_MAX); 303 static_cast<int>(DMServerRequestSuccess::REQUEST_MAX));
304 } 304 }
305 305
306 switch (response_code) { 306 switch (response_code) {
307 case kSuccess: { 307 case kSuccess: {
308 em::DeviceManagementResponse response; 308 em::DeviceManagementResponse response;
309 if (!response.ParseFromString(data)) { 309 if (!response.ParseFromString(data)) {
310 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR); 310 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR);
311 return; 311 return;
312 } 312 }
313 callback_.Run(DM_STATUS_SUCCESS, net::OK, response); 313 callback_.Run(DM_STATUS_SUCCESS, net::OK, response);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 704 }
705 } 705 }
706 706
707 const JobQueue::iterator elem = 707 const JobQueue::iterator elem =
708 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 708 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
709 if (elem != queued_jobs_.end()) 709 if (elem != queued_jobs_.end())
710 queued_jobs_.erase(elem); 710 queued_jobs_.erase(elem);
711 } 711 }
712 712
713 } // namespace policy 713 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698