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

Unified Diff: cc/tiles/tile_manager.h

Issue 1470113002: Move TaskGraph creation to TileManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pinchfix
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/tiles/tile_manager.h
diff --git a/cc/tiles/tile_manager.h b/cc/tiles/tile_manager.h
index abffc7cb5998794580de7a4956646a0ea6e40ff3..e9ca50867a3e03a03ed12ffe80cf39410885ed9b 100644
--- a/cc/tiles/tile_manager.h
+++ b/cc/tiles/tile_manager.h
@@ -86,11 +86,19 @@ struct RasterTaskCompletionStats {
scoped_refptr<base::trace_event::ConvertableToTraceFormat>
RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats);
+// kNumberOfTaskSets must be greater or equal to the number of values in
+// TileManager::NamedTaskSet.
+// TODO(reveman): Use template specialization to make it easy for client code to
+// check at compile time that the number of supported task sets is correct.
+static const size_t kNumberOfTaskSets = 3;
+using TaskSet = size_t;
+using TaskSetCollection = std::bitset<kNumberOfTaskSets>;
reveman 2015/11/26 00:18:30 Can we get rid of all this and just build the corr
ericrk 2015/11/30 23:52:16 this is more used for tracking which task sets are
reveman 2015/12/02 05:22:54 I'm thinking that we just get rid of all this task
+
// This class manages tiles, deciding which should get rasterized and which
// should no longer have any memory assigned to them. Tile objects are "owned"
// by layers; they automatically register with the manager when they are
// created, and unregister from the manager when they are deleted.
-class CC_EXPORT TileManager : public TileTaskRunnerClient {
+class CC_EXPORT TileManager {
public:
enum NamedTaskSet {
REQUIRED_FOR_ACTIVATION,
@@ -109,7 +117,7 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
base::SequencedTaskRunner* task_runner,
size_t scheduled_raster_task_limit,
bool use_partial_raster);
- ~TileManager() override;
+ virtual ~TileManager();
// Assigns tile memory and schedules work to prepare tiles for drawing.
// - Runs client_->NotifyReadyToActivate() when all tiles required for
@@ -217,9 +225,6 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
virtual void Release(Tile* tile);
Tile::Id GetUniqueTileId() { return ++next_tile_id_; }
- // Overriden from TileTaskRunnerClient:
- void DidFinishRunningTileTasks(TaskSet task_set) override;
-
typedef std::vector<PrioritizedTile> PrioritizedTileVector;
typedef std::set<Tile*> TileSet;
@@ -288,6 +293,16 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
ResourceFormat DetermineResourceFormat(const Tile* tile) const;
bool DetermineResourceRequiresSwizzle(const Tile* tile) const;
+ void DidFinishRunningTileTasks(TaskSet task_set);
+
+ void BuildTaskGraph(
+ const PrioritizedTileVector& tiles_that_need_to_be_rasterized,
+ TaskGraph* graph,
+ scoped_refptr<TileTask>(&new_task_set_finished_tasks)[kNumberOfTaskSets]);
+
+ scoped_refptr<base::trace_event::ConvertableToTraceFormat>
+ ScheduledTasksStateAsValue() const;
+
TileManagerClient* client_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
ResourcePool* resource_pool_;
@@ -311,10 +326,8 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
std::vector<Tile*> released_tiles_;
- // Queue used when scheduling raster tasks.
- TileTaskQueue raster_queue_;
-
- std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_;
+ std::vector<scoped_refptr<TileTask>> orphan_tasks_;
+ TaskSetCollection tasks_pending_;
UniqueNotifier more_tiles_need_prepare_check_notifier_;
@@ -338,6 +351,8 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
uint64_t prepare_tiles_count_;
uint64_t next_tile_id_;
+ base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(TileManager);
};

Powered by Google App Engine
This is Rietveld 408576698