diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 04:46:25 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 04:46:25 +0000 |
commit | 45c6aad36e42c895c7353fab2f8f2e528874a354 (patch) | |
tree | 67f3846ce7eb51b512661da3b496a1b9d6c8a9fc /chrome/renderer/render_widget.cc | |
parent | ba28247b5b97f0e7c11bb69bb48d82e556eb8ed2 (diff) | |
download | chromium_src-45c6aad36e42c895c7353fab2f8f2e528874a354.zip chromium_src-45c6aad36e42c895c7353fab2f8f2e528874a354.tar.gz chromium_src-45c6aad36e42c895c7353fab2f8f2e528874a354.tar.bz2 |
Fix ThumbnailGenerator on Windows.
In the browser, duplicate the file mapping handle before sending to the
renderer and map the TransportDIB before accessing the memory. In the
renderer, do not map the file twice, which was happening when
TransportDIB::Map and GetPlatformCanvas were both being called.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/4569002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r-- | chrome/renderer/render_widget.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 79dd235..b9c839e 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -809,8 +809,17 @@ 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)) { + if (TransportDIB::is_valid(dib_handle)) { + // Close our unused handle. +#if defined(OS_WIN) + ::CloseHandle(dib_handle); +#elif defined(OS_MACOSX) + base::SharedMemory::CloseHandle(dib_handle); +#endif + } return; + } if (page_size.IsEmpty() || desired_size.IsEmpty()) { // If one of these is empty, then we just return the dib we were @@ -821,11 +830,8 @@ 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()) - return; + scoped_ptr<TransportDIB> paint_at_size_buffer( + TransportDIB::CreateWithHandle(dib_handle)); gfx::Size canvas_size = page_size; float x_scale = static_cast<float>(desired_size.width()) / |