summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 17:52:50 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 17:52:50 +0000
commita223028a2c2d8113c9dbad9681e65268a8229b9a (patch)
treed373afb061ef288a94dd632a9fcbed9c7805141f /app
parent53ae7c4c5f08e73d66ef8b2303691d893f5d9e47 (diff)
downloadchromium_src-a223028a2c2d8113c9dbad9681e65268a8229b9a.zip
chromium_src-a223028a2c2d8113c9dbad9681e65268a8229b9a.tar.gz
chromium_src-a223028a2c2d8113c9dbad9681e65268a8229b9a.tar.bz2
Revert 50257 - Reland r50057. This is exactly the same except with two lines cherrypicked from
tony's CL 2814009 that tell make about the net_internals_resources_map.{cc,h} files. Load net-internals from the newly created resources.pak file. This patch also forces the loading of the optional DataPack for const correctness reasons Original Review: http://codereview.chromium.org/2855003 BUG=35793,42770 TEST=none TBR=tony Review URL: http://codereview.chromium.org/2800014 TBR=erg@chromium.org Review URL: http://codereview.chromium.org/2811016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/resource_bundle.cc28
-rw-r--r--app/resource_bundle.h5
2 files changed, 11 insertions, 22 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);
-}
diff --git a/app/resource_bundle.h b/app/resource_bundle.h
index 1d328a3..3a3e617 100644
--- a/app/resource_bundle.h
+++ b/app/resource_bundle.h
@@ -159,9 +159,8 @@ class ResourceBundle {
// Helper class for managing data packs.
class LoadedDataPack {
public:
- explicit LoadedDataPack(const FilePath& path);
- bool GetStringPiece(int resource_id, base::StringPiece* data) const;
- RefCountedStaticMemory* GetStaticMemory(int resource_id) const;
+ LoadedDataPack(const FilePath& path);
+ bool GetStringPiece(int resource_id, base::StringPiece* data);
private:
void Load();