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

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

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to 4_4_4_4 textures in RP Created 7 years, 4 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
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 GLenum texture_format) 143 GLenum texture_format)
144 : client_(client), 144 : client_(client),
145 resource_pool_(ResourcePool::Create(resource_provider)), 145 resource_pool_(ResourcePool::Create(resource_provider)),
146 raster_worker_pool_(raster_worker_pool.Pass()), 146 raster_worker_pool_(raster_worker_pool.Pass()),
147 all_tiles_that_need_to_be_rasterized_have_memory_(true), 147 all_tiles_that_need_to_be_rasterized_have_memory_(true),
148 all_tiles_required_for_activation_have_memory_(true), 148 all_tiles_required_for_activation_have_memory_(true),
149 all_tiles_required_for_activation_have_been_initialized_(true), 149 all_tiles_required_for_activation_have_been_initialized_(true),
150 ever_exceeded_memory_budget_(false), 150 ever_exceeded_memory_budget_(false),
151 rendering_stats_instrumentation_(rendering_stats_instrumentation), 151 rendering_stats_instrumentation_(rendering_stats_instrumentation),
152 did_initialize_visible_tile_(false), 152 did_initialize_visible_tile_(false),
153 texture_format_(texture_format) { 153 texture_format_(texture_format),
154 use_16bit_tiles_(resource_provider->use_16bit_textures()) {
154 raster_worker_pool_->SetClient(this); 155 raster_worker_pool_->SetClient(this);
155 } 156 }
156 157
157 TileManager::~TileManager() { 158 TileManager::~TileManager() {
158 // Reset global state and manage. This should cause 159 // Reset global state and manage. This should cause
159 // our memory usage to drop to zero. 160 // our memory usage to drop to zero.
160 global_state_ = GlobalStateThatImpactsTilePriority(); 161 global_state_ = GlobalStateThatImpactsTilePriority();
161 162
162 // Clear |prioritized_tiles_| so that tiles kept alive by it can be freed. 163 // Clear |prioritized_tiles_| so that tiles kept alive by it can be freed.
163 prioritized_tiles_.Clear(); 164 prioritized_tiles_.Clear();
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 mts.resolution, 761 mts.resolution,
761 tile->layer_id(), 762 tile->layer_id(),
762 static_cast<const void *>(tile), 763 static_cast<const void *>(tile),
763 tile->source_frame_number(), 764 tile->source_frame_number(),
764 rendering_stats_instrumentation_, 765 rendering_stats_instrumentation_,
765 base::Bind(&TileManager::OnRasterTaskCompleted, 766 base::Bind(&TileManager::OnRasterTaskCompleted,
766 base::Unretained(this), 767 base::Unretained(this),
767 tile->id(), 768 tile->id(),
768 base::Passed(&resource), 769 base::Passed(&resource),
769 mts.raster_mode), 770 mts.raster_mode),
770 &decode_tasks); 771 &decode_tasks,
772 use_16bit_tiles_);
771 } 773 }
772 774
773 void TileManager::OnImageDecodeTaskCompleted( 775 void TileManager::OnImageDecodeTaskCompleted(
774 int layer_id, 776 int layer_id,
775 skia::LazyPixelRef* pixel_ref, 777 skia::LazyPixelRef* pixel_ref,
776 bool was_canceled) { 778 bool was_canceled) {
777 // If the task was canceled, we need to clean it up 779 // If the task was canceled, we need to clean it up
778 // from |image_decode_tasks_|. 780 // from |image_decode_tasks_|.
779 if (!was_canceled) 781 if (!was_canceled)
780 return; 782 return;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 tile_version.set_use_resource(); 831 tile_version.set_use_resource();
830 tile_version.resource_ = resource.Pass(); 832 tile_version.resource_ = resource.Pass();
831 } 833 }
832 834
833 FreeUnusedResourcesForTile(tile); 835 FreeUnusedResourcesForTile(tile);
834 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) 836 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0)
835 did_initialize_visible_tile_ = true; 837 did_initialize_visible_tile_ = true;
836 } 838 }
837 839
838 } // namespace cc 840 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698