summaryrefslogtreecommitdiffstats
path: root/ui/base/resource
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 21:53:18 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 21:53:18 +0000
commitfb76114572fbb128d2d8c4806d6f71e0da4f2835 (patch)
tree02ccd89396b104137459bbdc2139173b67d217ab /ui/base/resource
parent30c8e3be07474fae685ff7331d6d481f96703386 (diff)
downloadchromium_src-fb76114572fbb128d2d8c4806d6f71e0da4f2835.zip
chromium_src-fb76114572fbb128d2d8c4806d6f71e0da4f2835.tar.gz
chromium_src-fb76114572fbb128d2d8c4806d6f71e0da4f2835.tar.bz2
Downgrade a CHECK to a NOTREACHED in ResourceBundle::LoadLocaleResources.
This is a case where we're failing to mmap the file, even though it exists on disk. For example, we can't read the file or it has a size of 0. We don't need to CHECK because in chrome_browser_main.cc, we prompt the user to reinstall if this happens. BUG=100395 Review URL: http://codereview.chromium.org/8301017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/resource')
-rw-r--r--ui/base/resource/data_pack.cc6
-rw-r--r--ui/base/resource/resource_bundle.cc8
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;
}