Adding Peter Thatcher to the owners file.
[chromium-blink-merge.git] / cc / layers / content_layer.h
blob5d6ac15a8010d1c489d1b635040b7cb734cc7333
1 // Copyright 2010 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_LAYERS_CONTENT_LAYER_H_
6 #define CC_LAYERS_CONTENT_LAYER_H_
8 #include "base/basictypes.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/layers/tiled_layer.h"
11 #include "cc/resources/layer_painter.h"
13 class SkCanvas;
15 namespace cc {
17 class ContentLayerClient;
18 class ContentLayerUpdater;
20 class CC_EXPORT ContentLayerPainter : public LayerPainter {
21 public:
22 static scoped_ptr<ContentLayerPainter> Create(ContentLayerClient* client);
24 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override;
26 private:
27 explicit ContentLayerPainter(ContentLayerClient* client);
29 ContentLayerClient* client_;
31 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter);
34 // A layer that renders its contents into an SkCanvas.
35 class CC_EXPORT ContentLayer : public TiledLayer {
36 public:
37 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client);
39 void ClearClient();
41 void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override;
42 void SetTexturePriorities(const PriorityCalculator& priority_calc) override;
43 bool Update(ResourceUpdateQueue* queue,
44 const OcclusionTracker<Layer>* occlusion) override;
45 bool NeedMoreUpdates() override;
47 void SetContentsOpaque(bool contents_opaque) override;
49 skia::RefPtr<SkPicture> GetPicture() const override;
51 void OnOutputSurfaceCreated() override;
53 protected:
54 explicit ContentLayer(ContentLayerClient* client);
55 ~ContentLayer() override;
57 bool HasDrawableContent() const override;
59 // TiledLayer implementation.
60 LayerUpdater* Updater() const override;
62 private:
63 // TiledLayer implementation.
64 void CreateUpdaterIfNeeded() override;
66 ContentLayerClient* client_;
67 scoped_refptr<ContentLayerUpdater> updater_;
69 DISALLOW_COPY_AND_ASSIGN(ContentLayer);
72 } // namespace cc
73 #endif // CC_LAYERS_CONTENT_LAYER_H_