Fix flaky PDFExtensionTest
[chromium-blink-merge.git] / cc / layers / tiled_layer_impl.h
blob8a7f9f4583058edb479df72f34b82a074ed05703
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_LAYERS_TILED_LAYER_IMPL_H_
6 #define CC_LAYERS_TILED_LAYER_IMPL_H_
8 #include <string>
10 #include "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h"
13 namespace cc {
15 class LayerTilingData;
16 class DrawableTile;
18 class CC_EXPORT TiledLayerImpl : public LayerImpl {
19 public:
20 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
21 return make_scoped_ptr(
22 new TiledLayerImpl(tree_impl, id, new LayerImpl::SyncedScrollOffset));
24 static scoped_ptr<TiledLayerImpl> Create(
25 LayerTreeImpl* tree_impl,
26 int id,
27 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset) {
28 return make_scoped_ptr(
29 new TiledLayerImpl(tree_impl, id, synced_scroll_offset));
31 ~TiledLayerImpl() override;
33 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
34 void PushPropertiesTo(LayerImpl* layer) override;
36 bool WillDraw(DrawMode draw_mode,
37 ResourceProvider* resource_provider) override;
38 void AppendQuads(RenderPass* render_pass,
39 AppendQuadsData* append_quads_data) override;
41 void GetContentsResourceId(ResourceId* resource_id,
42 gfx::Size* resource_size) const override;
44 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; }
45 void SetTilingData(const LayerTilingData& tiler);
46 void PushTileProperties(int i,
47 int j,
48 ResourceId resource,
49 bool contents_swizzled);
50 void PushInvalidTile(int i, int j);
52 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override;
53 void ReleaseResources() override;
55 const LayerTilingData* TilingForTesting() const { return tiler_.get(); }
57 size_t GPUMemoryUsageInBytes() const override;
59 protected:
60 TiledLayerImpl(LayerTreeImpl* tree_impl, int id);
61 TiledLayerImpl(
62 LayerTreeImpl* tree_impl,
63 int id,
64 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset);
65 // Exposed for testing.
66 bool HasTileAt(int i, int j) const;
67 bool HasResourceIdForTileAt(int i, int j) const;
69 void GetDebugBorderProperties(SkColor* color, float* width) const override;
70 void AsValueInto(base::trace_event::TracedValue* dict) const override;
72 private:
73 const char* LayerTypeAsString() const override;
75 DrawableTile* TileAt(int i, int j) const;
76 DrawableTile* CreateTile(int i, int j);
78 bool skips_draw_;
80 scoped_ptr<LayerTilingData> tiler_;
82 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl);
85 } // namespace cc
87 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_