summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_widget.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 03:48:48 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 03:48:48 +0000
commit6d853d9e57b7c5415a8042165e8668cb76a0f9b7 (patch)
tree95ddb2260d74765da6604c68a8c486adbc4be1bc /chrome/renderer/render_widget.cc
parent71743c1a6912e07cb6c9fbe342d23f8b4a9f31c1 (diff)
downloadchromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.zip
chromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.tar.gz
chromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.tar.bz2
On Windows, create a new TransportDIB::Handle struct which includes the file
mapping HANDLE and the source process ID. Duplicating the handle for the remote process is done in TransportDIB::Map, instead of in various #ifdefs scattered across the code. Also on windows, remove the struct for the TransportDIB::Id which contained both the sequence number and the HANDLE and replace it with just the sequence number. Fix ThumbnailGenerator by mapping the TransportDIB on Windows and adding a method to duplicate the file mapping handle before sending across the channel. BUG=none TEST=none Review URL: http://codereview.chromium.org/3305020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r--chrome/renderer/render_widget.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index f5a7ebe..5e66a06 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -508,6 +508,7 @@ void RenderWidget::DoDeferredUpdate() {
// A plugin may be able to do an optimized paint. First check this, in which
// case we can skip all of the bitmap generation and regular paint code.
TransportDIB::Id dib_id = TransportDIB::Id();
+ TransportDIB::Handle dib_handle = TransportDIB::DefaultHandleValue();
TransportDIB* dib = NULL;
std::vector<gfx::Rect> copy_rects;
gfx::Rect optimized_copy_rect, optimized_copy_location;
@@ -518,6 +519,7 @@ void RenderWidget::DoDeferredUpdate() {
bounds = optimized_copy_location;
copy_rects.push_back(optimized_copy_rect);
dib_id = dib->id();
+ dib_handle = dib->handle();
} else if (!is_gpu_rendering_active_) {
// Compute a buffer for painting and cache it.
scoped_ptr<skia::PlatformCanvas> canvas(
@@ -553,6 +555,7 @@ void RenderWidget::DoDeferredUpdate() {
PaintRect(copy_rects[i], bounds.origin(), canvas.get());
dib_id = current_paint_buf_->id();
+ dib_handle = current_paint_buf_->handle();
} else { // Accelerated compositing path
// Begin painting.
bool finish = next_paint_is_resize_ack();
@@ -561,7 +564,8 @@ void RenderWidget::DoDeferredUpdate() {
// sending an ack to browser process that the paint is complete...
ViewHostMsg_UpdateRect_Params params;
- params.bitmap = dib_id;
+ params.dib_id = dib_id;
+ params.dib_handle = dib_handle;
params.bitmap_rect = bounds;
params.dx = update.scroll_delta.x();
params.dy = update.scroll_delta.y();
@@ -819,7 +823,7 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
int tag,
const gfx::Size& page_size,
const gfx::Size& desired_size) {
- if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue())
+ if (!webwidget_ || !TransportDIB::is_valid(dib_handle))
return;
if (page_size.IsEmpty() || desired_size.IsEmpty()) {
@@ -831,13 +835,17 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
// Map the given DIB ID into this process, and unmap it at the end
// of this function.
- scoped_ptr<TransportDIB> paint_at_size_buffer(TransportDIB::Map(dib_handle));
-
- DCHECK(paint_at_size_buffer.get());
- if (!paint_at_size_buffer.get())
+ scoped_ptr<TransportDIB> paint_at_size_buffer(
+ TransportDIB::CreateWithHandle(dib_handle));
+ gfx::Size canvas_size = page_size;
+ scoped_ptr<skia::PlatformCanvas> canvas(
+ paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(),
+ canvas_size.height()));
+ if (!canvas.get()) {
+ NOTREACHED();
return;
+ }
- gfx::Size canvas_size = page_size;
float x_scale = static_cast<float>(desired_size.width()) /
static_cast<float>(canvas_size.width());
float y_scale = static_cast<float>(desired_size.height()) /
@@ -848,14 +856,6 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
gfx::Rect bounds(canvas_size);
- scoped_ptr<skia::PlatformCanvas> canvas(
- paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(),
- canvas_size.height()));
- if (!canvas.get()) {
- NOTREACHED();
- return;
- }
-
// Reset bounds to what we actually received, but they should be the
// same.
DCHECK_EQ(bounds.width(), canvas->getDevice()->width());