Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: chrome/browser/dom_ui/dom_ui_thumbnail_source.cc

Issue 149126: Modify ThumbnailStore to make one call to the HistoryBackend using QueryTopUR... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_thumbnail_source.h ('k') | chrome/browser/thumbnail_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
===================================================================
--- chrome/browser/dom_ui/dom_ui_thumbnail_source.cc (revision 19748)
+++ chrome/browser/dom_ui/dom_ui_thumbnail_source.cc (working copy)
@@ -21,20 +21,15 @@
store_(profile->GetThumbnailStore()) {
}
-DOMUIThumbnailSource::~DOMUIThumbnailSource() {
- store_->CancelPendingRequests(pending_requests_);
-}
-
void DOMUIThumbnailSource::StartDataRequest(const std::string& path,
int request_id) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kThumbnailStore)) {
RefCountedBytes* data = NULL;
- ThumbnailStore::GetStatus res = store_->GetPageThumbnail(GURL(path), &data);
- if (res == ThumbnailStore::SUCCESS) {
+ if (store_->GetPageThumbnail(GURL(path), &data)) {
// Got the thumbnail.
SendResponse(request_id, data);
- } else if (res == ThumbnailStore::FAIL) {
+ } else {
// Don't have the thumbnail so return the default thumbnail.
if (!default_thumbnail_.get()) {
default_thumbnail_ = new RefCountedBytes;
@@ -42,12 +37,6 @@
IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
}
SendResponse(request_id, default_thumbnail_);
- } else if (res == ThumbnailStore::ASYNC) {
- // Getting the redirect list for the url. Will return thumbnail later.
- ThumbnailStore::ThumbnailDataCallback* cb =
- NewCallback(this, &DOMUIThumbnailSource::ReturnData);
- pending_requests_.insert(request_id);
- store_->GetPageThumbnailAsync(GURL(path), request_id, cb);
}
return;
} // end --thumbnail-store switch
@@ -66,22 +55,6 @@
}
}
-void DOMUIThumbnailSource::ReturnData(int request_id,
- scoped_refptr<RefCountedBytes> data) {
- pending_requests_.erase(request_id);
- if (data.get() && !data->data.empty()) {
- SendResponse(request_id, data);
- } else {
- if (!default_thumbnail_.get()) {
- default_thumbnail_ = new RefCountedBytes;
- ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
- IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
- }
-
- SendResponse(request_id, default_thumbnail_);
- }
-}
-
void DOMUIThumbnailSource::OnThumbnailDataAvailable(
HistoryService::Handle request_handle,
scoped_refptr<RefCountedBytes> data) {
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_thumbnail_source.h ('k') | chrome/browser/thumbnail_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698