diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 00:14:00 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 00:14:00 +0000 |
commit | 27543452369d6a2cdcc058cb5f92910d7a47e823 (patch) | |
tree | 4a1c2f46659e653f2186947a27e7ff4571c80832 /content | |
parent | 0f46f8115f6b5baf16e602e006d5c1ffa7f08482 (diff) | |
download | chromium_src-27543452369d6a2cdcc058cb5f92910d7a47e823.zip chromium_src-27543452369d6a2cdcc058cb5f92910d7a47e823.tar.gz chromium_src-27543452369d6a2cdcc058cb5f92910d7a47e823.tar.bz2 |
Adds a TransportDIB::Id value that is explicitly invalid and use it when compositing
BUG=76001
TEST=
Review URL: http://codereview.chromium.org/6665029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/accelerated_surface_container_mac.cc | 2 | ||||
-rw-r--r-- | content/browser/renderer_host/mock_render_process_host.cc | 2 | ||||
-rw-r--r-- | content/common/common_param_traits.h | 18 | ||||
-rw-r--r-- | content/plugin/webplugin_accelerated_surface_proxy_mac.cc | 2 | ||||
-rw-r--r-- | content/plugin/webplugin_proxy.cc | 2 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.cc | 2 | ||||
-rw-r--r-- | content/renderer/render_widget.cc | 11 |
7 files changed, 30 insertions, 9 deletions
diff --git a/content/browser/renderer_host/accelerated_surface_container_mac.cc b/content/browser/renderer_host/accelerated_surface_container_mac.cc index a661c92..5bd23a95 100644 --- a/content/browser/renderer_host/accelerated_surface_container_mac.cc +++ b/content/browser/renderer_host/accelerated_surface_container_mac.cc @@ -42,7 +42,7 @@ void AcceleratedSurfaceContainerMac::SetSizeAndTransportDIB( int32 width, int32 height, TransportDIB::Handle transport_dib) { - if (TransportDIB::is_valid(transport_dib)) { + if (TransportDIB::is_valid_handle(transport_dib)) { transport_dib_.reset(TransportDIB::Map(transport_dib)); EnqueueTextureForDeletion(); width_ = width; diff --git a/content/browser/renderer_host/mock_render_process_host.cc b/content/browser/renderer_host/mock_render_process_host.cc index 84dda0f..ff179ff 100644 --- a/content/browser/renderer_host/mock_render_process_host.cc +++ b/content/browser/renderer_host/mock_render_process_host.cc @@ -111,7 +111,7 @@ TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { // one from a dib_id. transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0); #elif defined(OS_POSIX) - transport_dib_ = TransportDIB::Map(dib_id); + transport_dib_ = TransportDIB::Map(dib_id.shmkey); #endif return transport_dib_; diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index 8a09924..1689cb1 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -383,6 +383,24 @@ struct ParamTraits<TransportDIB::Id> { }; #endif +#if defined(USE_X11) +template<> +struct ParamTraits<TransportDIB::Id> { + typedef TransportDIB::Id param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.shmkey); + } + static bool Read(const Message* m, void** iter, param_type* r) { + return ReadParam(m, iter, &r->shmkey); + } + static void Log(const param_type& p, std::string* l) { + l->append("TransportDIB("); + LogParam(p.shmkey, l); + l->append(")"); + } +}; +#endif + template <> struct SimilarTypeTraits<WebKit::WebTextDirection> { typedef int Type; diff --git a/content/plugin/webplugin_accelerated_surface_proxy_mac.cc b/content/plugin/webplugin_accelerated_surface_proxy_mac.cc index 7f5d486..ec4571d 100644 --- a/content/plugin/webplugin_accelerated_surface_proxy_mac.cc +++ b/content/plugin/webplugin_accelerated_surface_proxy_mac.cc @@ -51,7 +51,7 @@ void WebPluginAcceleratedSurfaceProxy::SetSize(const gfx::Size& size) { plugin_proxy_->SetAcceleratedSurface(window_handle_, size, io_surface_id); } else { TransportDIB::Handle transport_dib = surface_->SetTransportDIBSize(size); - if (TransportDIB::is_valid(transport_dib)) { + if (TransportDIB::is_valid_handle(transport_dib)) { plugin_proxy_->SetAcceleratedDIB(window_handle_, size, transport_dib); } } diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 57e61b2..108d455 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -412,7 +412,7 @@ void WebPluginProxy::UpdateGeometry( // Update the buffers before doing anything that could call into plugin code, // so that we don't process buffer changes out of order if plugins make // synchronous calls that lead to nested UpdateGeometry calls. - if (TransportDIB::is_valid(windowless_buffer)) { + if (TransportDIB::is_valid_handle(windowless_buffer)) { // The plugin's rect changed, so now we have a new buffer to draw into. SetWindowlessBuffer(windowless_buffer, background_buffer, window_rect); } diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index e4ccc96..c5f50e8 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -564,7 +564,7 @@ PepperPluginDelegateImpl::CreateImage2D(int width, int height) { &dib_handle); if (!RenderThread::current()->Send(msg)) return NULL; - if (!TransportDIB::is_valid(dib_handle)) + if (!TransportDIB::is_valid_handle(dib_handle)) return NULL; TransportDIB* dib = TransportDIB::Map(dib_handle); diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 901fbee..9723588 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -581,6 +581,9 @@ void RenderWidget::DoDeferredUpdate() { gfx::Rect scroll_damage = update.GetScrollDamage(); gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); + // Compositing the page may disable accelerated compositing. + bool accelerated_compositing_was_active = is_accelerated_compositing_active_; + // 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. // This optimization allows PPAPI plugins that declare themselves on top of @@ -592,7 +595,7 @@ void RenderWidget::DoDeferredUpdate() { // This optimization only works when the entire invalid region is contained // within the plugin. There is a related optimization in PaintRect for the // case where there may be multiple invalid regions. - TransportDIB::Id dib_id = TransportDIB::Id(); + TransportDIB::Id dib_id; TransportDIB* dib = NULL; std::vector<gfx::Rect> copy_rects; gfx::Rect optimized_copy_rect, optimized_copy_location; @@ -644,7 +647,7 @@ void RenderWidget::DoDeferredUpdate() { params.bitmap_rect = bounds; params.dx = update.scroll_delta.x(); params.dy = update.scroll_delta.y(); - if (is_accelerated_compositing_active_) { + if (accelerated_compositing_was_active) { // If painting is done via the gpu process then we clear out all damage // rects to save the browser process from doing unecessary work. params.scroll_rect = gfx::Rect(); @@ -902,8 +905,8 @@ 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 (TransportDIB::is_valid(dib_handle)) { + if (!webwidget_ || !TransportDIB::is_valid_handle(dib_handle)) { + if (TransportDIB::is_valid_handle(dib_handle)) { // Close our unused handle. #if defined(OS_WIN) ::CloseHandle(dib_handle); |