| Index: chrome/browser/thumbnails/thumbnail_tab_helper.cc
|
| diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
|
| index 20d6cf054241dbc42c9c972bae9a42d83a399c1e..b9a57b31e1b03a4c2703e47a397c071c55491afc 100644
|
| --- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc
|
| +++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
|
| @@ -58,22 +58,15 @@ namespace {
|
| void UpdateThumbnail(const ThumbnailingContext& context,
|
| const SkBitmap& thumbnail) {
|
| gfx::Image image = gfx::Image::CreateFrom1xBitmap(thumbnail);
|
| - context.service()->SetPageThumbnail(context, image);
|
| - DVLOG(1) << "Thumbnail taken for " << context.GetURL() << ": "
|
| - << context.score().ToString();
|
| + context.service->SetPageThumbnail(context, image);
|
| + DVLOG(1) << "Thumbnail taken for " << context.url << ": "
|
| + << context.score.ToString();
|
| }
|
|
|
| void ProcessCapturedBitmap(scoped_refptr<ThumbnailingContext> context,
|
| scoped_refptr<ThumbnailingAlgorithm> algorithm,
|
| const SkBitmap& bitmap,
|
| content::ReadbackResponse response) {
|
| - // Was the web contents destroyed before the thumbnail could be generated?
|
| - if (!context->web_contents())
|
| - return;
|
| -
|
| - // Balance the IncrementCapturerCount() from UpdateThumbnailIfNecessary().
|
| - context->web_contents()->DecrementCapturerCount();
|
| -
|
| if (response != content::READBACK_SUCCESS)
|
| return;
|
|
|
| @@ -84,11 +77,12 @@ void ProcessCapturedBitmap(scoped_refptr<ThumbnailingContext> context,
|
| algorithm->ProcessBitmap(context, base::Bind(&UpdateThumbnail), bitmap);
|
| }
|
|
|
| -void AsyncProcessThumbnail(scoped_refptr<ThumbnailingContext> context,
|
| +void AsyncProcessThumbnail(content::WebContents* web_contents,
|
| + scoped_refptr<ThumbnailingContext> context,
|
| scoped_refptr<ThumbnailingAlgorithm> algorithm) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| RenderWidgetHost* render_widget_host =
|
| - context->web_contents()->GetRenderViewHost()->GetWidget();
|
| + web_contents->GetRenderViewHost()->GetWidget();
|
| content::RenderWidgetHostView* view = render_widget_host->GetView();
|
| if (!view)
|
| return;
|
| @@ -108,16 +102,14 @@ void AsyncProcessThumbnail(scoped_refptr<ThumbnailingContext> context,
|
| ui::ScaleFactor scale_factor =
|
| ui::GetSupportedScaleFactor(
|
| ui::GetScaleFactorForNativeView(view->GetNativeView()));
|
| - gfx::Size requested_copy_size;
|
| - context->set_clip_result(algorithm->GetCanvasCopyInfo(
|
| + context->clip_result = algorithm->GetCanvasCopyInfo(
|
| copy_rect.size(),
|
| scale_factor,
|
| ©_rect,
|
| - &requested_copy_size));
|
| - context->set_requested_copy_size(requested_copy_size);
|
| + &context->requested_copy_size);
|
| render_widget_host->CopyFromBackingStore(
|
| copy_rect,
|
| - requested_copy_size,
|
| + context->requested_copy_size,
|
| base::Bind(&ProcessCapturedBitmap, context, algorithm),
|
| kN32_SkColorType);
|
| }
|
| @@ -203,14 +195,12 @@ void ThumbnailTabHelper::UpdateThumbnailIfNecessary(
|
| return;
|
| }
|
|
|
| - web_contents->IncrementCapturerCount(gfx::Size());
|
| -
|
| scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm(
|
| thumbnail_service->GetThumbnailingAlgorithm());
|
|
|
| scoped_refptr<ThumbnailingContext> context(new ThumbnailingContext(
|
| web_contents, thumbnail_service.get(), load_interrupted_));
|
| - AsyncProcessThumbnail(context, algorithm);
|
| + AsyncProcessThumbnail(web_contents, context, algorithm);
|
| }
|
|
|
| void ThumbnailTabHelper::RenderViewHostCreated(
|
|
|