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

Unified Diff: ui/base/resource/resource_bundle.cc

Issue 537063002: Eliminate silently letting errors pass on pak loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one last time Created 6 years, 2 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
Index: ui/base/resource/resource_bundle.cc
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index 37f6c773a43ebe489772aad7f3a4b9ed16fc1a54..fba91261a1abd3c0a7a4938df2bc513635671dba 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -250,8 +250,7 @@ void ResourceBundle::AddDataPackFromFileRegion(
base::File file,
const base::MemoryMappedFile::Region& region,
ScaleFactor scale_factor) {
- scoped_ptr<DataPack> data_pack(
- new DataPack(scale_factor));
+ scoped_ptr<DataPack> data_pack(new DataPack(scale_factor));
if (data_pack->LoadFromFileRegion(file.Pass(), region)) {
AddDataPack(data_pack.release());
} else {
@@ -305,8 +304,7 @@ std::string ResourceBundle::LoadLocaleResources(
return std::string();
}
- scoped_ptr<DataPack> data_pack(
- new DataPack(SCALE_FACTOR_100P));
+ scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P));
if (!data_pack->LoadFromPath(locale_file_path)) {
UMA_HISTOGRAM_ENUMERATION("ResourceBundle.LoadLocaleResourcesError",
logging::GetLastSystemErrorCode(), 16000);
@@ -665,17 +663,15 @@ void ResourceBundle::AddDataPackFromPathInternal(const base::FilePath& path,
if (delegate_)
pack_path = delegate_->GetPathForResourcePack(pack_path, scale_factor);
- // Don't try to load empty values or values that are not absolute paths.
- if (pack_path.empty() || !pack_path.IsAbsolute())
+ // An empty path is a request from the delegate to cancel loading.
+ if (pack_path.empty())
return;
- scoped_ptr<DataPack> data_pack(
- new DataPack(scale_factor));
+ scoped_ptr<DataPack> data_pack(new DataPack(scale_factor));
if (data_pack->LoadFromPath(pack_path)) {
AddDataPack(data_pack.release());
} else if (!optional) {
- LOG(ERROR) << "Failed to load " << pack_path.value()
- << "\nSome features may not be available.";
+ DLOG(FATAL) << "Failed to load " << pack_path.value();
}
}

Powered by Google App Engine
This is Rietveld 408576698