diff options
author | simon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 16:18:35 +0000 |
---|---|---|
committer | simon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 16:18:35 +0000 |
commit | 90fa26548ea8e328b0c1de44fc3d2cf4ae4eacb3 (patch) | |
tree | 235a9415585abee3dc1a3767c898f55ccdeb7007 /ui/base | |
parent | 386ef8cfc747ea354f9b9d38a2603e099afc3892 (diff) | |
download | chromium_src-90fa26548ea8e328b0c1de44fc3d2cf4ae4eacb3.zip chromium_src-90fa26548ea8e328b0c1de44fc3d2cf4ae4eacb3.tar.gz chromium_src-90fa26548ea8e328b0c1de44fc3d2cf4ae4eacb3.tar.bz2 |
Move RefCountedStaticMemory to base namespace
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/10165020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/resource/data_pack.cc | 5 | ||||
-rw-r--r-- | ui/base/resource/data_pack.h | 5 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 5 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.h | 4 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_gtk.cc | 5 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_mac.mm | 3 | ||||
-rw-r--r-- | ui/base/resource/resource_data_dll_win.cc | 4 | ||||
-rw-r--r-- | ui/base/resource/resource_data_dll_win.h | 2 | ||||
-rw-r--r-- | ui/base/resource/resource_handle.h | 5 |
9 files changed, 24 insertions, 14 deletions
diff --git a/ui/base/resource/data_pack.cc b/ui/base/resource/data_pack.cc index ccd062c..6a8490c 100644 --- a/ui/base/resource/data_pack.cc +++ b/ui/base/resource/data_pack.cc @@ -169,12 +169,13 @@ bool DataPack::GetStringPiece(uint16 resource_id, return true; } -RefCountedStaticMemory* DataPack::GetStaticMemory(uint16 resource_id) const { +base::RefCountedStaticMemory* DataPack::GetStaticMemory( + uint16 resource_id) const { base::StringPiece piece; if (!GetStringPiece(resource_id, &piece)) return NULL; - return new RefCountedStaticMemory( + return new base::RefCountedStaticMemory( reinterpret_cast<const unsigned char*>(piece.data()), piece.length()); } diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h index 11adf99..5e3426f 100644 --- a/ui/base/resource/data_pack.h +++ b/ui/base/resource/data_pack.h @@ -19,7 +19,10 @@ #include "ui/base/resource/resource_handle.h" class FilePath; + +namespace base { class RefCountedStaticMemory; +} namespace file_util { class MemoryMappedFile; @@ -46,7 +49,7 @@ class UI_EXPORT DataPack : public ResourceHandle { // ResourceHandle implementation: virtual bool GetStringPiece(uint16 resource_id, base::StringPiece* data) const OVERRIDE; - virtual RefCountedStaticMemory* GetStaticMemory( + virtual base::RefCountedStaticMemory* GetStaticMemory( uint16 resource_id) const OVERRIDE; virtual TextEncodingType GetTextEncodingType() const OVERRIDE; diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 98da4d4..13aaacf 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/stl_util.h" @@ -270,10 +271,10 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { return GetNativeImageNamed(resource_id, RTL_DISABLED); } -RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( +base::RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( int resource_id) const { for (size_t i = 0; i < data_packs_.size(); ++i) { - RefCountedStaticMemory* bytes = + base::RefCountedStaticMemory* bytes = data_packs_[i]->GetStaticMemory(resource_id); if (bytes) return bytes; diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index f7a5172..974e5d3 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -14,7 +14,6 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/gtest_prod_util.h" -#include "base/memory/ref_counted_memory.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/string16.h" @@ -26,6 +25,7 @@ class SkBitmap; namespace base { class Lock; +class RefCountedStaticMemory; } namespace gfx { @@ -127,7 +127,7 @@ class UI_EXPORT ResourceBundle { // Loads the raw bytes of a data resource into |bytes|, // without doing any processing or interpretation of // the resource. Returns whether we successfully read the resource. - RefCountedStaticMemory* LoadDataResourceBytes(int resource_id) const; + base::RefCountedStaticMemory* LoadDataResourceBytes(int resource_id) const; // Return the contents of a resource in a StringPiece given the resource id. base::StringPiece GetRawDataResource(int resource_id) const; diff --git a/ui/base/resource/resource_bundle_gtk.cc b/ui/base/resource/resource_bundle_gtk.cc index f397307..ddabaf3 100644 --- a/ui/base/resource/resource_bundle_gtk.cc +++ b/ui/base/resource/resource_bundle_gtk.cc @@ -6,6 +6,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/synchronization/lock.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/gtk/scoped_gobject.h" @@ -20,7 +21,7 @@ namespace { // Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned // has a ref count of 1 so the caller must call g_object_unref to free the // memory. -GdkPixbuf* LoadPixbuf(RefCountedStaticMemory* data, bool rtl_enabled) { +GdkPixbuf* LoadPixbuf(base::RefCountedStaticMemory* data, bool rtl_enabled) { ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); bool ok = data && gdk_pixbuf_loader_write(loader.get(), reinterpret_cast<const guint8*>(data->front()), data->size(), NULL); @@ -62,7 +63,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { return *found->second; } - scoped_refptr<RefCountedStaticMemory> data( + scoped_refptr<base::RefCountedStaticMemory> data( LoadDataResourceBytes(resource_id)); GdkPixbuf* pixbuf = LoadPixbuf(data.get(), rtl == RTL_ENABLED); diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 6e4002d..ee2a6ef 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -10,6 +10,7 @@ #include "base/file_path.h" #include "base/mac/bundle_locations.h" #include "base/mac/mac_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/memory/scoped_nsobject.h" #include "base/synchronization/lock.h" #include "base/sys_string_conversions.h" @@ -94,7 +95,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { scoped_nsobject<NSImage> ns_image; for (size_t i = 0; i < data_packs_.size(); ++i) { - scoped_refptr<RefCountedStaticMemory> data( + scoped_refptr<base::RefCountedStaticMemory> data( data_packs_[i]->GetStaticMemory(resource_id)); if (!data.get()) continue; diff --git a/ui/base/resource/resource_data_dll_win.cc b/ui/base/resource/resource_data_dll_win.cc index 16f6a25..4c7e052 100644 --- a/ui/base/resource/resource_data_dll_win.cc +++ b/ui/base/resource/resource_data_dll_win.cc @@ -32,13 +32,13 @@ bool ResourceDataDLL::GetStringPiece(uint16 resource_id, return false; } -RefCountedStaticMemory* ResourceDataDLL::GetStaticMemory( +base::RefCountedStaticMemory* ResourceDataDLL::GetStaticMemory( uint16 resource_id) const { void* data_ptr; size_t data_size; if (base::win::GetDataResourceFromModule(module_, resource_id, &data_ptr, &data_size)) { - return new RefCountedStaticMemory( + return new base::RefCountedStaticMemory( reinterpret_cast<const unsigned char*>(data_ptr), data_size); } return NULL; diff --git a/ui/base/resource/resource_data_dll_win.h b/ui/base/resource/resource_data_dll_win.h index e7b3cf1..9b9a6a0 100644 --- a/ui/base/resource/resource_data_dll_win.h +++ b/ui/base/resource/resource_data_dll_win.h @@ -21,7 +21,7 @@ class ResourceDataDLL : public ResourceHandle { // ResourceHandle implementation: virtual bool GetStringPiece(uint16 resource_id, base::StringPiece* data) const OVERRIDE; - virtual RefCountedStaticMemory* GetStaticMemory( + virtual base::RefCountedStaticMemory* GetStaticMemory( uint16 resource_id) const OVERRIDE; virtual TextEncodingType GetTextEncodingType() const OVERRIDE; diff --git a/ui/base/resource/resource_handle.h b/ui/base/resource/resource_handle.h index 45c1969..ce3a23b 100644 --- a/ui/base/resource/resource_handle.h +++ b/ui/base/resource/resource_handle.h @@ -10,7 +10,9 @@ #include "base/string_piece.h" #include "ui/base/ui_export.h" +namespace base { class RefCountedStaticMemory; +} namespace ui { @@ -33,7 +35,8 @@ class UI_EXPORT ResourceHandle { // Like GetStringPiece(), but returns a reference to memory. // Caller owns the returned object. - virtual RefCountedStaticMemory* GetStaticMemory(uint16 resource_id) const = 0; + virtual base::RefCountedStaticMemory* GetStaticMemory( + uint16 resource_id) const = 0; // Get the encoding type of text resources. virtual TextEncodingType GetTextEncodingType() const = 0; |