Sync: Avoid deadlock in SyncBackendRegistrar / ModelSafeWorker on sync backend shutdown.
[chromium-blink-merge.git] / cc / resources / bitmap_skpicture_content_layer_updater.h
blob030db6eb5042c6b4eaab8afd6926a31022e14bca
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_
6 #define CC_RESOURCES_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_
8 #include "cc/resources/skpicture_content_layer_updater.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
11 namespace cc {
13 // This class records the content_rect into an SkPicture, then software
14 // rasterizes the SkPicture into bitmaps for each tile. This implements
15 // LayerTreeSettingSettings::per_tile_painting_enabled.
16 class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
17 public:
18 class Resource : public ContentLayerUpdater::Resource {
19 public:
20 Resource(BitmapSkPictureContentLayerUpdater* updater,
21 scoped_ptr<PrioritizedResource> texture);
23 virtual void Update(ResourceUpdateQueue* queue,
24 const gfx::Rect& source_rect,
25 const gfx::Vector2d& dest_offset,
26 bool partial_update) override;
28 private:
29 SkBitmap bitmap_;
30 BitmapSkPictureContentLayerUpdater* updater_;
32 DISALLOW_COPY_AND_ASSIGN(Resource);
35 static scoped_refptr<BitmapSkPictureContentLayerUpdater> Create(
36 scoped_ptr<LayerPainter> painter,
37 RenderingStatsInstrumentation* stats_instrumentation,
38 int layer_id);
40 virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
41 PrioritizedResourceManager* manager) override;
42 void PaintContentsRect(SkCanvas* canvas,
43 const gfx::Rect& source_rect);
45 private:
46 BitmapSkPictureContentLayerUpdater(
47 scoped_ptr<LayerPainter> painter,
48 RenderingStatsInstrumentation* stats_instrumentation,
49 int layer_id);
50 virtual ~BitmapSkPictureContentLayerUpdater();
52 DISALLOW_COPY_AND_ASSIGN(BitmapSkPictureContentLayerUpdater);
55 } // namespace cc
57 #endif // CC_RESOURCES_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_