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

Side by Side Diff: cc/tiles/tile_manager.h

Issue 1210073020: Reland (2): cc: Make tile manager object persist for the length of LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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_TILES_TILE_MANAGER_H_ 5 #ifndef CC_TILES_TILE_MANAGER_H_
6 #define CC_TILES_TILE_MANAGER_H_ 6 #define CC_TILES_TILE_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Adding additional values requires increasing kNumberOfTaskSets in 99 // Adding additional values requires increasing kNumberOfTaskSets in
100 // tile_task_runner.h 100 // tile_task_runner.h
101 }; 101 };
102 102
103 static_assert(NamedTaskSet::ALL == (kNumberOfTaskSets - 1), 103 static_assert(NamedTaskSet::ALL == (kNumberOfTaskSets - 1),
104 "NamedTaskSet::ALL should be equal to kNumberOfTaskSets" 104 "NamedTaskSet::ALL should be equal to kNumberOfTaskSets"
105 "minus 1"); 105 "minus 1");
106 106
107 static scoped_ptr<TileManager> Create(TileManagerClient* client, 107 static scoped_ptr<TileManager> Create(TileManagerClient* client,
108 base::SequencedTaskRunner* task_runner, 108 base::SequencedTaskRunner* task_runner,
109 ResourcePool* resource_pool,
110 TileTaskRunner* tile_task_runner,
111 size_t scheduled_raster_task_limit); 109 size_t scheduled_raster_task_limit);
112 ~TileManager() override; 110 ~TileManager() override;
113 111
114 // Assigns tile memory and schedules work to prepare tiles for drawing. 112 // Assigns tile memory and schedules work to prepare tiles for drawing.
115 // - Runs client_->NotifyReadyToActivate() when all tiles required for 113 // - Runs client_->NotifyReadyToActivate() when all tiles required for
116 // activation are prepared, or failed to prepare due to OOM. 114 // activation are prepared, or failed to prepare due to OOM.
117 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are 115 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are
118 // prepared, or failed to prepare due to OOM. 116 // prepared, or failed to prepare due to OOM.
119 void PrepareTiles(const GlobalStateThatImpactsTilePriority& state); 117 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state);
118
119 // Synchronously finish any in progress work, cancel the rest, and clean up as
120 // much resources as possible. Also, prevents any future work until a
121 // SetResources call.
122 void FinishTasksAndCleanUp();
123
124 // Set the new given resource pool and tile task runner.
enne (OOO) 2015/07/06 18:07:25 Should you leave a comment here that you need to c
vmpstr 2015/07/06 18:41:35 In order to ensure that the caller is aware that F
125 void SetResources(ResourcePool* resource_pool,
126 TileTaskRunner* tile_task_runner);
120 127
121 // This causes any completed raster work to finalize, so that tiles get up to 128 // This causes any completed raster work to finalize, so that tiles get up to
122 // date draw information. 129 // date draw information.
123 void Flush(); 130 void Flush();
124 131
125 ScopedTilePtr CreateTile(const gfx::Size& desired_texture_size, 132 ScopedTilePtr CreateTile(const gfx::Size& desired_texture_size,
126 const gfx::Rect& content_rect, 133 const gfx::Rect& content_rect,
127 float contents_scale, 134 float contents_scale,
128 int layer_id, 135 int layer_id,
129 int source_frame_number, 136 int source_frame_number,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; 196 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false;
190 } 197 }
191 198
192 bool HasScheduledTileTasksForTesting() const { 199 bool HasScheduledTileTasksForTesting() const {
193 return has_scheduled_tile_tasks_; 200 return has_scheduled_tile_tasks_;
194 } 201 }
195 202
196 protected: 203 protected:
197 TileManager(TileManagerClient* client, 204 TileManager(TileManagerClient* client,
198 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 205 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
199 ResourcePool* resource_pool,
200 TileTaskRunner* tile_task_runner,
201 size_t scheduled_raster_task_limit); 206 size_t scheduled_raster_task_limit);
202 207
203 void FreeResourcesForReleasedTiles(); 208 void FreeResourcesForReleasedTiles();
204 void CleanUpReleasedTiles(); 209 void CleanUpReleasedTiles();
205 210
206 friend class Tile; 211 friend class Tile;
207 // Virtual for testing. 212 // Virtual for testing.
208 virtual void Release(Tile* tile); 213 virtual void Release(Tile* tile);
209 214
210 // Overriden from TileTaskRunnerClient: 215 // Overriden from TileTaskRunnerClient:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 bool has_scheduled_tile_tasks_; 336 bool has_scheduled_tile_tasks_;
332 337
333 uint64_t prepare_tiles_count_; 338 uint64_t prepare_tiles_count_;
334 339
335 DISALLOW_COPY_AND_ASSIGN(TileManager); 340 DISALLOW_COPY_AND_ASSIGN(TileManager);
336 }; 341 };
337 342
338 } // namespace cc 343 } // namespace cc
339 344
340 #endif // CC_TILES_TILE_MANAGER_H_ 345 #endif // CC_TILES_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/test/fake_tile_manager.cc ('k') | cc/tiles/tile_manager.cc » ('j') | cc/tiles/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698