diff options
Diffstat (limited to 'chrome/browser/tab_contents/thumbnail_generator.cc')
-rw-r--r-- | chrome/browser/tab_contents/thumbnail_generator.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 1f431ba..f7c16ba 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -130,7 +130,7 @@ SkBitmap GetBitmapForBackingStore( } // namespace struct ThumbnailGenerator::AsyncRequestInfo { - ThumbnailReadyCallback callback; + scoped_ptr<ThumbnailReadyCallback> callback; scoped_ptr<TransportDIB> thumbnail_dib; RenderWidgetHost* renderer; // Not owned. }; @@ -195,9 +195,11 @@ void ThumbnailGenerator::MonitorRenderer(RenderWidgetHost* renderer, void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer, bool prefer_backing_store, - const ThumbnailReadyCallback& callback, + ThumbnailReadyCallback* callback, gfx::Size page_size, gfx::Size desired_size) { + scoped_ptr<ThumbnailReadyCallback> callback_deleter(callback); + if (prefer_backing_store) { BackingStore* backing_store = renderer->GetBackingStore(false); if (backing_store) { @@ -208,7 +210,7 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer, desired_size.height(), kNoOptions, NULL); - callback.Run(first_try); + callback->Run(first_try); return; } @@ -247,7 +249,7 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer, #endif linked_ptr<AsyncRequestInfo> request_info(new AsyncRequestInfo); - request_info->callback = callback; + request_info->callback.reset(callback_deleter.release()); request_info->thumbnail_dib.reset(thumbnail_dib.release()); request_info->renderer = renderer; ThumbnailCallbackMap::value_type new_value(sequence_num, request_info); @@ -316,7 +318,7 @@ void ThumbnailGenerator::WidgetDidReceivePaintAtSizeAck( // TODO: Figure out a way to avoid this copy? non_owned_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); - item->second->callback.Run(result); + item->second->callback->Run(result); // We're done with the callback, and with the DIB, so delete both. callback_map_.erase(item); |