diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 20:04:28 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 20:04:28 +0000 |
commit | 449478308895f2f09eacfb4971b9917627aa3152 (patch) | |
tree | 8e5986eb759388f6eafb16dcbb532b850516e5c4 /chrome/browser/thumbnail_store.h | |
parent | 7670df01a5a53fc1c39a0e0008813985d80ebae7 (diff) | |
download | chromium_src-449478308895f2f09eacfb4971b9917627aa3152.zip chromium_src-449478308895f2f09eacfb4971b9917627aa3152.tar.gz chromium_src-449478308895f2f09eacfb4971b9917627aa3152.tar.bz2 |
Modified ThumbnailStore to cache/store JPEGs instead
of SkBitmaps.
Add command line flag "--thumbnail-store" to enable
using the ThumbnailStore facility instead of the current
ThumbnailDatabase.
Original review: http://codereview.chromium.org/118409
Patch by Meelap Shah
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/thumbnail_store.h')
-rw-r--r-- | chrome/browser/thumbnail_store.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chrome/browser/thumbnail_store.h b/chrome/browser/thumbnail_store.h index 46b6ae0..486f99c 100644 --- a/chrome/browser/thumbnail_store.h +++ b/chrome/browser/thumbnail_store.h @@ -11,6 +11,7 @@ #include "base/file_path.h" #include "base/message_loop.h" #include "base/ref_counted.h" +#include "chrome/common/ref_counted_util.h" #include "testing/gtest/include/gtest/gtest_prod.h" class GURL; @@ -37,23 +38,22 @@ class ThumbnailStore : public base::RefCountedThreadSafe<ThumbnailStore> { // If write_to_disk is true, the thumbnail data is written to disk on the // file_thread. bool SetPageThumbnail(const GURL& url, - SkBitmap& thumbnail, + const SkBitmap& thumbnail, const ThumbnailScore& score, bool write_to_disk); - // Retrieves the thumbnail and score for the given url. + // Sets *data to point to the thumbnail for the given url. // Returns false if there is not data for the given url or some other // error occurred. - bool GetPageThumbnail(const GURL& url, - SkBitmap* thumbnail, - ThumbnailScore* score); + bool GetPageThumbnail(const GURL& url, RefCountedBytes** data); private: FRIEND_TEST(ThumbnailStoreTest, RetrieveFromCache); FRIEND_TEST(ThumbnailStoreTest, RetrieveFromDisk); // Data structure used to store thumbnail data in memory. - typedef std::map<GURL, std::pair<SkBitmap, ThumbnailScore> > Cache; + typedef std::map<GURL, std::pair<scoped_refptr<RefCountedBytes>, + ThumbnailScore> > Cache; // The location of the thumbnail store. FilePath file_path_; @@ -67,7 +67,7 @@ class ThumbnailStore : public base::RefCountedThreadSafe<ThumbnailStore> { // out parameters GURL, SkBitmap, and ThumbnailScore. bool GetPageThumbnailFromDisk(const FilePath& file, GURL* url, - SkBitmap* thumbnail, + RefCountedBytes* data, ThumbnailScore* score) const; // Once thumbnail data from the disk is available from the file_thread, @@ -86,11 +86,11 @@ class ThumbnailStore : public base::RefCountedThreadSafe<ThumbnailStore> { bool UnpackScore(ThumbnailScore* score, const Pickle& packed, void*& iter) const; - DISALLOW_COPY_AND_ASSIGN(ThumbnailStore); - // The Cache maintained by the object. scoped_ptr<ThumbnailStore::Cache> cache_; bool cache_initialized_; + + DISALLOW_COPY_AND_ASSIGN(ThumbnailStore); }; #endif // CHROME_BROWSER_THUMBNAIL_STORE_H_ |