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

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

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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_SHARED_TILE_BUNDLE_H_
6 #define CC_RESOURCES_SHARED_TILE_BUNDLE_H_
7
8 #include <utility>
9
10 #include "base/containers/hash_tables.h"
11 #include "cc/resources/tile_bundle.h"
12 #include "cc/resources/tile_priority.h"
13
14 namespace cc {
15
16 class SharedTileBundle {
enne (OOO) 2013/11/20 21:20:30 I'm not quite sure I'm buying the SharedTileBundle
17 public:
18 typedef std::pair<int, int> TileMapKey;
19 typedef base::hash_map<TileMapKey, Tile*> TileMap;
20
21 SharedTileBundle();
22 SharedTileBundle(const TilePriority& active_priority,
23 const TilePriority& pending_priority);
24
25 void AddTileAt(int x, int y, Tile* tile);
26
27 inline const TilePriority& active_priority() const {
28 return active_priority_;
29 }
30
31 inline const TilePriority& pending_priority() const {
32 return pending_priority_;
33 }
34
35 class Iterator {
36 public:
37 explicit Iterator(SharedTileBundle* bundle);
38 ~Iterator();
39
40 inline Iterator& operator++() {
41 DCHECK(iterator_ != bundle_->tiles_.end());
42 ++iterator_;
43 return *this;
44 }
45
46 inline Tile* operator*() { return iterator_->second; }
47 inline Tile* operator->() { return iterator_->second; }
48 inline operator bool() const { return iterator_ != bundle_->tiles_.end(); }
49
50 inline int index_x() { return iterator_->first.first; }
51 inline int index_y() { return iterator_->first.second; }
52
53 private:
54 SharedTileBundle* bundle_;
55 SharedTileBundle::TileMap::const_iterator iterator_;
56 };
57
58 private:
59 TilePriority active_priority_;
60 TilePriority pending_priority_;
61
62 TileMap tiles_;
63 };
64
65 class BundleSetIterator {
66 public:
67 typedef base::hash_map<TileBundle::Id, TileBundle*> TileBundleMap;
68
69 explicit BundleSetIterator(TileBundleMap* bundles);
70 ~BundleSetIterator();
71
72 SharedTileBundle* operator*();
73 SharedTileBundle* operator->();
74 operator bool() const;
75
76 BundleSetIterator& operator++();
77
78 private:
79 enum SharedBundleType {
80 eBothPriorities,
enne (OOO) 2013/11/20 21:20:30 BOTH_PRIORITIES
81 eActivePriorityOnly,
82 ePendingPriorityOnly,
83 eMaxSharedBundleTypes
84 };
85
86 void AdvanceBundleIterator();
87 bool InitializeSharedBundles();
88 bool InitializeSharedBundle(SharedBundleType type);
89 void DetermineActivePendingBundles(TileBundle* bundle, TileBundle* twin);
90
91 TileBundleMap* bundles_;
92 TileBundleMap::iterator current_bundle_iterator_;
93 base::hash_set<TileBundle::Id> processed_bundles_;
94
95 SharedTileBundle current_bundle_;
96 SharedBundleType current_bundle_type_;
97
98 TileBundle* active_bundle_;
99 TileBundle* pending_bundle_;
100 };
101
102 } // namespace cc
103
104 #endif // CC_RESOURCES_SHARED_TILE_BUNDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698