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

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

Issue 1132443003: cc: Move raster_source from Tile to PrioritizedTile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename var Created 5 years, 7 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/resources/tile.cc ('k') | cc/trees/layer_tree_host_impl.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 #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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 Tile* tile = prioritized_tile.tile(); 653 Tile* tile = prioritized_tile.tile();
654 scoped_ptr<ScopedResource> resource = 654 scoped_ptr<ScopedResource> resource =
655 resource_pool_->AcquireResource(tile->desired_texture_size(), 655 resource_pool_->AcquireResource(tile->desired_texture_size(),
656 tile_task_runner_->GetResourceFormat()); 656 tile_task_runner_->GetResourceFormat());
657 const ScopedResource* const_resource = resource.get(); 657 const ScopedResource* const_resource = resource.get();
658 658
659 // Create and queue all image decode tasks that this tile depends on. 659 // Create and queue all image decode tasks that this tile depends on.
660 ImageDecodeTask::Vector decode_tasks; 660 ImageDecodeTask::Vector decode_tasks;
661 PixelRefTaskMap& existing_pixel_refs = image_decode_tasks_[tile->layer_id()]; 661 PixelRefTaskMap& existing_pixel_refs = image_decode_tasks_[tile->layer_id()];
662 std::vector<SkPixelRef*> pixel_refs; 662 std::vector<SkPixelRef*> pixel_refs;
663 tile->raster_source()->GatherPixelRefs( 663 prioritized_tile.raster_source()->GatherPixelRefs(
664 tile->content_rect(), tile->contents_scale(), &pixel_refs); 664 tile->content_rect(), tile->contents_scale(), &pixel_refs);
665 for (SkPixelRef* pixel_ref : pixel_refs) { 665 for (SkPixelRef* pixel_ref : pixel_refs) {
666 uint32_t id = pixel_ref->getGenerationID(); 666 uint32_t id = pixel_ref->getGenerationID();
667 667
668 // Append existing image decode task if available. 668 // Append existing image decode task if available.
669 PixelRefTaskMap::iterator decode_task_it = existing_pixel_refs.find(id); 669 PixelRefTaskMap::iterator decode_task_it = existing_pixel_refs.find(id);
670 if (decode_task_it != existing_pixel_refs.end()) { 670 if (decode_task_it != existing_pixel_refs.end()) {
671 decode_tasks.push_back(decode_task_it->second); 671 decode_tasks.push_back(decode_task_it->second);
672 continue; 672 continue;
673 } 673 }
674 674
675 // Create and append new image decode task for this pixel ref. 675 // Create and append new image decode task for this pixel ref.
676 scoped_refptr<ImageDecodeTask> decode_task = 676 scoped_refptr<ImageDecodeTask> decode_task =
677 CreateImageDecodeTask(tile, pixel_ref); 677 CreateImageDecodeTask(tile, pixel_ref);
678 decode_tasks.push_back(decode_task); 678 decode_tasks.push_back(decode_task);
679 existing_pixel_refs[id] = decode_task; 679 existing_pixel_refs[id] = decode_task;
680 } 680 }
681 681
682 return make_scoped_refptr(new RasterTaskImpl( 682 return make_scoped_refptr(new RasterTaskImpl(
683 const_resource, tile->raster_source(), tile->content_rect(), 683 const_resource, prioritized_tile.raster_source(), tile->content_rect(),
684 tile->contents_scale(), prioritized_tile.priority().resolution, 684 tile->contents_scale(), prioritized_tile.priority().resolution,
685 tile->layer_id(), static_cast<const void*>(tile), 685 tile->layer_id(), static_cast<const void*>(tile),
686 tile->source_frame_number(), tile->use_picture_analysis(), 686 tile->source_frame_number(), tile->use_picture_analysis(),
687 base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this), 687 base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this),
688 tile->id(), base::Passed(&resource)), 688 tile->id(), base::Passed(&resource)),
689 &decode_tasks)); 689 &decode_tasks));
690 } 690 }
691 691
692 void TileManager::OnImageDecodeTaskCompleted(int layer_id, 692 void TileManager::OnImageDecodeTaskCompleted(int layer_id,
693 SkPixelRef* pixel_ref, 693 SkPixelRef* pixel_ref,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 result -= other; 966 result -= other;
967 return result; 967 return result;
968 } 968 }
969 969
970 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 970 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
971 return memory_bytes_ > limit.memory_bytes_ || 971 return memory_bytes_ > limit.memory_bytes_ ||
972 resource_count_ > limit.resource_count_; 972 resource_count_ > limit.resource_count_;
973 } 973 }
974 974
975 } // namespace cc 975 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698