Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1448)

Side by Side Diff: cc/resources/tile_bundle.h

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: perftest fix Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #ifndef CC_RESOURCES_TILE_BUNDLE_H_
6 #define CC_RESOURCES_TILE_BUNDLE_H_
7
8 #include <utility>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "cc/base/ref_counted_managed.h"
13 #include "cc/resources/tile_priority.h"
14
15 namespace cc {
16
17 class TileManager;
18 class Tile;
19 class PictureLayerTiling;
20 class CC_EXPORT TileBundle : public RefCountedManaged<TileBundle> {
21 public:
22 typedef uint64 Id;
23 typedef std::vector<scoped_refptr<Tile> > TileVector;
24 typedef std::vector<TileVector> TileGrid;
25
26 inline Id id() const { return id_; }
27
28 Tile* TileAt(WhichTree tree, int index_x, int index_y);
29 bool RemoveTileAt(WhichTree tree, int index_x, int index_y);
30 void AddTileAt(WhichTree tree,
31 int index_x,
32 int index_y,
33 scoped_refptr<Tile> tile);
34 inline bool IsEmpty() const { return conservative_count_ == 0; }
35
36 void DidBecomeRecycled();
37 void DidBecomeActive();
38
39 void SetPriority(WhichTree tree, const TilePriority& priority);
40 TilePriority GetPriority(WhichTree tree) const;
41
42 class Iterator {
43 public:
44 explicit Iterator(TileBundle* bundle);
45 ~Iterator();
46
47 Iterator& operator++();
48
49 inline Tile* operator*() { return current_tile_; }
50 inline Tile* operator->() { return current_tile_; }
51 inline operator bool() const { return index_y_ < bundle_->height_; }
52
53 inline int index_x() {
54 return index_x_ + bundle_->offset_x_;
55 }
56 inline int index_y() {
57 return index_y_ + bundle_->offset_y_;
58 }
59
60 TilePriority active_priority() const {
61 return priority_[ACTIVE_TREE] ? *priority_[ACTIVE_TREE]
62 : TilePriority();
63 }
64
65 TilePriority pending_priority() const {
66 return priority_[PENDING_TREE] ? *priority_[PENDING_TREE]
67 : TilePriority();
68 }
69
70 bool active_tree_only_tile() {
71 return active_tree_only_tile_;
72 }
73 bool pending_tree_only_tile() {
74 return pending_tree_only_tile_;
75 }
76
77 private:
78 bool SetTile(WhichTree tree);
enne (OOO) 2013/11/25 22:17:11 Is there a better name for this function?
vmpstr 2013/11/27 00:03:15 Renamed it to InitializeNewTileForTree to better r
79
80 TileBundle* bundle_;
81 Tile* current_tile_;
82 TilePriority* priority_[NUM_TREES];
83 int index_x_;
84 int index_y_;
85 WhichTree current_tree_;
86 bool active_tree_only_tile_;
87 bool pending_tree_only_tile_;
88 };
89
90 private:
91 friend class TileManager;
92 friend class Iterator;
93
94 TileBundle(TileManager* tile_manager,
95 int width,
96 int height,
97 int offset_x,
98 int offset_y);
99 ~TileBundle();
100
101 void UpdateToLocalIndex(int* index_x, int* index_y);
102 Tile* TileAtLocalIndex(WhichTree tree, int x, int y);
103
104 TileManager* tile_manager_;
105
106 TileGrid tiles_[NUM_TREES];
107 int width_;
108 int height_;
109 int offset_x_;
110 int offset_y_;
111
112 TilePriority priority_[NUM_TREES];
113 size_t conservative_count_;
114
115 Id id_;
116 static Id s_next_id_;
117 };
118
119 } // namespace cc
120
121 #endif // CC_RESOURCES_TILE_BUNDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698