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

Unified Diff: content/plugin/webplugin_proxy.cc

Issue 11428099: Use skia::RefPtr in place of manual ref-counting for Skia types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/plugin/webplugin_proxy.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/plugin/webplugin_proxy.cc
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index 8f8912fec99d557ad15b829cb1b2c902af1d65f5..ac08a59d1f4179dcfd1a4dc8a4c24d4786179689 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);
}
« no previous file with comments | « content/plugin/webplugin_proxy.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698