summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 17:04:46 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 17:04:46 +0000
commit6de2799a47cbc201d943b32e0ac62555dc45f662 (patch)
tree6c64342df90783c5f334d370d6f8cb08472fcd7f /chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
parent5f1b13bc6952eb89149716930e654c9d989b9e13 (diff)
downloadchromium_src-6de2799a47cbc201d943b32e0ac62555dc45f662.zip
chromium_src-6de2799a47cbc201d943b32e0ac62555dc45f662.tar.gz
chromium_src-6de2799a47cbc201d943b32e0ac62555dc45f662.tar.bz2
First fix to minimize copying of image data.
This is the first of multiple patches that clean up handling of memory regarding images. Previously, the code did several memcpy()s or equivalents. This change: - Creates an abstract interface RefCountedMemory which provides access to the front() of a memory range and the size() of it. It is a RefCountedThreadSafe. - Adds a RefCountedStaticMemory class which isa RefCountedMemory. - Pushes RefCountedBytes up into base/ from chrome/ and make it conform to RefCountedMemory. - Have ResourceBundle return RefCountedStaticMemory to the mmaped() or DLL loaded resources instead of memcpy()ing them. - General cleanups to minimize copies in constructing RefCountedBytes. - Use the above consistent interface in the BrowserThemeProvider, along with special casing the loading of the new tab page background. This patch is mostly cleanups and there should only be a slight performance gain if any. Most of the real speedups should come in subsequent patches. BUG=http://crbug.com/24493 TEST=Slightly faster on Perf bot; does not introduce crashes. Review URL: http://codereview.chromium.org/288005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29412 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/dom_ui_thumbnail_source.cc')
-rw-r--r--chrome/browser/dom_ui/dom_ui_thumbnail_source.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
index acb8276..c455b26 100644
--- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
@@ -64,9 +64,9 @@ void DOMUIThumbnailSource::DoDataRequest(const std::string& path,
} else {
// Don't have the thumbnail so return the default thumbnail.
if (!default_thumbnail_.get()) {
- default_thumbnail_ = new RefCountedBytes;
- ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
- IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
+ default_thumbnail_ =
+ ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
+ IDR_DEFAULT_THUMBNAIL);
}
SendResponse(request_id, default_thumbnail_);
}
@@ -83,9 +83,9 @@ void DOMUIThumbnailSource::OnThumbnailDataAvailable(
SendResponse(request_id, data);
} else {
if (!default_thumbnail_.get()) {
- default_thumbnail_ = new RefCountedBytes;
- ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
- IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
+ default_thumbnail_ =
+ ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
+ IDR_DEFAULT_THUMBNAIL);
}
SendResponse(request_id, default_thumbnail_);