diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 11:52:32 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 11:52:32 +0000 |
commit | d8683e366ade2f3af7200785c1acdab7b09d0c40 (patch) | |
tree | 4f50a2f86333214a67ae8b41d64158ec3b9150dc /chrome/renderer/render_widget.cc | |
parent | 32d0269681eff5f46290cafa99511f5733757884 (diff) | |
download | chromium_src-d8683e366ade2f3af7200785c1acdab7b09d0c40.zip chromium_src-d8683e366ade2f3af7200785c1acdab7b09d0c40.tar.gz chromium_src-d8683e366ade2f3af7200785c1acdab7b09d0c40.tar.bz2 |
Revert 61608 - 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
BUG=58128
TBR=kkania@chromium.org
Review URL: http://codereview.chromium.org/3596008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r-- | chrome/renderer/render_widget.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 5e66a06..f5a7ebe 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -508,7 +508,6 @@ 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; @@ -519,7 +518,6 @@ 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( @@ -555,7 +553,6 @@ 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(); @@ -564,8 +561,7 @@ void RenderWidget::DoDeferredUpdate() { // sending an ack to browser process that the paint is complete... ViewHostMsg_UpdateRect_Params params; - params.dib_id = dib_id; - params.dib_handle = dib_handle; + params.bitmap = dib_id; params.bitmap_rect = bounds; params.dx = update.scroll_delta.x(); params.dy = update.scroll_delta.y(); @@ -823,7 +819,7 @@ void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, int tag, const gfx::Size& page_size, const gfx::Size& desired_size) { - if (!webwidget_ || !TransportDIB::is_valid(dib_handle)) + if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue()) return; if (page_size.IsEmpty() || desired_size.IsEmpty()) { @@ -835,17 +831,13 @@ 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::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(); + scoped_ptr<TransportDIB> paint_at_size_buffer(TransportDIB::Map(dib_handle)); + + DCHECK(paint_at_size_buffer.get()); + if (!paint_at_size_buffer.get()) 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()) / @@ -856,6 +848,14 @@ 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()); |