Update check in KillingRendererClearsDescendantProxies test.
[chromium-blink-merge.git] / cc / tiles / tile.h
blob68c4fc13e340a03725806ccf75e2b186827ce831
1 // Copyright 2012 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_TILES_TILE_H_
6 #define CC_TILES_TILE_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/tiles/tile_draw_info.h"
10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/geometry/size.h"
13 namespace cc {
15 class PrioritizedTile;
16 class TileManager;
17 struct TilePriority;
19 class CC_EXPORT Tile {
20 public:
21 class CC_EXPORT Deleter {
22 public:
23 void operator()(Tile* tile) const;
26 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 };
28 typedef uint64 Id;
30 Id id() const {
31 return id_;
34 // TODO(vmpstr): Move this to the iterators.
35 bool required_for_activation() const { return required_for_activation_; }
36 void set_required_for_activation(bool is_required) {
37 required_for_activation_ = is_required;
39 bool required_for_draw() const { return required_for_draw_; }
40 void set_required_for_draw(bool is_required) {
41 required_for_draw_ = is_required;
44 bool use_picture_analysis() const {
45 return !!(flags_ & USE_PICTURE_ANALYSIS);
48 void AsValueInto(base::trace_event::TracedValue* value) const;
50 const TileDrawInfo& draw_info() const { return draw_info_; }
51 TileDrawInfo& draw_info() { return draw_info_; }
53 float contents_scale() const { return contents_scale_; }
54 gfx::Rect content_rect() const { return content_rect_; }
56 int layer_id() const { return layer_id_; }
58 int source_frame_number() const { return source_frame_number_; }
60 size_t GPUMemoryUsageInBytes() const;
62 gfx::Size desired_texture_size() const { return desired_texture_size_; }
64 void set_tiling_index(int i, int j) {
65 tiling_i_index_ = i;
66 tiling_j_index_ = j;
68 int tiling_i_index() const { return tiling_i_index_; }
69 int tiling_j_index() const { return tiling_j_index_; }
71 private:
72 friend class TileManager;
73 friend class FakeTileManager;
74 friend class FakePictureLayerImpl;
76 // Methods called by by tile manager.
77 Tile(TileManager* tile_manager,
78 const gfx::Size& desired_texture_size,
79 const gfx::Rect& content_rect,
80 float contents_scale,
81 int layer_id,
82 int source_frame_number,
83 int flags);
84 ~Tile();
86 bool HasRasterTask() const { return !!raster_task_.get(); }
88 TileManager* tile_manager_;
89 gfx::Size desired_texture_size_;
90 gfx::Rect content_rect_;
91 float contents_scale_;
93 TileDrawInfo draw_info_;
95 int layer_id_;
96 int source_frame_number_;
97 int flags_;
98 int tiling_i_index_;
99 int tiling_j_index_;
100 bool required_for_activation_ : 1;
101 bool required_for_draw_ : 1;
103 Id id_;
104 static Id s_next_id_;
106 unsigned scheduled_priority_;
108 scoped_refptr<RasterTask> raster_task_;
110 DISALLOW_COPY_AND_ASSIGN(Tile);
113 using ScopedTilePtr = scoped_ptr<Tile, Tile::Deleter>;
115 } // namespace cc
117 #endif // CC_TILES_TILE_H_