diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 17:34:35 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 17:34:35 +0000 |
commit | b4d084526b73c9fdff84101259c12b0e88478dc2 (patch) | |
tree | 4da6ee92862eb6b60fbbec109decee9af3165757 /chrome/renderer/render_widget.cc | |
parent | d63df7f8c5f2f875632fea866376b6762ae5e481 (diff) | |
download | chromium_src-b4d084526b73c9fdff84101259c12b0e88478dc2.zip chromium_src-b4d084526b73c9fdff84101259c12b0e88478dc2.tar.gz chromium_src-b4d084526b73c9fdff84101259c12b0e88478dc2.tar.bz2 |
Revert asynchronous backing store changes.
This reverts http://codereview.chromium.org/3506007
(r61225 -- the original change) and
http://codereview.chromium.org/3616005 (r61446 -- a fix for
a double-free in Pepper caused by the original change).
Doing asynchronous copying to the backing store in the
browser requires some large changes to Pepper that I'm not
going to have time to work on anytime soon. A cache of
in-flight TransportDIBs would need to be added (similar to
what the renderer already does), and we'd also need to do
copy-on-write when a plugin wants to draw on top of a
previous frame that's currently held by the browser. It
seems safer to revert the early part of the asynchronous
copying change instead of leaving it partially checked in.
BUG=none
TEST=ran it
Review URL: http://codereview.chromium.org/3583012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.cc')
-rw-r--r-- | chrome/renderer/render_widget.cc | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 90447c4..f5a7ebe 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -4,8 +4,6 @@ #include "chrome/renderer/render_widget.h" -#include <utility> - #include "app/surface/transport_dib.h" #include "base/command_line.h" #include "base/logging.h" @@ -63,6 +61,7 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, opener_id_(MSG_ROUTING_NONE), render_thread_(render_thread), host_window_(0), + current_paint_buf_(NULL), next_paint_flags_(0), update_reply_pending_(false), did_show_(false), @@ -83,9 +82,9 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, RenderWidget::~RenderWidget() { DCHECK(!webwidget_) << "Leaking our WebWidget!"; - for (TransportDIBMap::iterator it = current_paint_bufs_.begin(); - it != current_paint_bufs_.end(); ++it) { - RenderProcess::current()->ReleaseTransportDIB(it->second); + if (current_paint_buf_) { + RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); + current_paint_buf_ = NULL; } RenderProcess::current()->ReleaseProcess(); } @@ -170,7 +169,6 @@ IPC_DEFINE_MESSAGE_MAP(RenderWidget) IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) - IPC_MESSAGE_HANDLER(ViewMsg_DoneUsingBitmap, OnDoneUsingBitmap) IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) IPC_MESSAGE_HANDLER(ViewMsg_CreateVideo_ACK, OnCreateVideoAck) IPC_MESSAGE_HANDLER(ViewMsg_UpdateVideo_ACK, OnUpdateVideoAck) @@ -301,26 +299,17 @@ void RenderWidget::OnRequestMoveAck() { pending_window_rect_count_--; } -void RenderWidget::OnDoneUsingBitmap(TransportDIB::Id id) { - // If we sent an UpdateRect message with a zero-sized bitmap, then we should - // get an empty bitmap in response. - // TODO(derat): Don't send the "done using bitmap" message at all in this - // case. - if (id == TransportDIB::Id()) - return; - - TransportDIBMap::iterator it = current_paint_bufs_.find(id); - if (it != current_paint_bufs_.end()) { - RenderProcess::current()->ReleaseTransportDIB(it->second); - current_paint_bufs_.erase(it); - return; - } -} - void RenderWidget::OnUpdateRectAck() { DCHECK(update_reply_pending()); update_reply_pending_ = false; + // If we sent an UpdateRect message with a zero-sized bitmap, then we should + // have no current paint buffer. + if (current_paint_buf_) { + RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); + current_paint_buf_ = NULL; + } + // Notify subclasses. DidFlushPaint(); @@ -532,12 +521,12 @@ void RenderWidget::DoDeferredUpdate() { } else if (!is_gpu_rendering_active_) { // Compute a buffer for painting and cache it. scoped_ptr<skia::PlatformCanvas> canvas( - RenderProcess::current()->GetDrawingCanvas(&dib, bounds)); + RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, + bounds)); if (!canvas.get()) { NOTREACHED(); return; } - current_paint_bufs_.insert(std::make_pair(dib->id(), dib)); // We may get back a smaller canvas than we asked for. // TODO(darin): This seems like it could cause painting problems! @@ -563,7 +552,7 @@ void RenderWidget::DoDeferredUpdate() { for (size_t i = 0; i < copy_rects.size(); ++i) PaintRect(copy_rects[i], bounds.origin(), canvas.get()); - dib_id = dib->id(); + dib_id = current_paint_buf_->id(); } else { // Accelerated compositing path // Begin painting. bool finish = next_paint_is_resize_ack(); |