From 2a58420b7c51fc7649d88b475a324385683c4106 Mon Sep 17 00:00:00 2001 From: "meelapshah@chromium.org" Date: Fri, 26 Jun 2009 22:56:46 +0000 Subject: 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 --- chrome/browser/thumbnail_store.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'chrome/browser/thumbnail_store.cc') 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 data, + const ThumbnailScore& score) const { Pickle packed; FilePath file = file_path_.AppendASCII(MD5String(url.spec())); - scoped_refptr data((*cache_)[url].first); - ThumbnailScore score = (*cache_)[url].second; // Pack the url, ThumbnailScore, and the JPEG data. packed.WriteString(url.spec()); -- cgit v1.1