diff options
author | meelapshah@chromium.org <meelapshah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 22:56:46 +0000 |
---|---|---|
committer | meelapshah@chromium.org <meelapshah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 22:56:46 +0000 |
commit | 2a58420b7c51fc7649d88b475a324385683c4106 (patch) | |
tree | 9e5d3a16e9ebc36d6c39828bcd000c18ebc9907e /chrome/browser/thumbnail_store.cc | |
parent | 0d63354d16ebf48e0fcd105db1fc7e421ba9b3fe (diff) | |
download | chromium_src-2a58420b7c51fc7649d88b475a324385683c4106.zip chromium_src-2a58420b7c51fc7649d88b475a324385683c4106.tar.gz chromium_src-2a58420b7c51fc7649d88b475a324385683c4106.tar.bz2 |
WriteThumbnailToDisk runs on a bg thread so it cannot access the cache_ directly.
Instead, pass the data to be written to disk so no cache_ lookups are necessary.
Review URL: http://codereview.chromium.org/149105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/thumbnail_store.cc')
-rw-r--r-- | chrome/browser/thumbnail_store.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/thumbnail_store.cc b/chrome/browser/thumbnail_store.cc index 43c088d..6acc551 100644 --- a/chrome/browser/thumbnail_store.cc +++ b/chrome/browser/thumbnail_store.cc @@ -165,16 +165,17 @@ bool ThumbnailStore::SetPageThumbnail(const GURL& url, // Write the new thumbnail data to disk in the background on file_thread. if (write_to_disk) { g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(this, &ThumbnailStore::WriteThumbnailToDisk, url)); + NewRunnableMethod(this, &ThumbnailStore::WriteThumbnailToDisk, url, + jpeg_data, score)); } return true; } -bool ThumbnailStore::WriteThumbnailToDisk(const GURL& url) const { +bool ThumbnailStore::WriteThumbnailToDisk(const GURL& url, + scoped_refptr<RefCountedBytes> data, + const ThumbnailScore& score) const { Pickle packed; FilePath file = file_path_.AppendASCII(MD5String(url.spec())); - scoped_refptr<RefCountedBytes> data((*cache_)[url].first); - ThumbnailScore score = (*cache_)[url].second; // Pack the url, ThumbnailScore, and the JPEG data. packed.WriteString(url.spec()); |