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

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

Issue 2924233002: cc: Move pre-decodes to background worker. (Closed)
Patch Set: flake is flaky. T_T Created 3 years, 6 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
« no previous file with comments | « cc/tiles/checker_image_tracker_unittest.cc ('k') | cc/tiles/tile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 size_t completed_count; 97 size_t completed_count;
98 size_t canceled_count; 98 size_t canceled_count;
99 }; 99 };
100 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 100 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
101 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); 101 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats);
102 102
103 // This class manages tiles, deciding which should get rasterized and which 103 // This class manages tiles, deciding which should get rasterized and which
104 // should no longer have any memory assigned to them. Tile objects are "owned" 104 // should no longer have any memory assigned to them. Tile objects are "owned"
105 // by layers; they automatically register with the manager when they are 105 // by layers; they automatically register with the manager when they are
106 // created, and unregister from the manager when they are deleted. 106 // created, and unregister from the manager when they are deleted.
107 //
108 // The TileManager coordinates scheduling of prioritized raster and decode work
109 // across 2 different subsystems, namely the TaskGraphRunner used primarily for
110 // raster work and images which must be decoded before rasterization of a tile
111 // can proceed, and the CheckerImageTracker used for images decoded
112 // asynchronously from raster using the |image_worker_task_runner|. The order in
113 // which work is scheduled across these systems is as follows:
114 //
115 // 1) RequiredForActivation/Draw Tiles: These are the highest priority tiles
116 // which block scheduling of any decode work for checkered-images.
117 //
118 // 2) Pre-paint Tiles: These are offscreen tiles which fall within the
119 // pre-raster distance. The work for these tiles continues in parallel with the
120 // decode work for checkered images from visible/pre-paint tiles.
121 //
122 // 3) Pre-decode Tiles: These are offscreen tiles which are outside the
123 // pre-raster distance but have their images pre-decoded and locked. Finishing
124 // work for these tiles on the TaskGraph blocks starting decode work for
125 // checker-imaged pre-decode tiles.
126
107 class CC_EXPORT TileManager : CheckerImageTrackerClient { 127 class CC_EXPORT TileManager : CheckerImageTrackerClient {
108 public: 128 public:
109 TileManager(TileManagerClient* client, 129 TileManager(TileManagerClient* client,
110 base::SequencedTaskRunner* origin_task_runner, 130 base::SequencedTaskRunner* origin_task_runner,
111 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner, 131 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner,
112 size_t scheduled_raster_task_limit, 132 size_t scheduled_raster_task_limit,
113 const TileManagerSettings& tile_manager_settings); 133 const TileManagerSettings& tile_manager_settings);
114 ~TileManager() override; 134 ~TileManager() override;
115 135
116 // Assigns tile memory and schedules work to prepare tiles for drawing. 136 // Assigns tile memory and schedules work to prepare tiles for drawing.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 ResourceFormat DetermineResourceFormat(const Tile* tile) const; 345 ResourceFormat DetermineResourceFormat(const Tile* tile) const;
326 bool DetermineResourceRequiresSwizzle(const Tile* tile) const; 346 bool DetermineResourceRequiresSwizzle(const Tile* tile) const;
327 347
328 void DidFinishRunningTileTasksRequiredForActivation(); 348 void DidFinishRunningTileTasksRequiredForActivation();
329 void DidFinishRunningTileTasksRequiredForDraw(); 349 void DidFinishRunningTileTasksRequiredForDraw();
330 void DidFinishRunningAllTileTasks(); 350 void DidFinishRunningAllTileTasks();
331 351
332 scoped_refptr<TileTask> CreateTaskSetFinishedTask( 352 scoped_refptr<TileTask> CreateTaskSetFinishedTask(
333 void (TileManager::*callback)()); 353 void (TileManager::*callback)());
334 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); 354 PrioritizedWorkToSchedule AssignGpuMemoryToTiles();
335 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); 355 void ScheduleTasks(PrioritizedWorkToSchedule work_to_schedule);
336 356
337 void PartitionImagesForCheckering(const PrioritizedTile& prioritized_tile, 357 void PartitionImagesForCheckering(const PrioritizedTile& prioritized_tile,
338 const gfx::ColorSpace& raster_color_space, 358 const gfx::ColorSpace& raster_color_space,
339 std::vector<DrawImage>* sync_decoded_images, 359 std::vector<DrawImage>* sync_decoded_images,
340 std::vector<PaintImage>* checkered_images); 360 std::vector<PaintImage>* checkered_images);
341 void AddCheckeredImagesToDecodeQueue( 361 void AddCheckeredImagesToDecodeQueue(
342 const PrioritizedTile& prioritized_tile, 362 const PrioritizedTile& prioritized_tile,
343 const gfx::ColorSpace& raster_color_space, 363 const gfx::ColorSpace& raster_color_space,
364 CheckerImageTracker::DecodeType decode_type,
344 CheckerImageTracker::ImageDecodeQueue* image_decode_queue); 365 CheckerImageTracker::ImageDecodeQueue* image_decode_queue);
345 366
346 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 367 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
347 ScheduledTasksStateAsValue() const; 368 ScheduledTasksStateAsValue() const;
348 369
349 bool UsePartialRaster() const; 370 bool UsePartialRaster() const;
350 371
351 void CheckPendingGpuWorkTiles(bool issue_signals); 372 void CheckPendingGpuWorkTiles(bool issue_signals);
352 373
353 TileManagerClient* client_; 374 TileManagerClient* client_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; 429 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_;
409 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated. 430 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated.
410 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_; 431 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_;
411 432
412 DISALLOW_COPY_AND_ASSIGN(TileManager); 433 DISALLOW_COPY_AND_ASSIGN(TileManager);
413 }; 434 };
414 435
415 } // namespace cc 436 } // namespace cc
416 437
417 #endif // CC_TILES_TILE_MANAGER_H_ 438 #endif // CC_TILES_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/tiles/checker_image_tracker_unittest.cc ('k') | cc/tiles/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698