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

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: Code reviews Created 7 years, 3 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 return is_active ? EVENTUALLY_AND_ACTIVE_BIN : EVENTUALLY_BIN; 97 return is_active ? EVENTUALLY_AND_ACTIVE_BIN : EVENTUALLY_BIN;
98 } 98 }
99 99
100 // Limit to the number of raster tasks that can be scheduled. 100 // Limit to the number of raster tasks that can be scheduled.
101 // This is high enough to not cause unnecessary scheduling but 101 // This is high enough to not cause unnecessary scheduling but
102 // gives us an insurance that we're not spending a huge amount 102 // gives us an insurance that we're not spending a huge amount
103 // of time scheduling one enormous set of tasks. 103 // of time scheduling one enormous set of tasks.
104 const size_t kMaxRasterTasks = 256u; 104 const size_t kMaxRasterTasks = 256u;
105 105
106 // static
107 cc::ResourceProvider::Format GetTextureFormat(
108 cc::ResourceProvider* provider,
109 bool use_rgba_4444_tiles) {
110 return use_rgba_4444_tiles ? cc::ResourceProvider::RGBA_4444 :
111 provider->best_texture_format();
112 }
113
106 } // namespace 114 } // namespace
107 115
108 RasterTaskCompletionStats::RasterTaskCompletionStats() 116 RasterTaskCompletionStats::RasterTaskCompletionStats()
109 : completed_count(0u), 117 : completed_count(0u),
110 canceled_count(0u) { 118 canceled_count(0u) {
111 } 119 }
112 120
113 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue( 121 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue(
114 const RasterTaskCompletionStats& stats) { 122 const RasterTaskCompletionStats& stats) {
115 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 123 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
116 state->SetInteger("completed_count", stats.completed_count); 124 state->SetInteger("completed_count", stats.completed_count);
117 state->SetInteger("canceled_count", stats.canceled_count); 125 state->SetInteger("canceled_count", stats.canceled_count);
118 return state.PassAs<base::Value>(); 126 return state.PassAs<base::Value>();
119 } 127 }
120 128
121 // static 129 // static
122 scoped_ptr<TileManager> TileManager::Create( 130 scoped_ptr<TileManager> TileManager::Create(
123 TileManagerClient* client, 131 TileManagerClient* client,
124 ResourceProvider* resource_provider, 132 ResourceProvider* resource_provider,
125 size_t num_raster_threads, 133 size_t num_raster_threads,
126 RenderingStatsInstrumentation* rendering_stats_instrumentation, 134 RenderingStatsInstrumentation* rendering_stats_instrumentation,
127 bool use_map_image, 135 bool use_map_image,
128 size_t max_transfer_buffer_usage_bytes) { 136 size_t max_transfer_buffer_usage_bytes,
137 bool use_rgba_4444_tiles) {
129 return make_scoped_ptr( 138 return make_scoped_ptr(
130 new TileManager(client, 139 new TileManager(client,
131 resource_provider, 140 resource_provider,
132 use_map_image ? 141 use_map_image ?
133 ImageRasterWorkerPool::Create( 142 ImageRasterWorkerPool::Create(
134 resource_provider, num_raster_threads) : 143 resource_provider, num_raster_threads) :
135 PixelBufferRasterWorkerPool::Create( 144 PixelBufferRasterWorkerPool::Create(
136 resource_provider, 145 resource_provider,
137 num_raster_threads, 146 num_raster_threads,
138 max_transfer_buffer_usage_bytes), 147 max_transfer_buffer_usage_bytes,
148 GetTextureFormat(resource_provider,
149 use_rgba_4444_tiles)),
139 num_raster_threads, 150 num_raster_threads,
140 rendering_stats_instrumentation)); 151 rendering_stats_instrumentation));
141 } 152 }
142 153
143 TileManager::TileManager( 154 TileManager::TileManager(
144 TileManagerClient* client, 155 TileManagerClient* client,
145 ResourceProvider* resource_provider, 156 ResourceProvider* resource_provider,
146 scoped_ptr<RasterWorkerPool> raster_worker_pool, 157 scoped_ptr<RasterWorkerPool> raster_worker_pool,
147 size_t num_raster_threads, 158 size_t num_raster_threads,
148 RenderingStatsInstrumentation* rendering_stats_instrumentation) 159 RenderingStatsInstrumentation* rendering_stats_instrumentation)
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 bytes_releasable_ += tile->bytes_consumed_if_allocated(); 841 bytes_releasable_ += tile->bytes_consumed_if_allocated();
831 ++resources_releasable_; 842 ++resources_releasable_;
832 } 843 }
833 844
834 FreeUnusedResourcesForTile(tile); 845 FreeUnusedResourcesForTile(tile);
835 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) 846 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0)
836 did_initialize_visible_tile_ = true; 847 did_initialize_visible_tile_ = true;
837 } 848 }
838 849
839 } // namespace cc 850 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698