diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 22:04:02 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-02 22:04:02 +0000 |
commit | f46251eeb2b498c749a8ec776f2a8e39409a321e (patch) | |
tree | d3203d530800ac6db6acaac22438ac35fc8d44df /app | |
parent | 44ac8912f993424d041460d526ff131286e8c5ca (diff) | |
download | chromium_src-f46251eeb2b498c749a8ec776f2a8e39409a321e.zip chromium_src-f46251eeb2b498c749a8ec776f2a8e39409a321e.tar.gz chromium_src-f46251eeb2b498c749a8ec776f2a8e39409a321e.tar.bz2 |
Remove themes/default.dll and merge the resources into chrome.dll.
This gives us one less file to load on startup. This does mean
that some tests need to explicitly include theme_resources.rc.
BUG=24035
Review URL: http://codereview.chromium.org/348033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/resource_bundle.cc | 14 | ||||
-rw-r--r-- | app/resource_bundle.h | 20 | ||||
-rw-r--r-- | app/resource_bundle_linux.cc | 8 | ||||
-rw-r--r-- | app/resource_bundle_mac.mm | 8 | ||||
-rw-r--r-- | app/resource_bundle_win.cc | 18 | ||||
-rw-r--r-- | app/test_suite.h | 1 |
6 files changed, 12 insertions, 57 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index a2ebdf0..6d8829d 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -55,8 +55,7 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { ResourceBundle::ResourceBundle() : resources_data_(NULL), - locale_resources_data_(NULL), - theme_data_(NULL) { + locale_resources_data_(NULL) { } void ResourceBundle::FreeImages() { @@ -89,7 +88,7 @@ std::string ResourceBundle::GetDataResource(int resource_id) { RefCountedStaticMemory* ResourceBundle::LoadImageResourceBytes( int resource_id) { - return LoadResourceBytes(theme_data_, resource_id); + return LoadResourceBytes(resources_data_, resource_id); } RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( @@ -108,15 +107,10 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { scoped_ptr<SkBitmap> bitmap; - if (theme_data_) - bitmap.reset(LoadBitmap(theme_data_, resource_id)); - - // If we did not find the bitmap in the theme DLL, try the current one. - if (!bitmap.get()) - bitmap.reset(LoadBitmap(resources_data_, resource_id)); + bitmap.reset(LoadBitmap(resources_data_, resource_id)); - // We loaded successfully. Cache the Skia version of the bitmap. if (bitmap.get()) { + // We loaded successfully. Cache the Skia version of the bitmap. AutoLock lock_scope(lock_); // Another thread raced us, and has already cached the skia image. diff --git a/app/resource_bundle.h b/app/resource_bundle.h index a59cbfd..e4819c3 100644 --- a/app/resource_bundle.h +++ b/app/resource_bundle.h @@ -74,13 +74,9 @@ class ResourceBundle { // Return the global resource loader instance. static ResourceBundle& GetSharedInstance(); - // Load the data file that contains theme resources if present. - void LoadThemeResources(); - - // Gets the bitmap with the specified resource_id, first by looking into the - // theme data, then in the current module data if applicable. - // Returns a pointer to a shared instance of the SkBitmap. This shared bitmap - // is owned by the resource bundle and should not be freed. + // Gets the bitmap with the specified resource_id from the current module + // data. Returns a pointer to a shared instance of the SkBitmap. This shared + // bitmap is owned by the resource bundle and should not be freed. // // The bitmap is assumed to exist. This function will log in release, and // assert in debug mode if it does not. On failure, this will return a @@ -116,7 +112,7 @@ class ResourceBundle { const gfx::Font& GetFont(FontStyle style); #if defined(OS_WIN) - // Loads and returns an icon from the theme dll. + // Loads and returns an icon from the app module. HICON LoadThemeIcon(int icon_id); // Loads and returns a cursor from the app module. @@ -125,10 +121,9 @@ class ResourceBundle { // Wrapper for GetBitmapNamed. Converts the bitmap to an autoreleased NSImage. NSImage* GetNSImageNamed(int resource_id); #elif defined(USE_X11) - // Gets the GdkPixbuf with the specified resource_id, first by looking into - // the theme data, than in the current module data if applicable. Returns a - // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is - // owned by the resource bundle and should not be freed. + // Gets the GdkPixbuf with the specified resource_id from the main data pak + // file. Returns a pointer to a shared instance of the GdkPixbuf. This + // shared GdkPixbuf is owned by the resource bundle and should not be freed. // // The bitmap is assumed to exist. This function will log in release, and // assert in debug mode if it does not. On failure, this will return a @@ -203,7 +198,6 @@ class ResourceBundle { // Handles for data sources. DataHandle resources_data_; DataHandle locale_resources_data_; - DataHandle theme_data_; // Cached images. The ResourceBundle caches all retrieved bitmaps and keeps // ownership of the pointers. diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc index 1fe4cb6..99ac0d7 100644 --- a/app/resource_bundle_linux.cc +++ b/app/resource_bundle_linux.cc @@ -69,7 +69,6 @@ ResourceBundle::~ResourceBundle() { locale_resources_data_ = NULL; delete resources_data_; resources_data_ = NULL; - theme_data_ = NULL; } void ResourceBundle::LoadResources(const std::wstring& pref_locale) { @@ -107,13 +106,6 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { return locale_path.AppendASCII(app_locale + ".pak"); } -void ResourceBundle::LoadThemeResources() { - // The data has been merged with chrome.pak so just set the pointer to be - // the same file. - DCHECK(resources_data_); - theme_data_ = resources_data_; -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm index 7a6139f..547c84b 100644 --- a/app/resource_bundle_mac.mm +++ b/app/resource_bundle_mac.mm @@ -26,7 +26,6 @@ ResourceBundle::~ResourceBundle() { locale_resources_data_ = NULL; delete resources_data_; resources_data_ = NULL; - theme_data_ = NULL; } namespace { @@ -64,13 +63,6 @@ void ResourceBundle::LoadResources(const std::wstring& pref_locale) { DCHECK(locale_resources_data_) << "failed to load locale.pak"; } -void ResourceBundle::LoadThemeResources() { - // The data has been merged with chrome.pak so just set the pointer to be - // the same file. - DCHECK(resources_data_); - theme_data_ = resources_data_; -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc index 0c25c47..63645d4 100644 --- a/app/resource_bundle_win.cc +++ b/app/resource_bundle_win.cc @@ -36,10 +36,6 @@ ResourceBundle::~ResourceBundle() { BOOL rv = FreeLibrary(locale_resources_data_); DCHECK(rv); } - if (theme_data_) { - BOOL rv = FreeLibrary(theme_data_); - DCHECK(rv); - } } void ResourceBundle::LoadResources(const std::wstring& pref_locale) { @@ -73,18 +69,6 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { return locale_path.AppendASCII(app_locale + ".dll"); } -void ResourceBundle::LoadThemeResources() { - DCHECK(NULL == theme_data_) << "theme dll already loaded"; - FilePath theme_data_path; - PathService::Get(app::DIR_THEMES, &theme_data_path); - theme_data_path = theme_data_path.AppendASCII("default.dll"); - - // The dll should only have resources, not executable code. - theme_data_ = LoadLibraryEx(theme_data_path.value().c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path.value(); -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { @@ -100,7 +84,7 @@ RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( } HICON ResourceBundle::LoadThemeIcon(int icon_id) { - return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); + return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id)); } base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { diff --git a/app/test_suite.h b/app/test_suite.h index 038d4a7..4826b4f 100644 --- a/app/test_suite.h +++ b/app/test_suite.h @@ -52,7 +52,6 @@ class AppTestSuite : public TestSuite { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ResourceBundle::InitSharedInstance(L"en-US"); - ResourceBundle::GetSharedInstance().LoadThemeResources(); } virtual void Shutdown() { |