Index: content/browser/renderer_host/render_widget_host_impl.cc |
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
index fe6f9fe2078c6b1423990ecb29fad6f85635298c..335aca5ce9e4beae19350d35404e93a8834c6cdf 100644 |
--- a/content/browser/renderer_host/render_widget_host_impl.cc |
+++ b/content/browser/renderer_host/render_widget_host_impl.cc |
@@ -87,6 +87,7 @@ |
#include "ui/gfx/color_space.h" |
#include "ui/gfx/geometry/size_conversions.h" |
#include "ui/gfx/geometry/vector2d_conversions.h" |
+#include "ui/gfx/image/image.h" |
#include "ui/gfx/image/image_skia.h" |
#include "ui/gfx/skbitmap_operations.h" |
#include "ui/snapshot/snapshot.h" |
@@ -2356,35 +2357,31 @@ void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { |
gfx::Rect view_bounds = GetView()->GetViewBounds(); |
gfx::Rect snapshot_bounds(view_bounds.size()); |
- std::vector<unsigned char> png; |
- if (ui::GrabViewSnapshot( |
- GetView()->GetNativeView(), &png, snapshot_bounds)) { |
- OnSnapshotDataReceived(snapshot_id, &png.front(), png.size()); |
+ gfx::Image image; |
+ if (ui::GrabViewSnapshot(GetView()->GetNativeView(), &image, |
+ snapshot_bounds)) { |
+ OnSnapshotReceived(snapshot_id, image); |
return; |
} |
ui::GrabViewSnapshotAsync( |
- GetView()->GetNativeView(), |
- snapshot_bounds, |
- base::ThreadTaskRunnerHandle::Get(), |
- base::Bind(&RenderWidgetHostImpl::OnSnapshotDataReceivedAsync, |
- weak_factory_.GetWeakPtr(), |
- snapshot_id)); |
+ GetView()->GetNativeView(), snapshot_bounds, |
+ base::Bind(&RenderWidgetHostImpl::OnSnapshotReceived, |
+ weak_factory_.GetWeakPtr(), snapshot_id)); |
} |
-void RenderWidgetHostImpl::OnSnapshotDataReceived(int snapshot_id, |
- const unsigned char* data, |
- size_t size) { |
+void RenderWidgetHostImpl::OnSnapshotReceived(int snapshot_id, |
+ const gfx::Image& image) { |
// Any pending snapshots with a lower ID than the one received are considered |
// to be implicitly complete, and returned the same snapshot data. |
PendingSnapshotMap::iterator it = pending_browser_snapshots_.begin(); |
while (it != pending_browser_snapshots_.end()) { |
- if (it->first <= snapshot_id) { |
- it->second.Run(data, size); |
- pending_browser_snapshots_.erase(it++); |
- } else { |
- ++it; |
- } |
+ if (it->first <= snapshot_id) { |
+ it->second.Run(image); |
+ pending_browser_snapshots_.erase(it++); |
+ } else { |
+ ++it; |
+ } |
} |
#if defined(OS_MACOSX) |
if (pending_browser_snapshots_.empty()) |
@@ -2392,15 +2389,6 @@ void RenderWidgetHostImpl::OnSnapshotDataReceived(int snapshot_id, |
#endif |
} |
-void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync( |
- int snapshot_id, |
- scoped_refptr<base::RefCountedBytes> png_data) { |
- if (png_data.get()) |
- OnSnapshotDataReceived(snapshot_id, png_data->front(), png_data->size()); |
- else |
- OnSnapshotDataReceived(snapshot_id, NULL, 0); |
-} |
- |
// static |
void RenderWidgetHostImpl::CompositorFrameDrawn( |
const std::vector<ui::LatencyInfo>& latency_info) { |