diff options
Diffstat (limited to 'ui/base/resource')
-rw-r--r-- | ui/base/resource/data_pack.cc | 6 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/ui/base/resource/data_pack.cc b/ui/base/resource/data_pack.cc index 5a0dcf1..be44afa 100644 --- a/ui/base/resource/data_pack.cc +++ b/ui/base/resource/data_pack.cc @@ -51,6 +51,8 @@ enum LoadErrors { BAD_VERSION, INDEX_TRUNCATED, ENTRY_NOT_FOUND, + HEADER_TRUNCATED, + WRONG_ENCODING, LOAD_ERRORS_COUNT, }; @@ -78,6 +80,8 @@ bool DataPack::Load(const FilePath& path) { // Sanity check the header of the file. if (kHeaderLength > mmap_->length()) { DLOG(ERROR) << "Data pack file corruption: incomplete file header."; + UMA_HISTOGRAM_ENUMERATION("DataPack.Load", HEADER_TRUNCATED, + LOAD_ERRORS_COUNT); mmap_.reset(); return false; } @@ -103,6 +107,8 @@ bool DataPack::Load(const FilePath& path) { text_encoding_type_ != BINARY) { LOG(ERROR) << "Bad data pack text encoding: got " << text_encoding_type_ << ", expected between " << BINARY << " and " << UTF16; + UMA_HISTOGRAM_ENUMERATION("DataPack.Load", WRONG_ENCODING, + LOAD_ERRORS_COUNT); mmap_.reset(); return false; } diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index f1722ff..0e973f8 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/stl_util.h" #include "base/string_piece.h" @@ -161,7 +162,12 @@ std::string ResourceBundle::LoadLocaleResources( return std::string(); } locale_resources_data_.reset(LoadResourcesDataPak(locale_file_path)); - CHECK(locale_resources_data_.get()) << "failed to load locale.pak"; + if (!locale_resources_data_.get()) { + UMA_HISTOGRAM_ENUMERATION("ResourceBundle.LoadLocaleResourcesError", + logging::GetLastSystemErrorCode(), 16000); + NOTREACHED() << "failed to load locale.pak"; + return std::string(); + } return app_locale; } |