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

Unified Diff: chrome/browser/policy/preg_parser_win.cc

Issue 14294008: Add UMA histograms for policy loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/preg_parser_win.h ('k') | chrome/browser/policy/preg_parser_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/preg_parser_win.cc
diff --git a/chrome/browser/policy/preg_parser_win.cc b/chrome/browser/policy/preg_parser_win.cc
index 9963506f0ac560db502235d81c86dab14333d5e8..099db4072962c38e2a57bfe7640c6765398b4007 100644
--- a/chrome/browser/policy/preg_parser_win.cc
+++ b/chrome/browser/policy/preg_parser_win.cc
@@ -19,6 +19,7 @@
#include "base/sys_byteorder.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/policy/policy_load_status.h"
namespace policy {
namespace preg_parser {
@@ -214,16 +215,19 @@ void HandleRecord(const string16& key_name,
bool ReadFile(const base::FilePath& file_path,
const string16& root,
- base::DictionaryValue* dict) {
+ base::DictionaryValue* dict,
+ PolicyLoadStatusSample* status) {
base::MemoryMappedFile mapped_file;
if (!mapped_file.Initialize(file_path) || !mapped_file.IsValid()) {
PLOG(ERROR) << "Failed to map " << file_path.value();
+ status->Add(POLICY_LOAD_STATUS_READ_ERROR);
return false;
}
if (mapped_file.length() > kMaxPRegFileSize) {
LOG(ERROR) << "PReg file " << file_path.value() << " too large: "
<< mapped_file.length();
+ status->Add(POLICY_LOAD_STATUS_TOO_BIG);
return false;
}
@@ -232,6 +236,7 @@ bool ReadFile(const base::FilePath& file_path,
if (mapped_file.length() < kHeaderSize ||
memcmp(kPolicyRegistryFileHeader, mapped_file.data(), kHeaderSize) != 0) {
LOG(ERROR) << "Bad policy file " << file_path.value();
+ status->Add(POLICY_LOAD_STATUS_PARSE_ERROR);
return false;
}
@@ -295,6 +300,7 @@ bool ReadFile(const base::FilePath& file_path,
LOG(ERROR) << "Error parsing " << file_path.value() << " at offset "
<< reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data();
+ status->Add(POLICY_LOAD_STATUS_PARSE_ERROR);
return false;
}
« no previous file with comments | « chrome/browser/policy/preg_parser_win.h ('k') | chrome/browser/policy/preg_parser_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698