| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ | |
| 6 #define CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ | |
| 7 | |
| 8 #include <bitset> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class HistogramBase; | |
| 14 } | |
| 15 | |
| 16 namespace policy { | |
| 17 | |
| 18 // UMA histogram enum for policy load status. Don't change existing constants, | |
| 19 // append additional constants to the end if needed. | |
| 20 enum PolicyLoadStatus { | |
| 21 // Policy load attempt started. This gets logged for each policy load attempt | |
| 22 // to get a baseline on the number of requests, and an arbitrary number of | |
| 23 // the below status codes may get added in addition. | |
| 24 POLICY_LOAD_STATUS_STARTED, | |
| 25 // System failed to determine whether there's policy. | |
| 26 POLICY_LOAD_STATUS_QUERY_FAILED, | |
| 27 // No policy present. | |
| 28 POLICY_LOAD_STATUS_NO_POLICY, | |
| 29 // Data inaccessible, such as non-local policy file. | |
| 30 POLICY_LOAD_STATUS_INACCCESSIBLE, | |
| 31 // Data missing, such as policy file not present. | |
| 32 POLICY_LOAD_STATUS_MISSING, | |
| 33 // Trying with Wow64 redirection disabled. | |
| 34 POLICY_LOAD_STATUS_WOW64_REDIRECTION_DISABLED, | |
| 35 // Data read error, for example file reading errors. | |
| 36 POLICY_LOAD_STATUS_READ_ERROR, | |
| 37 // Data too large to process. | |
| 38 POLICY_LOAD_STATUS_TOO_BIG, | |
| 39 // Parse error. | |
| 40 POLICY_LOAD_STATUS_PARSE_ERROR, | |
| 41 | |
| 42 // This must stay last. | |
| 43 POLICY_LOAD_STATUS_SIZE | |
| 44 }; | |
| 45 | |
| 46 // A helper for generating policy load status UMA statistics that'll collect | |
| 47 // histogram samples for a policy load operation and records histogram samples | |
| 48 // for the status codes that were seen on destruction. | |
| 49 class PolicyLoadStatusSample { | |
| 50 public: | |
| 51 PolicyLoadStatusSample(); | |
| 52 ~PolicyLoadStatusSample(); | |
| 53 | |
| 54 // Adds a status code. | |
| 55 void Add(PolicyLoadStatus status); | |
| 56 | |
| 57 private: | |
| 58 std::bitset<POLICY_LOAD_STATUS_SIZE> status_bits_; | |
| 59 base::HistogramBase* histogram_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(PolicyLoadStatusSample); | |
| 62 }; | |
| 63 | |
| 64 } // namespace policy | |
| 65 | |
| 66 #endif // CHROME_BROWSER_POLICY_POLICY_LOAD_STATUS_H_ | |
| OLD | NEW |