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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 2976008: Bar (Closed)
Patch Set: rebase Created 10 years, 5 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/tab_contents/thumbnail_generator.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index a6f046c65d19815bcd390e66417a781b033823d7..953875a6fbc91d5238f34e3ad1aabb468fc9d638 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -191,14 +191,17 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
// We are going to render the thumbnail asynchronously now, so keep
// this callback for later lookup when the rendering is done.
static int sequence_num = 0;
+ sequence_num++;
TransportDIB* thumbnail_dib = TransportDIB::Create(
- desired_size.width() * desired_size.height() * 4, sequence_num++);
+ desired_size.width() * desired_size.height() * 4, sequence_num);
+
+fprintf(stderr, "expecting dib data %d %d %d %d %p\n",
+ page_size.width(), page_size.height(), desired_size.width(), desired_size.height(), thumbnail_dib->memory());
linked_ptr<AsyncRequestInfo> request_info(new AsyncRequestInfo);
request_info->callback.reset(callback);
request_info->thumbnail_dib.reset(thumbnail_dib);
request_info->renderer = renderer;
- ThumbnailCallbackMap::value_type new_value(thumbnail_dib->handle(),
- request_info);
+ ThumbnailCallbackMap::value_type new_value(sequence_num, request_info);
std::pair<ThumbnailCallbackMap::iterator, bool> result =
callback_map_.insert(new_value);
if (!result.second) {
@@ -206,7 +209,8 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
return;
}
- renderer->PaintAtSize(thumbnail_dib->handle(), page_size, desired_size);
+ renderer->PaintAtSize(
+ thumbnail_dib->handle(), sequence_num, page_size, desired_size);
}
SkBitmap ThumbnailGenerator::GetThumbnailForRenderer(
@@ -290,14 +294,16 @@ void ThumbnailGenerator::WidgetDidUpdateBackingStore(RenderWidgetHost* widget) {
void ThumbnailGenerator::WidgetDidReceivePaintAtSizeAck(
RenderWidgetHost* widget,
- const TransportDIB::Handle& dib_handle,
+ int sequence_num,
const gfx::Size& size) {
+fprintf(stderr, "ThumbnailGenerator got ack %d %d %d\n", size.width(), size.height(), sequence_num);
// Lookup the callback, run it, and erase it.
- ThumbnailCallbackMap::iterator item = callback_map_.find(dib_handle);
+ ThumbnailCallbackMap::iterator item = callback_map_.find(sequence_num);
if (item != callback_map_.end()) {
TransportDIB* dib = item->second->thumbnail_dib.get();
DCHECK(dib);
if (!dib) {
+fprintf(stderr, "not found in map\n");
return;
}
@@ -311,12 +317,14 @@ void ThumbnailGenerator::WidgetDidReceivePaintAtSizeAck(
non_owned_bitmap.setConfig(SkBitmap::kARGB_8888_Config,
size.width(), size.height());
non_owned_bitmap.setPixels(dib->memory());
+fprintf(stderr, "received dib data %d %d %p\n", size.width(), size.height(), dib->memory());
// Now alloc/copy the memory so we own it and can pass it around,
// and the memory won't go away when the DIB goes away.
// TODO: Figure out a way to avoid this copy?
non_owned_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config);
+fprintf(stderr, "running callback\n");
item->second->callback->Run(result);
// We're done with the callback, and with the DIB, so delete both.
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698