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

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

Issue 2407443002: cc: Properly detect tiles that are needed now. (Closed)
Patch Set: qfix: update Created 4 years, 2 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/raster_tile_priority_queue_all.cc ('k') | no next file » | 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 #include "cc/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 Tile* tile = prioritized_tile.tile(); 666 Tile* tile = prioritized_tile.tile();
667 TilePriority priority = prioritized_tile.priority(); 667 TilePriority priority = prioritized_tile.priority();
668 668
669 if (TilePriorityViolatesMemoryPolicy(priority)) { 669 if (TilePriorityViolatesMemoryPolicy(priority)) {
670 TRACE_EVENT_INSTANT0( 670 TRACE_EVENT_INSTANT0(
671 "cc", "TileManager::AssignGpuMemory tile violates memory policy", 671 "cc", "TileManager::AssignGpuMemory tile violates memory policy",
672 TRACE_EVENT_SCOPE_THREAD); 672 TRACE_EVENT_SCOPE_THREAD);
673 break; 673 break;
674 } 674 }
675 675
676 bool tile_is_needed_now = priority.priority_bin == TilePriority::NOW; 676 bool tile_is_needed_now =
677 tile->required_for_activation() || tile->required_for_draw();
677 if (!tile->is_solid_color_analysis_performed() && 678 if (!tile->is_solid_color_analysis_performed() &&
678 tile->use_picture_analysis() && kUseColorEstimator) { 679 tile->use_picture_analysis() && kUseColorEstimator) {
679 // We analyze for solid color here, to decide to continue 680 // We analyze for solid color here, to decide to continue
680 // or drop the tile for scheduling and raster. 681 // or drop the tile for scheduling and raster.
681 // TODO(sohanjg): Check if we could use a shared analysis 682 // TODO(sohanjg): Check if we could use a shared analysis
682 // canvas which is reset between tiles. 683 // canvas which is reset between tiles.
683 tile->set_solid_color_analysis_performed(true); 684 tile->set_solid_color_analysis_performed(true);
684 SkColor color = SK_ColorTRANSPARENT; 685 SkColor color = SK_ColorTRANSPARENT;
685 bool is_solid_color = 686 bool is_solid_color =
686 prioritized_tile.raster_source()->PerformSolidColorAnalysis( 687 prioritized_tile.raster_source()->PerformSolidColorAnalysis(
687 tile->content_rect(), tile->contents_scale(), &color); 688 tile->content_rect(), tile->contents_scale(), &color);
688 if (is_solid_color) { 689 if (is_solid_color) {
689 tile->draw_info().set_solid_color(color); 690 tile->draw_info().set_solid_color(color);
690 tile->draw_info().set_was_ever_ready_to_draw(); 691 tile->draw_info().set_was_ever_ready_to_draw();
691 if (!tile_is_needed_now) 692 if (!tile_is_needed_now)
692 tile->draw_info().set_was_a_prepaint_tile(); 693 tile->draw_info().set_was_a_prepaint_tile();
693 client_->NotifyTileStateChanged(tile); 694 client_->NotifyTileStateChanged(tile);
694 continue; 695 continue;
695 } 696 }
696 } 697 }
697 698
698 // Prepaint tiles that are far away are only processed for images. 699 // Prepaint tiles that are far away are only processed for images.
699 if (!tile->required_for_activation() && !tile->required_for_draw() && 700 if (!tile_is_needed_now && prioritized_tile.is_process_for_images_only()) {
700 prioritized_tile.is_process_for_images_only()) {
701 work_to_schedule.tiles_to_process_for_images.push_back(prioritized_tile); 701 work_to_schedule.tiles_to_process_for_images.push_back(prioritized_tile);
702 continue; 702 continue;
703 } 703 }
704 704
705 // We won't be able to schedule this tile, so break out early. 705 // We won't be able to schedule this tile, so break out early.
706 if (work_to_schedule.tiles_to_raster.size() >= 706 if (work_to_schedule.tiles_to_raster.size() >=
707 scheduled_raster_task_limit_) { 707 scheduled_raster_task_limit_) {
708 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; 708 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false;
709 break; 709 break;
710 } 710 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 all_tile_tasks_completed = false; 1366 all_tile_tasks_completed = false;
1367 did_notify_all_tile_tasks_completed = false; 1367 did_notify_all_tile_tasks_completed = false;
1368 } 1368 }
1369 1369
1370 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1370 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1371 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1371 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1372 PrioritizedWorkToSchedule&& other) = default; 1372 PrioritizedWorkToSchedule&& other) = default;
1373 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1373 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1374 1374
1375 } // namespace cc 1375 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/raster_tile_priority_queue_all.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698