summaryrefslogtreecommitdiffstats
path: root/app/resource_bundle.cc
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 00:45:34 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 00:45:34 +0000
commit1408c8297755306f0d688956fbc2f93fd6d692ac (patch)
tree50997a29208c8505961d7fd8634b7abd2a632c5c /app/resource_bundle.cc
parentc01c61d5d1b86b72e4e1ee4a96870196a8057644 (diff)
downloadchromium_src-1408c8297755306f0d688956fbc2f93fd6d692ac.zip
chromium_src-1408c8297755306f0d688956fbc2f93fd6d692ac.tar.gz
chromium_src-1408c8297755306f0d688956fbc2f93fd6d692ac.tar.bz2
Revert 50057 - Load net-internals from the newly created resources.pak file.
This patch also forces the loading of the optional DataPack for const correctness reasons BUG=35793,42770 TEST=none Review URL: http://codereview.chromium.org/2855003 TBR=erg@chromium.org Review URL: http://codereview.chromium.org/2852011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/resource_bundle.cc')
-rw-r--r--app/resource_bundle.cc28
1 files changed, 9 insertions, 19 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc
index d61e83d..dcf7fa8 100644
--- a/app/resource_bundle.cc
+++ b/app/resource_bundle.cc
@@ -105,17 +105,7 @@ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) {
RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes(
int resource_id) const {
- RefCountedStaticMemory* bytes =
- LoadResourceBytes(resources_data_, resource_id);
-
- // Check all our additional data packs for the resources if it wasn't loaded
- // from our main source.
- for (std::vector<LoadedDataPack*>::const_iterator it = data_packs_.begin();
- !bytes && it != data_packs_.end(); ++it) {
- bytes = (*it)->GetStaticMemory(resource_id);
- }
-
- return bytes;
+ return LoadResourceBytes(resources_data_, resource_id);
}
SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) {
@@ -208,8 +198,11 @@ const gfx::Font& ResourceBundle::GetFont(FontStyle style) {
// LoadedDataPack implementation
ResourceBundle::LoadedDataPack::LoadedDataPack(const FilePath& path)
: path_(path) {
- // Always preload the data packs so we can maintain constness.
+ // On unicies, we preload data packs so background updates don't cause us to
+ // load the wrong data.
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
Load();
+#endif
}
void ResourceBundle::LoadedDataPack::Load() {
@@ -219,12 +212,9 @@ void ResourceBundle::LoadedDataPack::Load() {
CHECK(success) << "Failed to load " << path_.value();
}
-bool ResourceBundle::LoadedDataPack::GetStringPiece(
- int resource_id, base::StringPiece* data) const {
+bool ResourceBundle::LoadedDataPack::GetStringPiece(int resource_id,
+ base::StringPiece* data) {
+ if (!data_pack_.get())
+ Load();
return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data);
}
-
-RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory(
- int resource_id) const {
- return data_pack_->GetStaticMemory(resource_id);
-}