summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/direct_raster_worker_pool.cc8
-rw-r--r--cc/resources/direct_raster_worker_pool.h2
-rw-r--r--cc/resources/image_raster_worker_pool.cc17
-rw-r--r--cc/resources/image_raster_worker_pool.h9
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.cc8
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.h2
-rw-r--r--cc/resources/prioritized_tile_set_unittest.cc5
-rw-r--r--cc/resources/raster_worker_pool_perftest.cc3
-rw-r--r--cc/resources/raster_worker_pool_unittest.cc3
-rw-r--r--cc/resources/rasterizer.h6
-rw-r--r--cc/resources/resource_pool.h2
-rw-r--r--cc/resources/tile_manager.cc19
-rw-r--r--cc/resources/tile_manager.h11
-rw-r--r--cc/resources/tile_manager_perftest.cc9
-rw-r--r--cc/resources/tile_manager_unittest.cc5
15 files changed, 32 insertions, 77 deletions
diff --git a/cc/resources/direct_raster_worker_pool.cc b/cc/resources/direct_raster_worker_pool.cc
index d3374a9..0be89c1 100644
--- a/cc/resources/direct_raster_worker_pool.cc
+++ b/cc/resources/direct_raster_worker_pool.cc
@@ -102,14 +102,6 @@ void DirectRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
new_raster_required_for_activation_finished_task;
}
-unsigned DirectRasterWorkerPool::GetResourceTarget() const {
- return GL_TEXTURE_2D;
-}
-
-ResourceFormat DirectRasterWorkerPool::GetResourceFormat() const {
- return resource_provider_->best_texture_format();
-}
-
void DirectRasterWorkerPool::CheckForCompletedTasks() {
TRACE_EVENT0("cc", "DirectRasterWorkerPool::CheckForCompletedTasks");
diff --git a/cc/resources/direct_raster_worker_pool.h b/cc/resources/direct_raster_worker_pool.h
index e4022f6..15313a6 100644
--- a/cc/resources/direct_raster_worker_pool.h
+++ b/cc/resources/direct_raster_worker_pool.h
@@ -31,8 +31,6 @@ class CC_EXPORT DirectRasterWorkerPool : public RasterWorkerPool,
virtual void SetClient(RasterizerClient* client) OVERRIDE;
virtual void Shutdown() OVERRIDE {}
virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE;
- virtual unsigned GetResourceTarget() const OVERRIDE;
- virtual ResourceFormat GetResourceFormat() const OVERRIDE;
virtual void CheckForCompletedTasks() OVERRIDE;
// Overridden from internal::RasterizerTaskClient:
diff --git a/cc/resources/image_raster_worker_pool.cc b/cc/resources/image_raster_worker_pool.cc
index 0fd4679..c1434cd 100644
--- a/cc/resources/image_raster_worker_pool.cc
+++ b/cc/resources/image_raster_worker_pool.cc
@@ -14,22 +14,19 @@ namespace cc {
scoped_ptr<RasterWorkerPool> ImageRasterWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
internal::TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider,
- unsigned texture_target) {
+ ResourceProvider* resource_provider) {
return make_scoped_ptr<RasterWorkerPool>(new ImageRasterWorkerPool(
- task_runner, task_graph_runner, resource_provider, texture_target));
+ task_runner, task_graph_runner, resource_provider));
}
ImageRasterWorkerPool::ImageRasterWorkerPool(
base::SequencedTaskRunner* task_runner,
internal::TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider,
- unsigned texture_target)
+ ResourceProvider* resource_provider)
: task_runner_(task_runner),
task_graph_runner_(task_graph_runner),
namespace_token_(task_graph_runner->GetNamespaceToken()),
resource_provider_(resource_provider),
- texture_target_(texture_target),
raster_tasks_pending_(false),
raster_tasks_required_for_activation_pending_(false),
raster_finished_weak_ptr_factory_(this) {}
@@ -129,14 +126,6 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
TracedValue::FromValue(StateAsValue().release()));
}
-unsigned ImageRasterWorkerPool::GetResourceTarget() const {
- return texture_target_;
-}
-
-ResourceFormat ImageRasterWorkerPool::GetResourceFormat() const {
- return resource_provider_->best_texture_format();
-}
-
void ImageRasterWorkerPool::CheckForCompletedTasks() {
TRACE_EVENT0("cc", "ImageRasterWorkerPool::CheckForCompletedTasks");
diff --git a/cc/resources/image_raster_worker_pool.h b/cc/resources/image_raster_worker_pool.h
index 91d9373..82da770 100644
--- a/cc/resources/image_raster_worker_pool.h
+++ b/cc/resources/image_raster_worker_pool.h
@@ -22,8 +22,7 @@ class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool,
static scoped_ptr<RasterWorkerPool> Create(
base::SequencedTaskRunner* task_runner,
internal::TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider,
- unsigned texture_target);
+ ResourceProvider* resource_provider);
// Overridden from RasterWorkerPool:
virtual Rasterizer* AsRasterizer() OVERRIDE;
@@ -32,8 +31,6 @@ class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool,
virtual void SetClient(RasterizerClient* client) OVERRIDE;
virtual void Shutdown() OVERRIDE;
virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE;
- virtual unsigned GetResourceTarget() const OVERRIDE;
- virtual ResourceFormat GetResourceFormat() const OVERRIDE;
virtual void CheckForCompletedTasks() OVERRIDE;
// Overridden from internal::RasterizerTaskClient:
@@ -43,8 +40,7 @@ class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool,
protected:
ImageRasterWorkerPool(base::SequencedTaskRunner* task_runner,
internal::TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider,
- unsigned texture_target);
+ ResourceProvider* resource_provider);
private:
void OnRasterFinished();
@@ -56,7 +52,6 @@ class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool,
const internal::NamespaceToken namespace_token_;
RasterizerClient* client_;
ResourceProvider* resource_provider_;
- const unsigned texture_target_;
bool raster_tasks_pending_;
bool raster_tasks_required_for_activation_pending_;
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index 16a4354..d51fac6 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -222,14 +222,6 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
TracedValue::FromValue(StateAsValue().release()));
}
-unsigned PixelBufferRasterWorkerPool::GetResourceTarget() const {
- return GL_TEXTURE_2D;
-}
-
-ResourceFormat PixelBufferRasterWorkerPool::GetResourceFormat() const {
- return resource_provider_->memory_efficient_texture_format();
-}
-
void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks");
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.h b/cc/resources/pixel_buffer_raster_worker_pool.h
index 58f2442..f7abab1 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.h
+++ b/cc/resources/pixel_buffer_raster_worker_pool.h
@@ -36,8 +36,6 @@ class CC_EXPORT PixelBufferRasterWorkerPool
virtual void SetClient(RasterizerClient* client) OVERRIDE;
virtual void Shutdown() OVERRIDE;
virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE;
- virtual unsigned GetResourceTarget() const OVERRIDE;
- virtual ResourceFormat GetResourceFormat() const OVERRIDE;
virtual void CheckForCompletedTasks() OVERRIDE;
// Overridden from internal::RasterizerTaskClient:
diff --git a/cc/resources/prioritized_tile_set_unittest.cc b/cc/resources/prioritized_tile_set_unittest.cc
index 58e8102..ebe144e 100644
--- a/cc/resources/prioritized_tile_set_unittest.cc
+++ b/cc/resources/prioritized_tile_set_unittest.cc
@@ -59,8 +59,10 @@ class PrioritizedTileSetTest : public testing::Test {
ResourceProvider::Create(
output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1)
.Pass();
+ resource_pool_ = ResourcePool::Create(
+ resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
tile_manager_.reset(
- new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
+ new FakeTileManager(&tile_manager_client_, resource_pool_.get()));
picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
}
@@ -81,6 +83,7 @@ class PrioritizedTileSetTest : public testing::Test {
scoped_ptr<FakeOutputSurface> output_surface_;
scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
+ scoped_ptr<ResourcePool> resource_pool_;
FakeTileManagerClient tile_manager_client_;
scoped_ptr<FakeTileManager> tile_manager_;
scoped_refptr<FakePicturePileImpl> picture_pile_;
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc
index 749985a..fda6bbc 100644
--- a/cc/resources/raster_worker_pool_perftest.cc
+++ b/cc/resources/raster_worker_pool_perftest.cc
@@ -226,8 +226,7 @@ class RasterWorkerPoolPerfTest
raster_worker_pool_ = ImageRasterWorkerPool::Create(
base::MessageLoopProxy::current().get(),
task_graph_runner_.get(),
- resource_provider_.get(),
- GL_TEXTURE_2D);
+ resource_provider_.get());
break;
case RASTER_WORKER_POOL_TYPE_DIRECT:
raster_worker_pool_ = DirectRasterWorkerPool::Create(
diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc
index 52b3a26..4385e26 100644
--- a/cc/resources/raster_worker_pool_unittest.cc
+++ b/cc/resources/raster_worker_pool_unittest.cc
@@ -145,8 +145,7 @@ class RasterWorkerPoolTest
raster_worker_pool_ = ImageRasterWorkerPool::Create(
base::MessageLoopProxy::current().get(),
RasterWorkerPool::GetTaskGraphRunner(),
- resource_provider_.get(),
- GL_TEXTURE_2D);
+ resource_provider_.get());
break;
case RASTER_WORKER_POOL_TYPE_DIRECT:
raster_worker_pool_ = DirectRasterWorkerPool::Create(
diff --git a/cc/resources/rasterizer.h b/cc/resources/rasterizer.h
index d53e400..432256d 100644
--- a/cc/resources/rasterizer.h
+++ b/cc/resources/rasterizer.h
@@ -162,12 +162,6 @@ class CC_EXPORT Rasterizer {
// Check for completed tasks and dispatch reply callbacks.
virtual void CheckForCompletedTasks() = 0;
- // Returns the target that needs to be used for raster task resources.
- virtual unsigned GetResourceTarget() const = 0;
-
- // Returns the format that needs to be used for raster task resources.
- virtual ResourceFormat GetResourceFormat() const = 0;
-
protected:
virtual ~Rasterizer() {}
};
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index e321d08..8123152 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -44,6 +44,8 @@ class CC_EXPORT ResourcePool {
return resource_count_ - unused_resources_.size();
}
+ ResourceFormat resource_format() const { return format_; }
+
protected:
ResourcePool(ResourceProvider* resource_provider,
GLenum target,
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 16b8a3d..4de7ba2 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -397,14 +397,14 @@ scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue(
// static
scoped_ptr<TileManager> TileManager::Create(
TileManagerClient* client,
- ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
size_t max_raster_usage_bytes,
bool use_rasterize_on_demand,
RenderingStatsInstrumentation* rendering_stats_instrumentation) {
return make_scoped_ptr(new TileManager(client,
- resource_provider,
+ resource_pool,
rasterizer,
gpu_rasterizer,
max_raster_usage_bytes,
@@ -414,16 +414,14 @@ scoped_ptr<TileManager> TileManager::Create(
TileManager::TileManager(
TileManagerClient* client,
- ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
size_t max_raster_usage_bytes,
bool use_rasterize_on_demand,
RenderingStatsInstrumentation* rendering_stats_instrumentation)
: client_(client),
- resource_pool_(ResourcePool::Create(resource_provider,
- rasterizer->GetResourceTarget(),
- rasterizer->GetResourceFormat())),
+ resource_pool_(resource_pool),
prioritized_tiles_dirty_(false),
all_tiles_that_need_to_be_rasterized_have_memory_(true),
all_tiles_required_for_activation_have_memory_(true),
@@ -436,8 +434,7 @@ TileManager::TileManager(
rendering_stats_instrumentation_(rendering_stats_instrumentation),
did_initialize_visible_tile_(false),
did_check_for_completed_tasks_since_last_schedule_tasks_(true),
- use_rasterize_on_demand_(use_rasterize_on_demand),
- resource_format_(rasterizer->GetResourceFormat()) {
+ use_rasterize_on_demand_(use_rasterize_on_demand) {
Rasterizer* rasterizers[NUM_RASTERIZER_TYPES] = {
rasterizer, // RASTERIZER_TYPE_DEFAULT
gpu_rasterizer, // RASTERIZER_TYPE_GPU
@@ -723,12 +720,6 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
if (state != global_state_) {
global_state_ = state;
prioritized_tiles_dirty_ = true;
- // Soft limit is used for resource pool such that
- // memory returns to soft limit after going over.
- resource_pool_->SetResourceUsageLimits(
- global_state_.soft_memory_limit_in_bytes,
- global_state_.unused_memory_limit_in_bytes,
- global_state_.num_resources_limit);
}
// We need to call CheckForCompletedTasks() once in-between each call
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index 60e6374..f0fc0be 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -150,7 +150,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
static scoped_ptr<TileManager> Create(
TileManagerClient* client,
- ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
size_t max_raster_usage_bytes,
@@ -188,8 +188,6 @@ class CC_EXPORT TileManager : public RasterizerClient,
void GetPairedPictureLayers(std::vector<PairedPictureLayer>* layers) const;
- ResourcePool* resource_pool() { return resource_pool_.get(); }
-
void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) {
for (size_t i = 0; i < tiles.size(); ++i) {
ManagedTileState& mts = tiles[i]->managed_state();
@@ -228,7 +226,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
protected:
TileManager(TileManagerClient* client,
- ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
size_t max_raster_usage_bytes,
@@ -277,7 +275,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
bool was_canceled);
inline size_t BytesConsumedIfAllocated(const Tile* tile) const {
- return Resource::MemorySizeBytes(tile->size(), resource_format_);
+ return Resource::MemorySizeBytes(tile->size(),
+ resource_pool_->resource_format());
}
void FreeResourceForTile(Tile* tile, RasterMode mode);
@@ -291,7 +290,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
void UpdatePrioritizedTileSetIfNeeded();
TileManagerClient* client_;
- scoped_ptr<ResourcePool> resource_pool_;
+ ResourcePool* resource_pool_;
scoped_ptr<RasterizerDelegate> rasterizer_delegate_;
GlobalStateThatImpactsTilePriority global_state_;
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index b4bc4f5..9a1642a 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -48,11 +48,11 @@ class TileManagerPerfTest : public testing::Test {
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
resource_provider_ = ResourceProvider::Create(
output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
+ resource_pool_ = ResourcePool::Create(
+ resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
size_t raster_task_limit_bytes = 32 * 1024 * 1024; // 16-64MB in practice.
- tile_manager_ =
- make_scoped_ptr(new FakeTileManager(&tile_manager_client_,
- resource_provider_.get(),
- raster_task_limit_bytes));
+ tile_manager_ = make_scoped_ptr(new FakeTileManager(
+ &tile_manager_client_, resource_pool_.get(), raster_task_limit_bytes));
picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
}
@@ -179,6 +179,7 @@ class TileManagerPerfTest : public testing::Test {
scoped_ptr<FakeOutputSurface> output_surface_;
scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
+ scoped_ptr<ResourcePool> resource_pool_;
LapTimer timer_;
};
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index 1fac2b4..fac13d6 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -40,8 +40,10 @@ class TileManagerTest : public testing::TestWithParam<bool>,
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
resource_provider_ = ResourceProvider::Create(
output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
+ resource_pool_ = ResourcePool::Create(
+ resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
tile_manager_ = make_scoped_ptr(new FakeTileManager(
- this, resource_provider_.get(), allow_on_demand_raster));
+ this, resource_pool_.get(), allow_on_demand_raster));
memory_limit_policy_ = memory_limit_policy;
max_tiles_ = max_tiles;
@@ -149,6 +151,7 @@ class TileManagerTest : public testing::TestWithParam<bool>,
scoped_ptr<FakeOutputSurface> output_surface_;
scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
scoped_ptr<ResourceProvider> resource_provider_;
+ scoped_ptr<ResourcePool> resource_pool_;
TileMemoryLimitPolicy memory_limit_policy_;
int max_tiles_;
bool ready_to_activate_;