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

Side by Side Diff: chrome/renderer/render_widget.cc

Issue 4569002: Fix ThumbnailGenerator on Windows. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Just fix thumbnail generator for now Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/render_widget.h" 5 #include "chrome/renderer/render_widget.h"
6 6
7 #include "app/surface/transport_dib.h" 7 #include "app/surface/transport_dib.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (webwidget_) 812 if (webwidget_)
813 webwidget_->confirmComposition(); 813 webwidget_->confirmComposition();
814 } 814 }
815 815
816 // This message causes the renderer to render an image of the 816 // This message causes the renderer to render an image of the
817 // desired_size, regardless of whether the tab is hidden or not. 817 // desired_size, regardless of whether the tab is hidden or not.
818 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, 818 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
819 int tag, 819 int tag,
820 const gfx::Size& page_size, 820 const gfx::Size& page_size,
821 const gfx::Size& desired_size) { 821 const gfx::Size& desired_size) {
822 if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue()) 822 if (!webwidget_ || !TransportDIB::is_valid(dib_handle)) {
823 if (TransportDIB::is_valid(dib_handle)) {
824 // Close our unused handle.
825 #if defined(OS_WIN)
826 ::CloseHandle(dib_handle);
827 #elif defined(OS_MACOSX)
828 base::SharedMemory::CloseHandle(dib_handle);
829 #endif
830 }
823 return; 831 return;
832 }
824 833
825 if (page_size.IsEmpty() || desired_size.IsEmpty()) { 834 if (page_size.IsEmpty() || desired_size.IsEmpty()) {
826 // If one of these is empty, then we just return the dib we were 835 // If one of these is empty, then we just return the dib we were
827 // given, to avoid leaking it. 836 // given, to avoid leaking it.
828 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); 837 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size));
829 return; 838 return;
830 } 839 }
831 840
832 // Map the given DIB ID into this process, and unmap it at the end 841 // Map the given DIB ID into this process, and unmap it at the end
833 // of this function. 842 // of this function.
834 scoped_ptr<TransportDIB> paint_at_size_buffer(TransportDIB::Map(dib_handle)); 843 scoped_ptr<TransportDIB> paint_at_size_buffer(
835 844 TransportDIB::CreateWithHandle(dib_handle));
836 DCHECK(paint_at_size_buffer.get());
837 if (!paint_at_size_buffer.get())
838 return;
839 845
840 gfx::Size canvas_size = page_size; 846 gfx::Size canvas_size = page_size;
841 float x_scale = static_cast<float>(desired_size.width()) / 847 float x_scale = static_cast<float>(desired_size.width()) /
842 static_cast<float>(canvas_size.width()); 848 static_cast<float>(canvas_size.width());
843 float y_scale = static_cast<float>(desired_size.height()) / 849 float y_scale = static_cast<float>(desired_size.height()) /
844 static_cast<float>(canvas_size.height()); 850 static_cast<float>(canvas_size.height());
845 851
846 gfx::Rect orig_bounds(canvas_size); 852 gfx::Rect orig_bounds(canvas_size);
847 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); 853 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale));
848 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); 854 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1019
1014 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1020 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1015 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1021 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1016 i != plugin_window_moves_.end(); ++i) { 1022 i != plugin_window_moves_.end(); ++i) {
1017 if (i->window == window) { 1023 if (i->window == window) {
1018 plugin_window_moves_.erase(i); 1024 plugin_window_moves_.erase(i);
1019 break; 1025 break;
1020 } 1026 }
1021 } 1027 }
1022 } 1028 }
OLDNEW
« app/surface/transport_dib_win.cc ('K') | « chrome/browser/tab_contents/thumbnail_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698