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

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

Issue 183663003: cc: Add tiling raster tile iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « cc/resources/tile_manager.h ('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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 &memory_allocated_bytes, 588 &memory_allocated_bytes,
589 &memory_used_bytes); 589 &memory_used_bytes);
590 requirements->SetInteger("memory_required_bytes", memory_required_bytes); 590 requirements->SetInteger("memory_required_bytes", memory_required_bytes);
591 requirements->SetInteger("memory_nice_to_have_bytes", 591 requirements->SetInteger("memory_nice_to_have_bytes",
592 memory_nice_to_have_bytes); 592 memory_nice_to_have_bytes);
593 requirements->SetInteger("memory_allocated_bytes", memory_allocated_bytes); 593 requirements->SetInteger("memory_allocated_bytes", memory_allocated_bytes);
594 requirements->SetInteger("memory_used_bytes", memory_used_bytes); 594 requirements->SetInteger("memory_used_bytes", memory_used_bytes);
595 return requirements.PassAs<base::Value>(); 595 return requirements.PassAs<base::Value>();
596 } 596 }
597 597
598 RasterMode TileManager::DetermineRasterMode(const Tile* tile) const {
599 DCHECK(tile);
600 DCHECK(tile->picture_pile());
601
602 const ManagedTileState& mts = tile->managed_state();
603 RasterMode current_mode = mts.raster_mode;
604
605 RasterMode raster_mode = HIGH_QUALITY_RASTER_MODE;
606 if (tile->managed_state().resolution == LOW_RESOLUTION)
607 raster_mode = LOW_QUALITY_RASTER_MODE;
608 else if (tile->can_use_lcd_text())
609 raster_mode = HIGH_QUALITY_RASTER_MODE;
610 else if (mts.tile_versions[current_mode].has_text_ ||
611 !mts.tile_versions[current_mode].IsReadyToDraw())
612 raster_mode = HIGH_QUALITY_NO_LCD_RASTER_MODE;
613
614 return std::min(raster_mode, current_mode);
615 }
616
617 void TileManager::AssignGpuMemoryToTiles( 598 void TileManager::AssignGpuMemoryToTiles(
618 PrioritizedTileSet* tiles, 599 PrioritizedTileSet* tiles,
619 TileVector* tiles_that_need_to_be_rasterized) { 600 TileVector* tiles_that_need_to_be_rasterized) {
620 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); 601 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles");
621 602
622 // Maintain the list of released resources that can potentially be re-used 603 // Maintain the list of released resources that can potentially be re-used
623 // or deleted. 604 // or deleted.
624 // If this operation becomes expensive too, only do this after some 605 // If this operation becomes expensive too, only do this after some
625 // resource(s) was returned. Note that in that case, one also need to 606 // resource(s) was returned. Note that in that case, one also need to
626 // invalidate when releasing some resource from the pool. 607 // invalidate when releasing some resource from the pool.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 size_t max_raster_bytes = max_raster_usage_bytes_ / 2; 647 size_t max_raster_bytes = max_raster_usage_bytes_ / 2;
667 size_t raster_bytes = 0; 648 size_t raster_bytes = 0;
668 649
669 unsigned schedule_priority = 1u; 650 unsigned schedule_priority = 1u;
670 for (PrioritizedTileSet::Iterator it(tiles, true); it; ++it) { 651 for (PrioritizedTileSet::Iterator it(tiles, true); it; ++it) {
671 Tile* tile = *it; 652 Tile* tile = *it;
672 ManagedTileState& mts = tile->managed_state(); 653 ManagedTileState& mts = tile->managed_state();
673 654
674 mts.scheduled_priority = schedule_priority++; 655 mts.scheduled_priority = schedule_priority++;
675 656
676 mts.raster_mode = DetermineRasterMode(tile); 657 mts.raster_mode = tile->DetermineOverallRasterMode();
677 658
678 ManagedTileState::TileVersion& tile_version = 659 ManagedTileState::TileVersion& tile_version =
679 mts.tile_versions[mts.raster_mode]; 660 mts.tile_versions[mts.raster_mode];
680 661
681 // If this tile doesn't need a resource, then nothing to do. 662 // If this tile doesn't need a resource, then nothing to do.
682 if (!tile_version.requires_resource()) 663 if (!tile_version.requires_resource())
683 continue; 664 continue;
684 665
685 // If the tile is not needed, free it up. 666 // If the tile is not needed, free it up.
686 if (mts.bin == NEVER_BIN) { 667 if (mts.bin == NEVER_BIN) {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 flags)); 1022 flags));
1042 DCHECK(tiles_.find(tile->id()) == tiles_.end()); 1023 DCHECK(tiles_.find(tile->id()) == tiles_.end());
1043 1024
1044 tiles_[tile->id()] = tile; 1025 tiles_[tile->id()] = tile;
1045 used_layer_counts_[tile->layer_id()]++; 1026 used_layer_counts_[tile->layer_id()]++;
1046 prioritized_tiles_dirty_ = true; 1027 prioritized_tiles_dirty_ = true;
1047 return tile; 1028 return tile;
1048 } 1029 }
1049 1030
1050 } // namespace cc 1031 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698