[safe browsing] Push missing download BINHASH histograms.
[chromium-blink-merge.git] / cc / layers / content_layer.h
blob783e094e8a675984ef4807b69dfe16ee770c776e
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 virtual void Paint(SkCanvas* canvas,
25 const gfx::Rect& content_rect,
26 gfx::RectF* opaque) OVERRIDE;
28 private:
29 explicit ContentLayerPainter(ContentLayerClient* client);
31 ContentLayerClient* client_;
33 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter);
36 // A layer that renders its contents into an SkCanvas.
37 class CC_EXPORT ContentLayer : public TiledLayer {
38 public:
39 static scoped_refptr<ContentLayer> Create(ContentLayerClient* client);
41 void ClearClient() { client_ = NULL; }
43 virtual bool DrawsContent() const OVERRIDE;
44 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE;
45 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
46 OVERRIDE;
47 virtual bool Update(ResourceUpdateQueue* queue,
48 const OcclusionTracker* occlusion) OVERRIDE;
49 virtual bool NeedMoreUpdates() OVERRIDE;
51 virtual void SetContentsOpaque(bool contents_opaque) OVERRIDE;
53 virtual bool SupportsLCDText() const OVERRIDE;
55 virtual skia::RefPtr<SkPicture> GetPicture() const OVERRIDE;
57 virtual void OnOutputSurfaceCreated() OVERRIDE;
59 protected:
60 explicit ContentLayer(ContentLayerClient* client);
61 virtual ~ContentLayer();
63 // TiledLayer implementation.
64 virtual LayerUpdater* Updater() const OVERRIDE;
66 private:
67 // TiledLayer implementation.
68 virtual void CreateUpdaterIfNeeded() OVERRIDE;
70 void UpdateCanUseLCDText();
72 ContentLayerClient* client_;
73 scoped_refptr<ContentLayerUpdater> updater_;
74 bool can_use_lcd_text_last_frame_;
76 DISALLOW_COPY_AND_ASSIGN(ContentLayer);
79 } // namespace cc
80 #endif // CC_LAYERS_CONTENT_LAYER_H_