summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/thumbnail_generator.cc12
-rw-r--r--chrome/browser/tab_contents/thumbnail_generator.h4
2 files changed, 9 insertions, 7 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);
diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h
index 8329f29..0c0e588 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.h
+++ b/chrome/browser/tab_contents/thumbnail_generator.h
@@ -32,7 +32,7 @@ class TopSites;
class ThumbnailGenerator : public NotificationObserver,
public TabContentsObserver {
public:
- typedef base::Callback<void(const SkBitmap&)> ThumbnailReadyCallback;
+ typedef Callback1<const SkBitmap&>::Type ThumbnailReadyCallback;
// The result of clipping. This can be used to determine if the
// generated thumbnail is good or not.
enum ClipResult {
@@ -80,7 +80,7 @@ class ThumbnailGenerator : public NotificationObserver,
// dimensions, but might not be the exact size requested.
void AskForSnapshot(RenderWidgetHost* renderer,
bool prefer_backing_store,
- const ThumbnailReadyCallback& callback,
+ ThumbnailReadyCallback* callback,
gfx::Size page_size,
gfx::Size desired_size);