use smart pointer for paint_canvas

This commit is contained in:
Heilig Benedek 2017-11-03 01:24:27 +01:00 committed by Cheng Zhao
parent 4b10445c2e
commit 26daffea9c

View file

@ -226,13 +226,13 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
SkBitmap bitmap;
#if defined(ENABLE_OSR)
cc::SkiaPaintCanvas* paint_canvas = nullptr;
std::unique_ptr<cc::SkiaPaintCanvas> paint_canvas;
if (view_proxy_.get()) {
bitmap.allocN32Pixels(popup_->popup_bounds_in_view_.width(),
popup_->popup_bounds_in_view_.height(),
true);
paint_canvas = new cc::SkiaPaintCanvas(bitmap);
draw_canvas = new gfx::Canvas(paint_canvas, 1.0);
paint_canvas.reset(new cc::SkiaPaintCanvas(bitmap));
draw_canvas = new gfx::Canvas(paint_canvas.get(), 1.0);
}
#endif
@ -250,7 +250,6 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
if (view_proxy_.get()) {
view_proxy_->SetBounds(popup_->popup_bounds_in_view_);
view_proxy_->SetBitmap(bitmap);
delete paint_canvas;
}
#endif
}