diff --git a/sky/compositor/BUILD.gn b/sky/compositor/BUILD.gn index 61a6b5cb47e..32828d47c9b 100644 --- a/sky/compositor/BUILD.gn +++ b/sky/compositor/BUILD.gn @@ -14,7 +14,8 @@ source_set("compositor") { "clip_rrect_layer.h", "color_filter_layer.cc", "color_filter_layer.h", - "compositor_config.h", + "compositor_options.cc", + "compositor_options.h", "container_layer.cc", "container_layer.h", "layer.cc", diff --git a/sky/compositor/clip_path_layer.cc b/sky/compositor/clip_path_layer.cc index 3cf9079270e..5415eeb2026 100644 --- a/sky/compositor/clip_path_layer.cc +++ b/sky/compositor/clip_path_layer.cc @@ -13,12 +13,12 @@ ClipPathLayer::ClipPathLayer() { ClipPathLayer::~ClipPathLayer() { } -void ClipPathLayer::Paint(PaintContext& context) { - SkCanvas* canvas = context.canvas(); - canvas->saveLayer(&clip_path_.getBounds(), nullptr); - canvas->clipPath(clip_path_); - PaintChildren(context); - canvas->restore(); +void ClipPathLayer::Paint(PaintContext::ScopedFrame& frame) { + SkCanvas& canvas = frame.canvas(); + canvas.saveLayer(&clip_path_.getBounds(), nullptr); + canvas.clipPath(clip_path_); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/clip_path_layer.h b/sky/compositor/clip_path_layer.h index 67c09fa54e0..ee6d36b5fb8 100644 --- a/sky/compositor/clip_path_layer.h +++ b/sky/compositor/clip_path_layer.h @@ -17,7 +17,8 @@ class ClipPathLayer : public ContainerLayer { void set_clip_path(const SkPath& clip_path) { clip_path_ = clip_path; } - void Paint(PaintContext& context) override; + protected: + void Paint(PaintContext::ScopedFrame& frame) override; private: SkPath clip_path_; diff --git a/sky/compositor/clip_rect_layer.cc b/sky/compositor/clip_rect_layer.cc index e3ae0ee4eea..e2e53838ce6 100644 --- a/sky/compositor/clip_rect_layer.cc +++ b/sky/compositor/clip_rect_layer.cc @@ -13,12 +13,12 @@ ClipRectLayer::ClipRectLayer() { ClipRectLayer::~ClipRectLayer() { } -void ClipRectLayer::Paint(PaintContext& context) { - SkCanvas* canvas = context.canvas(); - canvas->save(); - canvas->clipRect(clip_rect_); - PaintChildren(context); - canvas->restore(); +void ClipRectLayer::Paint(PaintContext::ScopedFrame& frame) { + SkCanvas& canvas = frame.canvas(); + canvas.save(); + canvas.clipRect(clip_rect_); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/clip_rect_layer.h b/sky/compositor/clip_rect_layer.h index 69d752301b3..527ee322637 100644 --- a/sky/compositor/clip_rect_layer.h +++ b/sky/compositor/clip_rect_layer.h @@ -17,7 +17,8 @@ class ClipRectLayer : public ContainerLayer { void set_clip_rect(const SkRect& clip_rect) { clip_rect_ = clip_rect; } - void Paint(PaintContext& context) override; + protected: + void Paint(PaintContext::ScopedFrame& frame) override; private: SkRect clip_rect_; diff --git a/sky/compositor/clip_rrect_layer.cc b/sky/compositor/clip_rrect_layer.cc index 7ec0d5448c4..44ab495a1f1 100644 --- a/sky/compositor/clip_rrect_layer.cc +++ b/sky/compositor/clip_rrect_layer.cc @@ -13,12 +13,12 @@ ClipRRectLayer::ClipRRectLayer() { ClipRRectLayer::~ClipRRectLayer() { } -void ClipRRectLayer::Paint(PaintContext& context) { - SkCanvas* canvas = context.canvas(); - canvas->saveLayer(&clip_rrect_.getBounds(), nullptr); - canvas->clipRRect(clip_rrect_); - PaintChildren(context); - canvas->restore(); +void ClipRRectLayer::Paint(PaintContext::ScopedFrame& frame) { + SkCanvas& canvas = frame.canvas(); + canvas.saveLayer(&clip_rrect_.getBounds(), nullptr); + canvas.clipRRect(clip_rrect_); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/clip_rrect_layer.h b/sky/compositor/clip_rrect_layer.h index 817b3f26713..833b5f3d0ab 100644 --- a/sky/compositor/clip_rrect_layer.h +++ b/sky/compositor/clip_rrect_layer.h @@ -17,7 +17,7 @@ class ClipRRectLayer : public ContainerLayer { void set_clip_rrect(const SkRRect& clip_rrect) { clip_rrect_ = clip_rrect; } - void Paint(PaintContext& context) override; + void Paint(PaintContext::ScopedFrame& frame) override; private: SkRRect clip_rrect_; diff --git a/sky/compositor/color_filter_layer.cc b/sky/compositor/color_filter_layer.cc index 6235f6f9151..8c8f106361a 100644 --- a/sky/compositor/color_filter_layer.cc +++ b/sky/compositor/color_filter_layer.cc @@ -13,15 +13,15 @@ ColorFilterLayer::ColorFilterLayer() { ColorFilterLayer::~ColorFilterLayer() { } -void ColorFilterLayer::Paint(PaintContext& context) { +void ColorFilterLayer::Paint(PaintContext::ScopedFrame& frame) { RefPtr color_filter = adoptRef(SkColorFilter::CreateModeFilter(color_, transfer_mode_)); SkPaint paint; paint.setColorFilter(color_filter.get()); - SkCanvas* canvas = context.canvas(); - canvas->saveLayer(&paint_bounds(), &paint); - PaintChildren(context); - canvas->restore(); + SkCanvas& canvas = frame.canvas(); + canvas.saveLayer(&paint_bounds(), &paint); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/color_filter_layer.h b/sky/compositor/color_filter_layer.h index 9695896c75a..db083275621 100644 --- a/sky/compositor/color_filter_layer.h +++ b/sky/compositor/color_filter_layer.h @@ -21,7 +21,7 @@ class ColorFilterLayer : public ContainerLayer { transfer_mode_ = transfer_mode; } - void Paint(PaintContext& context) override; + void Paint(PaintContext::ScopedFrame& frame) override; private: SkColor color_; diff --git a/sky/compositor/compositor_config.h b/sky/compositor/compositor_config.h deleted file mode 100644 index d54e6feef97..00000000000 --- a/sky/compositor/compositor_config.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_ -#define SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_ - -// SkPictures that dont mutate from frame to frame are rasterized by the picture -// rasterizer. This guard enables highlighting the rasterized images. Useful -// when debugging caching -#define COMPOSITOR_HIGHLIGHT_RASTERIZED_PICTURES 0 - -#endif // SKY_COMPOSITOR_COMPOSITOR_CONFIG_H_ diff --git a/sky/compositor/compositor_options.cc b/sky/compositor/compositor_options.cc new file mode 100644 index 00000000000..8317da170cd --- /dev/null +++ b/sky/compositor/compositor_options.cc @@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sky/compositor/compositor_options.h" + +namespace sky { +namespace compositor { + +CompositorOptions::CompositorOptions() { + static_assert(std::is_unsigned::value, + "OptionType must be unsigned"); + options_.resize(static_cast(Option::TerminationSentinel), false); +} + +bool CompositorOptions::isEnabled(Option option) const { + if (option >= Option::TerminationSentinel) { + return false; + } + + return options_[static_cast(option)]; +} + +void CompositorOptions::setEnabled(Option option, bool enabled) { + if (option < Option::TerminationSentinel) { + options_[static_cast(option)] = enabled; + } +} + +CompositorOptions::~CompositorOptions() { +} + +} // namespace compositor +} // namespace sky diff --git a/sky/compositor/compositor_options.h b/sky/compositor/compositor_options.h new file mode 100644 index 00000000000..c20ce861233 --- /dev/null +++ b/sky/compositor/compositor_options.h @@ -0,0 +1,42 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ +#define SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ + +#include "base/macros.h" +#include + +namespace sky { +namespace compositor { + +class CompositorOptions { + public: + using OptionType = unsigned int; + enum class Option : OptionType { + // SkPictures that dont mutate from frame to frame are rasterized by the + // picture rasterizer. This guard enables highlighting the rasterized + // images. Useful when debugging caching. + HightlightRasterizedImages, + + TerminationSentinel, + }; + + CompositorOptions(); + ~CompositorOptions(); + + bool isEnabled(Option option) const; + + void setEnabled(Option option, bool enabled); + + private: + std::vector options_; + + DISALLOW_COPY_AND_ASSIGN(CompositorOptions); +}; + +} // namespace compositor +} // namespace sky + +#endif // SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_ diff --git a/sky/compositor/container_layer.cc b/sky/compositor/container_layer.cc index 51323e54c69..18d8115b4dd 100644 --- a/sky/compositor/container_layer.cc +++ b/sky/compositor/container_layer.cc @@ -18,9 +18,9 @@ void ContainerLayer::Add(std::unique_ptr layer) { layers_.push_back(std::move(layer)); } -void ContainerLayer::PaintChildren(PaintContext& context) const { +void ContainerLayer::PaintChildren(PaintContext::ScopedFrame& frame) const { for (auto& layer : layers_) - layer->Paint(context); + layer->Paint(frame); } } // namespace compositor diff --git a/sky/compositor/container_layer.h b/sky/compositor/container_layer.h index 6c35ebfacce..191f39c2d73 100644 --- a/sky/compositor/container_layer.h +++ b/sky/compositor/container_layer.h @@ -17,7 +17,7 @@ class ContainerLayer : public Layer { void Add(std::unique_ptr layer); - void PaintChildren(PaintContext& context) const; + void PaintChildren(PaintContext::ScopedFrame& frame) const; const std::vector>& layers() const { return layers_; } diff --git a/sky/compositor/layer.h b/sky/compositor/layer.h index d48c6cf802c..eef63a7b8f5 100644 --- a/sky/compositor/layer.h +++ b/sky/compositor/layer.h @@ -32,7 +32,7 @@ class Layer { Layer(); virtual ~Layer(); - virtual void Paint(PaintContext& context) = 0; + virtual void Paint(PaintContext::ScopedFrame& frame) = 0; virtual SkMatrix model_view_matrix(const SkMatrix& model_matrix) const; diff --git a/sky/compositor/opacity_layer.cc b/sky/compositor/opacity_layer.cc index 619a769d555..fc10aacc7e2 100644 --- a/sky/compositor/opacity_layer.cc +++ b/sky/compositor/opacity_layer.cc @@ -13,16 +13,16 @@ OpacityLayer::OpacityLayer() { OpacityLayer::~OpacityLayer() { } -void OpacityLayer::Paint(PaintContext& context) { +void OpacityLayer::Paint(PaintContext::ScopedFrame& frame) { SkColor color = SkColorSetARGB(alpha_, 0, 0, 0); RefPtr colorFilter = adoptRef( SkColorFilter::CreateModeFilter(color, SkXfermode::kSrcOver_Mode)); SkPaint paint; paint.setColorFilter(colorFilter.get()); - SkCanvas* canvas = context.canvas(); - canvas->saveLayer(&paint_bounds(), &paint); - PaintChildren(context); - canvas->restore(); + SkCanvas& canvas = frame.canvas(); + canvas.saveLayer(&paint_bounds(), &paint); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/opacity_layer.h b/sky/compositor/opacity_layer.h index e4d26116e66..5d684f0bcda 100644 --- a/sky/compositor/opacity_layer.h +++ b/sky/compositor/opacity_layer.h @@ -17,7 +17,8 @@ class OpacityLayer : public ContainerLayer { void set_alpha(int alpha) { alpha_ = alpha; } - void Paint(PaintContext& context) override; + protected: + void Paint(PaintContext::ScopedFrame& frame) override; private: int alpha_; diff --git a/sky/compositor/paint_context.cc b/sky/compositor/paint_context.cc index ab21b96b46d..36bced89b5f 100644 --- a/sky/compositor/paint_context.cc +++ b/sky/compositor/paint_context.cc @@ -3,14 +3,24 @@ // found in the LICENSE file. #include "sky/compositor/paint_context.h" +#include "base/logging.h" namespace sky { namespace compositor { -PaintContext::PaintContext(PictureRasterzier& rasterizer, - GrContext* gr_context, - SkCanvas* canvas) - : rasterizer_(rasterizer), gr_context_(gr_context), canvas_(canvas) { +PaintContext::PaintContext() { +} + +void PaintContext::beginFrame() { +} + +void PaintContext::endFrame() { + rasterizer_.PurgeCache(); +} + +PaintContext::ScopedFrame PaintContext::AcquireFrame(SkCanvas& canvas, + GrContext* gr_context) { + return ScopedFrame(*this, canvas, gr_context); } PaintContext::~PaintContext() { diff --git a/sky/compositor/paint_context.h b/sky/compositor/paint_context.h index d3af878f578..40d96bc9ac1 100644 --- a/sky/compositor/paint_context.h +++ b/sky/compositor/paint_context.h @@ -6,6 +6,8 @@ #define SKY_COMPOSITOR_PAINT_CONTEXT_CC_ #include "base/macros.h" +#include "base/logging.h" +#include "sky/compositor/compositor_options.h" #include "sky/compositor/picture_rasterizer.h" namespace sky { @@ -13,21 +15,52 @@ namespace compositor { class PaintContext { public: - PaintContext(PictureRasterzier& rasterizer, - GrContext* gr_context, - SkCanvas* canvas); + class ScopedFrame { + public: + PaintContext& paint_context() { return context_; }; + + GrContext* gr_context() { return gr_context_; } + + SkCanvas& canvas() { return canvas_; } + + ScopedFrame(ScopedFrame&& frame) = default; + + ~ScopedFrame() { context_.endFrame(); } + + private: + PaintContext& context_; + SkCanvas& canvas_; + GrContext* gr_context_; + + ScopedFrame() = delete; + + ScopedFrame(PaintContext& context, SkCanvas& canvas, GrContext* gr_context) + : context_(context), canvas_(canvas), gr_context_(gr_context) { + DCHECK(&canvas) << "The frame requries a valid canvas"; + context_.beginFrame(); + }; + + friend class PaintContext; + + DISALLOW_COPY_AND_ASSIGN(ScopedFrame); + }; + + PaintContext(); ~PaintContext(); PictureRasterzier& rasterizer() { return rasterizer_; } - GrContext* gr_context() { return gr_context_; } + CompositorOptions& options() { return options_; }; - SkCanvas* canvas() { return canvas_; } + ScopedFrame AcquireFrame(SkCanvas& canvas, GrContext* gr_context); private: - PictureRasterzier& rasterizer_; - GrContext* gr_context_; - SkCanvas* canvas_; + PictureRasterzier rasterizer_; + CompositorOptions options_; + + void beginFrame(); + + void endFrame(); DISALLOW_COPY_AND_ASSIGN(PaintContext); }; diff --git a/sky/compositor/picture_layer.cc b/sky/compositor/picture_layer.cc index a04da168677..36e06d59dd9 100644 --- a/sky/compositor/picture_layer.cc +++ b/sky/compositor/picture_layer.cc @@ -20,23 +20,24 @@ SkMatrix PictureLayer::model_view_matrix(const SkMatrix& model_matrix) const { return modelView; } -void PictureLayer::Paint(PaintContext& context) { +void PictureLayer::Paint(PaintContext::ScopedFrame& frame) { DCHECK(picture_); const SkRect& bounds = paint_bounds(); SkISize size = SkISize::Make(bounds.width(), bounds.height()); - RefPtr image = context.rasterizer().GetCachedImageIfPresent( - context.gr_context(), picture_.get(), size); - SkCanvas* canvas = context.canvas(); + RefPtr image = + frame.paint_context().rasterizer().GetCachedImageIfPresent( + frame.paint_context(), frame.gr_context(), picture_.get(), size); + SkCanvas& canvas = frame.canvas(); if (image) { - canvas->drawImage(image.get(), offset_.x(), offset_.y()); + canvas.drawImage(image.get(), offset_.x(), offset_.y()); } else { - canvas->save(); - canvas->translate(offset_.x(), offset_.y()); - canvas->drawPicture(picture_.get()); - canvas->restore(); + canvas.save(); + canvas.translate(offset_.x(), offset_.y()); + canvas.drawPicture(picture_.get()); + canvas.restore(); } } diff --git a/sky/compositor/picture_layer.h b/sky/compositor/picture_layer.h index 44a84601e4c..f225e76cf6d 100644 --- a/sky/compositor/picture_layer.h +++ b/sky/compositor/picture_layer.h @@ -21,10 +21,10 @@ class PictureLayer : public Layer { SkMatrix model_view_matrix(const SkMatrix& model_matrix) const override; - void Paint(PaintContext& context) override; - SkPicture* picture() const { return picture_.get(); } + void Paint(PaintContext::ScopedFrame& frame) override; + private: SkPoint offset_; RefPtr picture_; diff --git a/sky/compositor/picture_rasterizer.cc b/sky/compositor/picture_rasterizer.cc index 8a60fe4ec95..35af3778ef0 100644 --- a/sky/compositor/picture_rasterizer.cc +++ b/sky/compositor/picture_rasterizer.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "sky/compositor/compositor_config.h" +#include "sky/compositor/compositor_options.h" #include "sky/compositor/checkerboard.h" #include "sky/compositor/picture_rasterizer.h" +#include "sky/compositor/paint_context.h" #include "base/logging.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/gpu/GrContext.h" @@ -37,7 +38,8 @@ PictureRasterzier::Value::Value() PictureRasterzier::Value::~Value() { } -static RefPtr ImageFromPicture(GrContext* context, +static RefPtr ImageFromPicture(PaintContext& context, + GrContext* gr_context, SkPicture* picture, const SkISize& size) { // Step 1: Create a texture from the context's texture provider @@ -48,7 +50,7 @@ static RefPtr ImageFromPicture(GrContext* context, desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fConfig = kRGBA_8888_GrPixelConfig; - GrTexture* texture = context->textureProvider()->createTexture(desc, true); + GrTexture* texture = gr_context->textureProvider()->createTexture(desc, true); if (!texture) { // The texture provider could not allocate a texture backing. Render @@ -82,21 +84,25 @@ static RefPtr ImageFromPicture(GrContext* context, canvas->drawPicture(picture); -#if COMPOSITOR_HIGHLIGHT_RASTERIZED_PICTURES - DrawCheckerboard(canvas, desc.fWidth, desc.fHeight); -#endif + if (context.options().isEnabled( + CompositorOptions::Option::HightlightRasterizedImages)) { + DrawCheckerboard(canvas, desc.fWidth, desc.fHeight); + } // Step 4: Create an image representation from the texture - RefPtr image = adoptRef(SkImage::NewFromTexture( - context, backendDesc, kPremul_SkAlphaType, &ImageReleaseProc, texture)); + RefPtr image = adoptRef( + SkImage::NewFromTexture(gr_context, backendDesc, kPremul_SkAlphaType, + &ImageReleaseProc, texture)); return image; } -RefPtr PictureRasterzier::GetCachedImageIfPresent(GrContext* context, - SkPicture* picture, - SkISize size) { - if (size.isEmpty() || picture == nullptr || context == nullptr) { +RefPtr PictureRasterzier::GetCachedImageIfPresent( + PaintContext& context, + GrContext* gr_context, + SkPicture* picture, + SkISize size) { + if (size.isEmpty() || picture == nullptr || gr_context == nullptr) { return nullptr; } @@ -114,7 +120,7 @@ RefPtr PictureRasterzier::GetCachedImageIfPresent(GrContext* context, << "Did you forget to call purge_cache between frames?"; if (!value.image) { - value.image = ImageFromPicture(context, picture, size); + value.image = ImageFromPicture(context, gr_context, picture, size); } return value.image; diff --git a/sky/compositor/picture_rasterizer.h b/sky/compositor/picture_rasterizer.h index fbde8d40021..634cb887676 100644 --- a/sky/compositor/picture_rasterizer.h +++ b/sky/compositor/picture_rasterizer.h @@ -18,12 +18,14 @@ namespace sky { namespace compositor { +class PaintContext; class PictureRasterzier { public: PictureRasterzier(); ~PictureRasterzier(); - RefPtr GetCachedImageIfPresent(GrContext* context, + RefPtr GetCachedImageIfPresent(PaintContext& context, + GrContext* gr_context, SkPicture* picture, SkISize size); diff --git a/sky/compositor/transform_layer.cc b/sky/compositor/transform_layer.cc index 2d9dfe1bcb2..9eda297d4db 100644 --- a/sky/compositor/transform_layer.cc +++ b/sky/compositor/transform_layer.cc @@ -19,12 +19,12 @@ SkMatrix TransformLayer::model_view_matrix(const SkMatrix& model_matrix) const { return modelView; } -void TransformLayer::Paint(PaintContext& context) { - SkCanvas* canvas = context.canvas(); - canvas->save(); - canvas->concat(transform_); - PaintChildren(context); - canvas->restore(); +void TransformLayer::Paint(PaintContext::ScopedFrame& frame) { + SkCanvas& canvas = frame.canvas(); + canvas.save(); + canvas.concat(transform_); + PaintChildren(frame); + canvas.restore(); } } // namespace compositor diff --git a/sky/compositor/transform_layer.h b/sky/compositor/transform_layer.h index b669efae3c3..4f2fea1577b 100644 --- a/sky/compositor/transform_layer.h +++ b/sky/compositor/transform_layer.h @@ -19,7 +19,7 @@ class TransformLayer : public ContainerLayer { SkMatrix model_view_matrix(const SkMatrix& model_matrix) const override; - void Paint(PaintContext& context) override; + void Paint(PaintContext::ScopedFrame& frame) override; private: SkMatrix transform_; diff --git a/sky/shell/gpu/rasterizer.cc b/sky/shell/gpu/rasterizer.cc index 03a814d4f44..90c5d0861c9 100644 --- a/sky/shell/gpu/rasterizer.cc +++ b/sky/shell/gpu/rasterizer.cc @@ -78,8 +78,10 @@ void Rasterizer::Draw(scoped_ptr layer_tree) { SkCanvas* canvas = ganesh_surface_->canvas(); canvas->clear(SK_ColorBLACK); - compositor::PaintContext context(rasterizer_, ganesh_context_->gr(), canvas); - layer_tree->root_layer()->Paint(context); + { + auto frame = paint_context_.AcquireFrame(*canvas, ganesh_context_->gr()); + layer_tree->root_layer()->Paint(frame); + } canvas->flush(); surface_->SwapBuffers(); diff --git a/sky/shell/gpu/rasterizer.h b/sky/shell/gpu/rasterizer.h index cb766342ab1..8b56784fa6b 100644 --- a/sky/shell/gpu/rasterizer.h +++ b/sky/shell/gpu/rasterizer.h @@ -11,7 +11,7 @@ #include "sky/shell/gpu_delegate.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" -#include "sky/compositor/picture_rasterizer.h" +#include "sky/compositor/paint_context.h" class SkPicture; @@ -48,7 +48,7 @@ class Rasterizer : public GPUDelegate { scoped_ptr ganesh_context_; scoped_ptr ganesh_surface_; - compositor::PictureRasterzier rasterizer_; + compositor::PaintContext paint_context_; base::WeakPtrFactory weak_factory_;