From 0b07be45881306b32eab0d87f7d55ec3e84cd676 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Wed, 29 Feb 2012 01:14:42 +0000 Subject: Get rid of BackingStore usage in chrome. I added methods on RenderWidgetHost to copy data out of the backing store to satisfy the existing users. Note that the ThumbnailGenerator test turned out to be testing a feature that has since been removed! So I removed that test and the supporting code. BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9515009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124079 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/renderer_host/render_widget_host.cc | 58 ++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) (limited to 'content/browser/renderer_host/render_widget_host.cc') diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 4d1f857..a760a0d 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -38,6 +38,12 @@ #include "webkit/glue/webpreferences.h" #include "webkit/plugins/npapi/webplugin.h" +#if defined(TOOLKIT_GTK) +#include "content/browser/renderer_host/backing_store_gtk.h" +#elif defined(OS_MACOSX) +#include "content/browser/renderer_host/backing_store_mac.h" +#endif + using base::Time; using base::TimeDelta; using base::TimeTicks; @@ -97,6 +103,16 @@ const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( static_cast(listener)); } +// static +void RenderWidgetHost::RemoveAllBackingStores() { + BackingStoreManager::RemoveAllBackingStores(); +} + +// static +size_t RenderWidgetHost::BackingStoreMemorySize() { + return BackingStoreManager::MemorySize(); +} + /////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostImpl @@ -460,10 +476,46 @@ void RenderWidgetHostImpl::SetIsLoading(bool is_loading) { view_->SetIsLoading(is_loading); } +bool RenderWidgetHostImpl::CopyFromBackingStore(skia::PlatformCanvas* output) { + BackingStore* backing_store = GetBackingStore(false); + if (!backing_store) + return false; + + return backing_store->CopyFromBackingStore( + gfx::Rect(backing_store->size()), output); +} + +#if defined(TOOLKIT_GTK) +bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( + const gfx::Rect& dest_rect, GdkWindow* target) { + BackingStore* backing_store = GetBackingStore(false); + if (!backing_store) + return false; + (static_cast(backing_store))->PaintToRect( + dest_rect, target); + return true; +} +#elif defined(OS_MACOSX) +gfx::Size RenderWidgetHostImpl::GetBackingStoreSize() { + BackingStore* backing_store = GetBackingStore(false); + return backing_store ? backing_store->size() : gfx::Size(); +} + +bool RenderWidgetHostImpl::CopyFromBackingStoreToCGContext( + const CGRect& dest_rect, CGContextRef target) { + BackingStore* backing_store = GetBackingStore(false); + if (!backing_store) + return false; + (static_cast(backing_store))-> + CopyFromBackingStoreToCGContext(dest_rect, target); + return true; +} +#endif + void RenderWidgetHostImpl::PaintAtSize(TransportDIB::Handle dib_handle, - int tag, - const gfx::Size& page_size, - const gfx::Size& desired_size) { + int tag, + const gfx::Size& page_size, + const gfx::Size& desired_size) { // Ask the renderer to create a bitmap regardless of whether it's // hidden, being resized, redrawn, etc. It resizes the web widget // to the page_size and then scales it to the desired_size. -- cgit v1.1