diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 04:07:11 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 04:07:11 +0000 |
commit | 4e29afd37878b3500fb807d2c176f1b6d382f318 (patch) | |
tree | ac7a7d05b6e324340b1f1fbd0e2d5b94be1eba2d /content/plugin | |
parent | a1f24b7661fb256f34dc36d9254764ba6e12578c (diff) | |
download | chromium_src-4e29afd37878b3500fb807d2c176f1b6d382f318.zip chromium_src-4e29afd37878b3500fb807d2c176f1b6d382f318.tar.gz chromium_src-4e29afd37878b3500fb807d2c176f1b6d382f318.tar.bz2 |
Use skia::RefPtr in place of manual ref-counting for Skia types.
This covers remaining content/ and webkit/ manual ref-counting.
BUG=163454
R=piman
Depends on: https://codereview.chromium.org/11418217/
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11428099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin')
-rw-r--r-- | content/plugin/webplugin_proxy.cc | 32 | ||||
-rw-r--r-- | content/plugin/webplugin_proxy.h | 17 |
2 files changed, 24 insertions, 25 deletions
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 8f8912f..ac08a59 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -371,8 +371,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { #else // See above comment about windowless_context_ changing. // http::/crbug.com/139462 - skia::PlatformCanvas* saved_canvas = windowless_canvas(); - SkAutoRef local_ref(saved_canvas); + skia::RefPtr<skia::PlatformCanvas> saved_canvas = windowless_canvas(); #if defined(USE_X11) scoped_refptr<SharedTransportDIB> local_dib_ref( windowless_dibs_[windowless_buffer_index_]); @@ -399,7 +398,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) { // Before we send the invalidate, paint so that renderer uses the updated // bitmap. - delegate_->Paint(saved_canvas, offset_rect); + delegate_->Paint(saved_canvas.get(), offset_rect); saved_canvas->restore(); #endif @@ -450,12 +449,13 @@ void WebPluginProxy::UpdateGeometry( void WebPluginProxy::CreateCanvasFromHandle( const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, - SkAutoTUnref<skia::PlatformCanvas>* canvas) { - canvas->reset(skia::CreatePlatformCanvas(window_rect.width(), - window_rect.height(), - true, - dib_handle, - skia::RETURN_NULL_ON_FAILURE)); + skia::RefPtr<skia::PlatformCanvas>* canvas) { + *canvas = skia::AdoptRef( + skia::CreatePlatformCanvas(window_rect.width(), + window_rect.height(), + true, + dib_handle, + skia::RETURN_NULL_ON_FAILURE)); // The canvas does not own the section so we need to close it now. CloseHandle(dib_handle); } @@ -467,15 +467,15 @@ void WebPluginProxy::SetWindowlessBuffers( CreateCanvasFromHandle(windowless_buffer0, window_rect, &windowless_canvases_[0]); - if (!windowless_canvases_[0].get()) { - windowless_canvases_[1].reset(NULL); + if (!windowless_canvases_[0]) { + windowless_canvases_[1].clear(); return; } CreateCanvasFromHandle(windowless_buffer1, window_rect, &windowless_canvases_[1]); - if (!windowless_canvases_[1].get()) { - windowless_canvases_[0].reset(NULL); + if (!windowless_canvases_[1]) { + windowless_canvases_[0].clear(); return; } } @@ -527,15 +527,15 @@ void WebPluginProxy::CreateDIBAndCanvasFromHandle( const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, scoped_refptr<SharedTransportDIB>* dib_out, - SkAutoTUnref<skia::PlatformCanvas>* canvas) { + skia::RefPtr<skia::PlatformCanvas>* canvas) { TransportDIB* dib = TransportDIB::Map(dib_handle); // dib may be NULL if the renderer has already destroyed the TransportDIB by // the time we receive the handle, e.g. in case of multiple resizes. if (dib) { - canvas->reset( + *canvas = skia::AdoptRef( dib->GetPlatformCanvas(window_rect.width(), window_rect.height())); } else { - canvas->reset(NULL); + canvas->clear(); } *dib_out = new SharedTransportDIB(dib); } diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index 7c5e412..c3b79ce 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -19,7 +19,8 @@ #include "base/timer.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" -#include "third_party/skia/include/core/SkRefCnt.h" +#include "skia/ext/refptr.h" +#include "third_party/skia/include/core/SkCanvas.h" #if defined(USE_X11) #include "ui/base/x/x11_util.h" #endif @@ -27,8 +28,6 @@ #include "ui/surface/transport_dib.h" #include "webkit/plugins/npapi/webplugin.h" -class SkCanvas; - namespace webkit { namespace npapi { class WebPluginDelegateImpl; @@ -213,7 +212,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { #if defined(OS_WIN) void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, - SkAutoTUnref<SkCanvas>* canvas); + skia::RefPtr<SkCanvas>* canvas); #elif defined(OS_MACOSX) static void CreateDIBAndCGContextFromHandle( const TransportDIB::Handle& dib_handle, @@ -225,7 +224,7 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { const TransportDIB::Handle& dib_handle, const gfx::Rect& window_rect, scoped_refptr<SharedTransportDIB>* dib_out, - SkAutoTUnref<SkCanvas>* canvas); + skia::RefPtr<SkCanvas>* canvas); static void CreateShmPixmapFromDIB( TransportDIB* dib, @@ -243,8 +242,8 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { return windowless_contexts_[windowless_buffer_index_].get(); } #else - SkCanvas* windowless_canvas() const { - return windowless_canvases_[windowless_buffer_index_].get(); + skia::RefPtr<SkCanvas> windowless_canvas() const { + return windowless_canvases_[windowless_buffer_index_]; } #if defined(USE_X11) @@ -280,8 +279,8 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { base::mac::ScopedCFTypeRef<CGContextRef> windowless_contexts_[2]; scoped_ptr<WebPluginAcceleratedSurfaceProxy> accelerated_surface_; #else - SkAutoTUnref<SkCanvas> windowless_canvases_[2]; - SkAutoTUnref<SkCanvas> background_canvas_; + skia::RefPtr<SkCanvas> windowless_canvases_[2]; + skia::RefPtr<SkCanvas> background_canvas_; #if defined(USE_X11) scoped_refptr<SharedTransportDIB> windowless_dibs_[2]; |