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

Side by Side Diff: cc/tile_manager.h

Issue 12217105: cc: Check for completed raster tasks at interval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TILE_MANAGER_H_ 5 #ifndef CC_TILE_MANAGER_H_
6 #define CC_TILE_MANAGER_H_ 6 #define CC_TILE_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "cc/memory_history.h" 15 #include "cc/memory_history.h"
16 #include "cc/rendering_stats.h" 16 #include "cc/rendering_stats.h"
17 #include "cc/resource_pool.h" 17 #include "cc/resource_pool.h"
18 #include "cc/tile_priority.h" 18 #include "cc/tile_priority.h"
19 19
20 namespace cc { 20 namespace cc {
21 class RasterWorkerPool; 21 class RasterWorkerPool;
22 class ResourceProvider; 22 class ResourceProvider;
23 class Tile; 23 class Tile;
24 class TileVersion; 24 class TileVersion;
25 25
26 class CC_EXPORT TileManagerClient { 26 class CC_EXPORT TileManagerClient {
27 public: 27 public:
28 virtual void ScheduleManageTiles() = 0; 28 virtual void ScheduleManageTiles() = 0;
29 virtual void ScheduleCheckForCompletedRasterTasks() = 0;
29 virtual void DidUploadVisibleHighResolutionTile() = 0; 30 virtual void DidUploadVisibleHighResolutionTile() = 0;
30 31
31 protected: 32 protected:
32 virtual ~TileManagerClient() {} 33 virtual ~TileManagerClient() {}
33 }; 34 };
34 35
35 // Tile manager classifying tiles into a few basic 36 // Tile manager classifying tiles into a few basic
36 // bins: 37 // bins:
37 enum TileManagerBin { 38 enum TileManagerBin {
38 NOW_BIN = 0, // Needed ASAP. 39 NOW_BIN = 0, // Needed ASAP.
39 SOON_BIN = 1, // Impl-side version of prepainting. 40 SOON_BIN = 1, // Impl-side version of prepainting.
40 EVENTUALLY_BIN = 2, // Nice to have, if we've got memory and time. 41 EVENTUALLY_BIN = 2, // Nice to have, if we've got memory and time.
41 NEVER_BIN = 3, // Dont bother. 42 NEVER_BIN = 3, // Dont bother.
42 NUM_BINS = 4 43 NUM_BINS = 4
43 // Be sure to update TileManagerBinAsValue when adding new fields. 44 // Be sure to update TileManagerBinAsValue when adding new fields.
44 }; 45 };
45 scoped_ptr<base::Value> TileManagerBinAsValue( 46 scoped_ptr<base::Value> TileManagerBinAsValue(
46 TileManagerBin bin); 47 TileManagerBin bin);
47 48
48 enum TileManagerBinPriority { 49 enum TileManagerBinPriority {
49 HIGH_PRIORITY_BIN = 0, 50 HIGH_PRIORITY_BIN = 0,
50 LOW_PRIORITY_BIN = 1, 51 LOW_PRIORITY_BIN = 1,
51 NUM_BIN_PRIORITIES = 2 52 NUM_BIN_PRIORITIES = 2
52 }; 53 };
53 54
54 enum TileRasterState { 55 enum TileRasterState {
55 IDLE_STATE = 0, 56 IDLE_STATE = 0,
56 WAITING_FOR_RASTER_STATE = 1, 57 WAITING_FOR_RASTER_STATE = 1,
57 RASTER_STATE = 2, 58 RASTER_STATE = 2,
58 SET_PIXELS_STATE = 3, 59 UPLOAD_STATE = 3,
brianderson 2013/02/12 01:44:31 Is changing "set_pixels" to "upload" just a cleanu
reveman 2013/02/12 02:29:52 Yes, that's just cleanup and I'm fine moving that
59 NUM_STATES = 4 60 NUM_STATES = 4
60 }; 61 };
61 62
62 // This is state that is specific to a tile that is 63 // This is state that is specific to a tile that is
63 // managed by the TileManager. 64 // managed by the TileManager.
64 class CC_EXPORT ManagedTileState { 65 class CC_EXPORT ManagedTileState {
65 public: 66 public:
66 ManagedTileState(); 67 ManagedTileState();
67 ~ManagedTileState(); 68 ~ManagedTileState();
68 69
(...skipping 28 matching lines...) Expand all
97 size_t num_raster_threads, 98 size_t num_raster_threads,
98 bool use_cheapess_estimator); 99 bool use_cheapess_estimator);
99 virtual ~TileManager(); 100 virtual ~TileManager();
100 101
101 const GlobalStateThatImpactsTilePriority& GlobalState() const { 102 const GlobalStateThatImpactsTilePriority& GlobalState() const {
102 return global_state_; 103 return global_state_;
103 } 104 }
104 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); 105 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state);
105 106
106 void ManageTiles(); 107 void ManageTiles();
108 void CheckForCompletedRasterTasks();
107 void CheckForCompletedTileUploads(); 109 void CheckForCompletedTileUploads();
108 110
109 scoped_ptr<base::Value> AsValue() const; 111 scoped_ptr<base::Value> AsValue() const;
110 void GetMemoryStats(size_t* memoryRequiredBytes, 112 void GetMemoryStats(size_t* memoryRequiredBytes,
111 size_t* memoryNiceToHaveBytes, 113 size_t* memoryNiceToHaveBytes,
112 size_t* memoryUsedBytes) const; 114 size_t* memoryUsedBytes) const;
113 void SetRecordRenderingStats(bool record_rendering_stats); 115 void SetRecordRenderingStats(bool record_rendering_stats);
114 void GetRenderingStats(RenderingStats* stats); 116 void GetRenderingStats(RenderingStats* stats);
115 bool HasPendingWorkScheduled(WhichTree tree) const; 117 bool HasPendingWorkScheduled(WhichTree tree) const;
116 118
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 192
191 typedef std::list<Tile*> TileList; 193 typedef std::list<Tile*> TileList;
192 // Tiles with image decoding tasks. These tiles need to be rasterized 194 // Tiles with image decoding tasks. These tiles need to be rasterized
193 // when all the image decoding tasks finish. 195 // when all the image decoding tasks finish.
194 TileList tiles_with_image_decoding_tasks_; 196 TileList tiles_with_image_decoding_tasks_;
195 197
196 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; 198 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
197 PixelRefMap pending_decode_tasks_; 199 PixelRefMap pending_decode_tasks_;
198 200
199 typedef std::queue<scoped_refptr<Tile> > TileQueue; 201 typedef std::queue<scoped_refptr<Tile> > TileQueue;
200 TileQueue tiles_with_pending_set_pixels_; 202 TileQueue tiles_with_pending_upload_;
201 size_t bytes_pending_set_pixels_;
202 bool ever_exceeded_memory_budget_; 203 bool ever_exceeded_memory_budget_;
203 MemoryHistory::Entry memory_stats_from_last_assign_; 204 MemoryHistory::Entry memory_stats_from_last_assign_;
204 205
206 size_t bytes_pending_raster_;
207 size_t bytes_pending_upload_;
208
205 bool record_rendering_stats_; 209 bool record_rendering_stats_;
206 RenderingStats rendering_stats_; 210 RenderingStats rendering_stats_;
207 211
208 bool use_cheapness_estimator_; 212 bool use_cheapness_estimator_;
209 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; 213 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS];
210 214
211 DISALLOW_COPY_AND_ASSIGN(TileManager); 215 DISALLOW_COPY_AND_ASSIGN(TileManager);
212 }; 216 };
213 217
214 } // namespace cc 218 } // namespace cc
215 219
216 #endif // CC_TILE_MANAGER_H_ 220 #endif // CC_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698