| Index: ui/base/resource/resource_bundle.cc
|
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
|
| index a3c31f075becb93fbe57030485191e132ac4d680..7e66615fa1b4f0490b78f17dfcd0c6c077f27776 100644
|
| --- a/ui/base/resource/resource_bundle.cc
|
| +++ b/ui/base/resource/resource_bundle.cc
|
| @@ -211,7 +211,7 @@
|
| base::File pak_file,
|
| const base::MemoryMappedFile::Region& region) {
|
| InitSharedInstance(NULL);
|
| - auto data_pack = base::MakeUnique<DataPack>(SCALE_FACTOR_100P);
|
| + std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P));
|
| if (!data_pack->LoadFromFileRegion(std::move(pak_file), region)) {
|
| NOTREACHED() << "failed to load pak file";
|
| return;
|
| @@ -246,17 +246,6 @@
|
| // Must call InitSharedInstance before this function.
|
| CHECK(g_shared_instance_ != NULL);
|
| return *g_shared_instance_;
|
| -}
|
| -
|
| -void ResourceBundle::LoadSecondaryLocaleDataWithPakFileRegion(
|
| - base::File pak_file,
|
| - const base::MemoryMappedFile::Region& region) {
|
| - auto data_pack = base::MakeUnique<DataPack>(SCALE_FACTOR_100P);
|
| - if (!data_pack->LoadFromFileRegion(std::move(pak_file), region)) {
|
| - NOTREACHED() << "failed to load secondary pak file";
|
| - return;
|
| - }
|
| - secondary_locale_resources_data_ = std::move(data_pack);
|
| }
|
|
|
| #if !defined(OS_ANDROID)
|
| @@ -400,7 +389,6 @@
|
|
|
| void ResourceBundle::UnloadLocaleResources() {
|
| locale_resources_data_.reset();
|
| - secondary_locale_resources_data_.reset();
|
| }
|
|
|
| void ResourceBundle::OverrideLocalePakForTest(const base::FilePath& pak_path) {
|
| @@ -563,27 +551,20 @@
|
| }
|
|
|
| base::StringPiece data;
|
| + if (!locale_resources_data_->GetStringPiece(static_cast<uint16_t>(message_id),
|
| + &data)) {
|
| + // Fall back on the main data pack (shouldn't be any strings here except in
|
| + // unittests).
|
| + data = GetRawDataResource(message_id);
|
| + if (data.empty()) {
|
| + NOTREACHED() << "unable to find resource: " << message_id;
|
| + return base::string16();
|
| + }
|
| + }
|
| +
|
| + // Strings should not be loaded from a data pack that contains binary data.
|
| ResourceHandle::TextEncodingType encoding =
|
| locale_resources_data_->GetTextEncodingType();
|
| - if (!locale_resources_data_->GetStringPiece(static_cast<uint16_t>(message_id),
|
| - &data)) {
|
| - if (secondary_locale_resources_data_.get() &&
|
| - secondary_locale_resources_data_->GetStringPiece(
|
| - static_cast<uint16_t>(message_id), &data)) {
|
| - // Fall back on the secondary locale pak if it exists.
|
| - encoding = secondary_locale_resources_data_->GetTextEncodingType();
|
| - } else {
|
| - // Fall back on the main data pack (shouldn't be any strings here except
|
| - // in unittests).
|
| - data = GetRawDataResource(message_id);
|
| - if (data.empty()) {
|
| - NOTREACHED() << "unable to find resource: " << message_id;
|
| - return base::string16();
|
| - }
|
| - }
|
| - }
|
| -
|
| - // Strings should not be loaded from a data pack that contains binary data.
|
| DCHECK(encoding == ResourceHandle::UTF16 || encoding == ResourceHandle::UTF8)
|
| << "requested localized string from binary pack file";
|
|
|
| @@ -603,16 +584,8 @@
|
| {
|
| base::AutoLock lock_scope(*locale_resources_data_lock_);
|
| base::StringPiece data;
|
| -
|
| if (locale_resources_data_.get() &&
|
| locale_resources_data_->GetStringPiece(
|
| - static_cast<uint16_t>(resource_id), &data) &&
|
| - !data.empty()) {
|
| - return new base::RefCountedStaticMemory(data.data(), data.length());
|
| - }
|
| -
|
| - if (secondary_locale_resources_data_.get() &&
|
| - secondary_locale_resources_data_->GetStringPiece(
|
| static_cast<uint16_t>(resource_id), &data) &&
|
| !data.empty()) {
|
| return new base::RefCountedStaticMemory(data.data(), data.length());
|
|
|