summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmiura <vmiura@chromium.org>2014-12-09 11:23:51 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-09 19:24:35 +0000
commita30e1eaf6130dab71bc4db5bfea72049203b1000 (patch)
tree32b7fb10ac19c2c0da48a99dd2f1b05def5db81c
parent9f036ca0d44739c0ecd2533de12238658b98d1c4 (diff)
downloadchromium_src-a30e1eaf6130dab71bc4db5bfea72049203b1000.zip
chromium_src-a30e1eaf6130dab71bc4db5bfea72049203b1000.tar.gz
chromium_src-a30e1eaf6130dab71bc4db5bfea72049203b1000.tar.bz2
cc: Renaming Rasterizer and RasterWorkerPool interfaces
We're planning to add a new Rasterizer interface to abstract some differences between GPU (Ganesh) and Software rasterization. The old Rasterizer and RasterWorkerPool interfaces will be renamed to TileTaskRunner and TileTaskWorkerPool, to clarify they are not the actual rasterizers. BUG=440188 Review URL: https://codereview.chromium.org/786583002 Cr-Commit-Position: refs/heads/master@{#307517}
-rw-r--r--cc/BUILD.gn32
-rw-r--r--cc/cc.gyp28
-rw-r--r--cc/cc_tests.gyp4
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc7
-rw-r--r--cc/resources/bitmap_raster_worker_pool.h79
-rw-r--r--cc/resources/bitmap_tile_task_worker_pool.cc (renamed from cc/resources/bitmap_raster_worker_pool.cc)109
-rw-r--r--cc/resources/bitmap_tile_task_worker_pool.h79
-rw-r--r--cc/resources/gpu_raster_worker_pool.h83
-rw-r--r--cc/resources/gpu_tile_task_worker_pool.cc (renamed from cc/resources/gpu_raster_worker_pool.cc)121
-rw-r--r--cc/resources/gpu_tile_task_worker_pool.h84
-rw-r--r--cc/resources/managed_tile_state.h2
-rw-r--r--cc/resources/one_copy_tile_task_worker_pool.cc (renamed from cc/resources/one_copy_raster_worker_pool.cc)161
-rw-r--r--cc/resources/one_copy_tile_task_worker_pool.h (renamed from cc/resources/one_copy_raster_worker_pool.h)58
-rw-r--r--cc/resources/picture_pile.cc4
-rw-r--r--cc/resources/pixel_buffer_tile_task_worker_pool.cc (renamed from cc/resources/pixel_buffer_raster_worker_pool.cc)229
-rw-r--r--cc/resources/pixel_buffer_tile_task_worker_pool.h (renamed from cc/resources/pixel_buffer_raster_worker_pool.h)60
-rw-r--r--cc/resources/rasterizer.cc80
-rw-r--r--cc/resources/tile_manager.cc66
-rw-r--r--cc/resources/tile_manager.h18
-rw-r--r--cc/resources/tile_manager_perftest.cc21
-rw-r--r--cc/resources/tile_task_runner.cc101
-rw-r--r--cc/resources/tile_task_runner.h (renamed from cc/resources/rasterizer.h)61
-rw-r--r--cc/resources/tile_task_worker_pool.cc (renamed from cc/resources/raster_worker_pool.cc)135
-rw-r--r--cc/resources/tile_task_worker_pool.h (renamed from cc/resources/raster_worker_pool.h)36
-rw-r--r--cc/resources/tile_task_worker_pool_perftest.cc (renamed from cc/resources/raster_worker_pool_perftest.cc)293
-rw-r--r--cc/resources/tile_task_worker_pool_unittest.cc (renamed from cc/resources/raster_worker_pool_unittest.cc)184
-rw-r--r--cc/resources/zero_copy_raster_worker_pool.h79
-rw-r--r--cc/resources/zero_copy_tile_task_worker_pool.cc (renamed from cc/resources/zero_copy_raster_worker_pool.cc)105
-rw-r--r--cc/resources/zero_copy_tile_task_worker_pool.h79
-rw-r--r--cc/test/fake_tile_manager.cc24
-rw-r--r--cc/test/layer_tree_pixel_resource_test.cc84
-rw-r--r--cc/test/layer_tree_pixel_resource_test.h20
-rw-r--r--cc/test/layer_tree_test.cc16
-rw-r--r--cc/test/layer_tree_test.h4
-rw-r--r--cc/test/pixel_test.cc2
-rw-r--r--cc/trees/layer_tree_host_impl.cc64
-rw-r--r--cc/trees/layer_tree_host_impl.h8
-rw-r--r--content/renderer/render_thread_impl.cc4
38 files changed, 1256 insertions, 1368 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index ba74be0..75c7409 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -327,8 +327,8 @@ component("cc") {
"quads/yuv_video_draw_quad.h",
"resources/bitmap_content_layer_updater.cc",
"resources/bitmap_content_layer_updater.h",
- "resources/bitmap_raster_worker_pool.cc",
- "resources/bitmap_raster_worker_pool.h",
+ "resources/bitmap_tile_task_worker_pool.cc",
+ "resources/bitmap_tile_task_worker_pool.h",
"resources/bitmap_skpicture_content_layer_updater.cc",
"resources/bitmap_skpicture_content_layer_updater.h",
"resources/clip_display_item.cc",
@@ -349,8 +349,8 @@ component("cc") {
"resources/eviction_tile_priority_queue.h",
"resources/filter_display_item.cc",
"resources/filter_display_item.h",
- "resources/gpu_raster_worker_pool.cc",
- "resources/gpu_raster_worker_pool.h",
+ "resources/gpu_tile_task_worker_pool.cc",
+ "resources/gpu_tile_task_worker_pool.h",
"resources/image_layer_updater.cc",
"resources/image_layer_updater.h",
"resources/layer_painter.h",
@@ -364,8 +364,8 @@ component("cc") {
"resources/managed_tile_state.h",
"resources/memory_history.cc",
"resources/memory_history.h",
- "resources/one_copy_raster_worker_pool.cc",
- "resources/one_copy_raster_worker_pool.h",
+ "resources/one_copy_tile_task_worker_pool.cc",
+ "resources/one_copy_tile_task_worker_pool.h",
"resources/picture.cc",
"resources/picture.h",
"resources/picture_layer_tiling.cc",
@@ -376,8 +376,8 @@ component("cc") {
"resources/picture_pile.h",
"resources/picture_pile_impl.cc",
"resources/picture_pile_impl.h",
- "resources/pixel_buffer_raster_worker_pool.cc",
- "resources/pixel_buffer_raster_worker_pool.h",
+ "resources/pixel_buffer_tile_task_worker_pool.cc",
+ "resources/pixel_buffer_tile_task_worker_pool.h",
"resources/platform_color.h",
"resources/prioritized_resource.cc",
"resources/prioritized_resource.h",
@@ -392,10 +392,10 @@ component("cc") {
"resources/raster_source_helper.h",
"resources/raster_tile_priority_queue.cc",
"resources/raster_tile_priority_queue.h",
- "resources/raster_worker_pool.cc",
- "resources/raster_worker_pool.h",
- "resources/rasterizer.cc",
- "resources/rasterizer.h",
+ "resources/tile_task_worker_pool.cc",
+ "resources/tile_task_worker_pool.h",
+ "resources/tile_task_runner.cc",
+ "resources/tile_task_runner.h",
"resources/release_callback.h",
"resources/resource.cc",
"resources/resource.h",
@@ -458,8 +458,8 @@ component("cc") {
"resources/ui_resource_request.h",
"resources/video_resource_updater.cc",
"resources/video_resource_updater.h",
- "resources/zero_copy_raster_worker_pool.cc",
- "resources/zero_copy_raster_worker_pool.h",
+ "resources/zero_copy_tile_task_worker_pool.cc",
+ "resources/zero_copy_tile_task_worker_pool.h",
"scheduler/begin_frame_source.cc",
"scheduler/begin_frame_source.h",
"scheduler/delay_based_time_source.cc",
@@ -769,7 +769,7 @@ test("cc_unittests") {
"resources/picture_pile_unittest.cc",
"resources/picture_unittest.cc",
"resources/prioritized_resource_unittest.cc",
- "resources/raster_worker_pool_unittest.cc",
+ "resources/tile_task_worker_pool_unittest.cc",
"resources/resource_provider_unittest.cc",
"resources/resource_update_controller_unittest.cc",
"resources/scoped_resource_unittest.cc",
@@ -852,7 +852,7 @@ test("cc_perftests") {
"layers/picture_layer_impl_perftest.cc",
"resources/picture_layer_tiling_perftest.cc",
"resources/picture_pile_impl_perftest.cc",
- "resources/raster_worker_pool_perftest.cc",
+ "resources/tile_task_worker_pool_perftest.cc",
"resources/task_graph_runner_perftest.cc",
"resources/tile_manager_perftest.cc",
"test/cc_test_suite.cc",
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 5967098..43e4b20 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -355,8 +355,8 @@
'quads/yuv_video_draw_quad.h',
'resources/bitmap_content_layer_updater.cc',
'resources/bitmap_content_layer_updater.h',
- 'resources/bitmap_raster_worker_pool.cc',
- 'resources/bitmap_raster_worker_pool.h',
+ 'resources/bitmap_tile_task_worker_pool.cc',
+ 'resources/bitmap_tile_task_worker_pool.h',
'resources/bitmap_skpicture_content_layer_updater.cc',
'resources/bitmap_skpicture_content_layer_updater.h',
'resources/clip_display_item.cc',
@@ -377,8 +377,8 @@
'resources/eviction_tile_priority_queue.h',
'resources/filter_display_item.cc',
'resources/filter_display_item.h',
- 'resources/gpu_raster_worker_pool.cc',
- 'resources/gpu_raster_worker_pool.h',
+ 'resources/gpu_tile_task_worker_pool.cc',
+ 'resources/gpu_tile_task_worker_pool.h',
'resources/image_layer_updater.cc',
'resources/image_layer_updater.h',
'resources/layer_painter.h',
@@ -392,8 +392,8 @@
'resources/managed_tile_state.h',
'resources/memory_history.cc',
'resources/memory_history.h',
- 'resources/one_copy_raster_worker_pool.cc',
- 'resources/one_copy_raster_worker_pool.h',
+ 'resources/one_copy_tile_task_worker_pool.cc',
+ 'resources/one_copy_tile_task_worker_pool.h',
'resources/picture.cc',
'resources/picture.h',
'resources/picture_layer_tiling.cc',
@@ -404,8 +404,8 @@
'resources/picture_pile.h',
'resources/picture_pile_impl.cc',
'resources/picture_pile_impl.h',
- 'resources/pixel_buffer_raster_worker_pool.cc',
- 'resources/pixel_buffer_raster_worker_pool.h',
+ 'resources/pixel_buffer_tile_task_worker_pool.cc',
+ 'resources/pixel_buffer_tile_task_worker_pool.h',
'resources/platform_color.h',
'resources/prioritized_resource.cc',
'resources/prioritized_resource.h',
@@ -420,10 +420,10 @@
'resources/raster_source_helper.h',
'resources/raster_tile_priority_queue.cc',
'resources/raster_tile_priority_queue.h',
- 'resources/raster_worker_pool.cc',
- 'resources/raster_worker_pool.h',
- 'resources/rasterizer.cc',
- 'resources/rasterizer.h',
+ 'resources/tile_task_worker_pool.cc',
+ 'resources/tile_task_worker_pool.h',
+ 'resources/tile_task_runner.cc',
+ 'resources/tile_task_runner.h',
'resources/recording_source.h',
'resources/release_callback.h',
'resources/resource.cc',
@@ -487,8 +487,8 @@
'resources/ui_resource_request.h',
'resources/video_resource_updater.cc',
'resources/video_resource_updater.h',
- 'resources/zero_copy_raster_worker_pool.cc',
- 'resources/zero_copy_raster_worker_pool.h',
+ 'resources/zero_copy_tile_task_worker_pool.cc',
+ 'resources/zero_copy_tile_task_worker_pool.h',
'scheduler/begin_frame_source.cc',
'scheduler/begin_frame_source.h',
'scheduler/delay_based_time_source.cc',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index d0b1000..c32fcba 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -82,7 +82,7 @@
'resources/picture_pile_unittest.cc',
'resources/picture_unittest.cc',
'resources/prioritized_resource_unittest.cc',
- 'resources/raster_worker_pool_unittest.cc',
+ 'resources/tile_task_worker_pool_unittest.cc',
'resources/resource_provider_unittest.cc',
'resources/resource_update_controller_unittest.cc',
'resources/scoped_resource_unittest.cc',
@@ -341,7 +341,7 @@
'layers/picture_layer_impl_perftest.cc',
'resources/picture_layer_tiling_perftest.cc',
'resources/picture_pile_impl_perftest.cc',
- 'resources/raster_worker_pool_perftest.cc',
+ 'resources/tile_task_worker_pool_perftest.cc',
'resources/task_graph_runner_perftest.cc',
'resources/tile_manager_perftest.cc',
'test/cc_test_suite.cc',
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index c1fc809..c00d0b9 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -12,7 +12,7 @@
#include "cc/debug/lap_timer.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/picture_layer_impl.h"
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "ui/gfx/geometry/rect.h"
@@ -207,7 +207,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
return;
}
- TaskGraphRunner* task_graph_runner = RasterWorkerPool::GetTaskGraphRunner();
+ TaskGraphRunner* task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner();
DCHECK(task_graph_runner);
if (!task_namespace_.IsValid())
@@ -240,8 +240,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
graph.nodes.push_back(
TaskGraph::Node(benchmark_raster_task.get(),
- RasterWorkerPool::kBenchmarkRasterTaskPriority,
- 0u));
+ TileTaskWorkerPool::kBenchmarkTaskPriority, 0u));
task_graph_runner->ScheduleTasks(task_namespace_, &graph);
task_graph_runner->WaitForTasksToFinishRunning(task_namespace_);
diff --git a/cc/resources/bitmap_raster_worker_pool.h b/cc/resources/bitmap_raster_worker_pool.h
deleted file mode 100644
index 624318b..0000000
--- a/cc/resources/bitmap_raster_worker_pool.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_RESOURCES_BITMAP_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_BITMAP_RASTER_WORKER_POOL_H_
-
-#include "base/memory/weak_ptr.h"
-#include "base/values.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "cc/resources/rasterizer.h"
-
-namespace base {
-namespace debug {
-class ConvertableToTraceFormat;
-}
-}
-
-namespace cc {
-class ResourceProvider;
-
-class CC_EXPORT BitmapRasterWorkerPool : public RasterWorkerPool,
- public Rasterizer,
- public RasterizerTaskClient {
- public:
- ~BitmapRasterWorkerPool() override;
-
- static scoped_ptr<RasterWorkerPool> Create(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider);
-
- // Overridden from RasterWorkerPool:
- Rasterizer* AsRasterizer() override;
-
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override;
- void Shutdown() override;
- void ScheduleTasks(RasterTaskQueue* queue) override;
- void CheckForCompletedTasks() override;
-
- // Overridden from RasterizerTaskClient:
- scoped_ptr<RasterBuffer> AcquireBufferForRaster(
- const Resource* resource) override;
- void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
-
- protected:
- BitmapRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider);
-
- private:
- void OnRasterFinished(TaskSet task_set);
- scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
-
- scoped_refptr<base::SequencedTaskRunner> task_runner_;
- TaskGraphRunner* task_graph_runner_;
- const NamespaceToken namespace_token_;
- RasterizerClient* client_;
- ResourceProvider* resource_provider_;
-
- TaskSetCollection raster_pending_;
-
- scoped_refptr<RasterizerTask> raster_finished_tasks_[kNumberOfTaskSets];
-
- // Task graph used when scheduling tasks and vector used to gather
- // completed tasks.
- TaskGraph graph_;
- Task::Vector completed_tasks_;
-
- base::WeakPtrFactory<BitmapRasterWorkerPool>
- raster_finished_weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(BitmapRasterWorkerPool);
-};
-
-} // namespace cc
-
-#endif // CC_RESOURCES_BITMAP_RASTER_WORKER_POOL_H_
diff --git a/cc/resources/bitmap_raster_worker_pool.cc b/cc/resources/bitmap_tile_task_worker_pool.cc
index a7adf4e..c4bd1f2 100644
--- a/cc/resources/bitmap_raster_worker_pool.cc
+++ b/cc/resources/bitmap_tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/bitmap_raster_worker_pool.h"
+#include "cc/resources/bitmap_tile_task_worker_pool.h"
#include <algorithm>
@@ -27,9 +27,9 @@ class RasterBufferImpl : public RasterBuffer {
void Playback(const RasterSource* raster_source,
const gfx::Rect& rect,
float scale) override {
- RasterWorkerPool::PlaybackToMemory(lock_.sk_bitmap().getPixels(),
- resource_->format(), resource_->size(),
- 0, raster_source, rect, scale);
+ TileTaskWorkerPool::PlaybackToMemory(lock_.sk_bitmap().getPixels(),
+ resource_->format(), resource_->size(),
+ 0, raster_source, rect, scale);
}
private:
@@ -42,15 +42,15 @@ class RasterBufferImpl : public RasterBuffer {
} // namespace
// static
-scoped_ptr<RasterWorkerPool> BitmapRasterWorkerPool::Create(
+scoped_ptr<TileTaskWorkerPool> BitmapTileTaskWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ResourceProvider* resource_provider) {
- return make_scoped_ptr<RasterWorkerPool>(new BitmapRasterWorkerPool(
+ return make_scoped_ptr<TileTaskWorkerPool>(new BitmapTileTaskWorkerPool(
task_runner, task_graph_runner, resource_provider));
}
-BitmapRasterWorkerPool::BitmapRasterWorkerPool(
+BitmapTileTaskWorkerPool::BitmapTileTaskWorkerPool(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ResourceProvider* resource_provider)
@@ -58,60 +58,58 @@ BitmapRasterWorkerPool::BitmapRasterWorkerPool(
task_graph_runner_(task_graph_runner),
namespace_token_(task_graph_runner->GetNamespaceToken()),
resource_provider_(resource_provider),
- raster_finished_weak_ptr_factory_(this) {
+ task_set_finished_weak_ptr_factory_(this) {
}
-BitmapRasterWorkerPool::~BitmapRasterWorkerPool() {
+BitmapTileTaskWorkerPool::~BitmapTileTaskWorkerPool() {
}
-Rasterizer* BitmapRasterWorkerPool::AsRasterizer() {
+TileTaskRunner* BitmapTileTaskWorkerPool::AsTileTaskRunner() {
return this;
}
-void BitmapRasterWorkerPool::SetClient(RasterizerClient* client) {
+void BitmapTileTaskWorkerPool::SetClient(TileTaskRunnerClient* client) {
client_ = client;
}
-void BitmapRasterWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "BitmapRasterWorkerPool::Shutdown");
+void BitmapTileTaskWorkerPool::Shutdown() {
+ TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown");
TaskGraph empty;
task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
}
-void BitmapRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
- TRACE_EVENT0("cc", "BitmapRasterWorkerPool::ScheduleTasks");
+void BitmapTileTaskWorkerPool::ScheduleTasks(TileTaskQueue* queue) {
+ TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks");
- if (raster_pending_.none())
+ if (tasks_pending_.none())
TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this);
// Mark all task sets as pending.
- raster_pending_.set();
+ tasks_pending_.set();
- unsigned priority = kRasterTaskPriorityBase;
+ unsigned priority = kTileTaskPriorityBase;
graph_.Reset();
- // Cancel existing OnRasterFinished callbacks.
- raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
+ // Cancel existing OnTaskSetFinished callbacks.
+ task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- scoped_refptr<RasterizerTask> new_raster_finished_tasks[kNumberOfTaskSets];
+ scoped_refptr<TileTask> new_task_set_finished_tasks[kNumberOfTaskSets];
size_t task_count[kNumberOfTaskSets] = {0};
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- new_raster_finished_tasks[task_set] = CreateRasterFinishedTask(
+ new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask(
task_runner_.get(),
- base::Bind(&BitmapRasterWorkerPool::OnRasterFinished,
- raster_finished_weak_ptr_factory_.GetWeakPtr(),
- task_set));
+ base::Bind(&BitmapTileTaskWorkerPool::OnTaskSetFinished,
+ task_set_finished_weak_ptr_factory_.GetWeakPtr(), task_set));
}
- for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
- it != queue->items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
DCHECK(!task->HasCompleted());
@@ -122,39 +120,36 @@ void BitmapRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
++task_count[task_set];
graph_.edges.push_back(
- TaskGraph::Edge(task, new_raster_finished_tasks[task_set].get()));
+ TaskGraph::Edge(task, new_task_set_finished_tasks[task_set].get()));
}
InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++);
}
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- InsertNodeForTask(&graph_,
- new_raster_finished_tasks[task_set].get(),
- kRasterFinishedTaskPriority,
- task_count[task_set]);
+ InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(),
+ kTaskSetFinishedTaskPriority, task_count[task_set]);
}
ScheduleTasksOnOriginThread(this, &graph_);
task_graph_runner_->ScheduleTasks(namespace_token_, &graph_);
- std::copy(new_raster_finished_tasks,
- new_raster_finished_tasks + kNumberOfTaskSets,
- raster_finished_tasks_);
+ std::copy(new_task_set_finished_tasks,
+ new_task_set_finished_tasks + kNumberOfTaskSets,
+ task_set_finished_tasks_);
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state",
+ StateAsValue());
}
-void BitmapRasterWorkerPool::CheckForCompletedTasks() {
- TRACE_EVENT0("cc", "BitmapRasterWorkerPool::CheckForCompletedTasks");
+void BitmapTileTaskWorkerPool::CheckForCompletedTasks() {
+ TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::CheckForCompletedTasks");
task_graph_runner_->CollectCompletedTasks(namespace_token_,
&completed_tasks_);
for (Task::Vector::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end();
- ++it) {
- RasterizerTask* task = static_cast<RasterizerTask*>(it->get());
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
task->WillComplete();
task->CompleteOnOriginThread(this);
@@ -165,40 +160,40 @@ void BitmapRasterWorkerPool::CheckForCompletedTasks() {
completed_tasks_.clear();
}
-scoped_ptr<RasterBuffer> BitmapRasterWorkerPool::AcquireBufferForRaster(
+scoped_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster(
const Resource* resource) {
return make_scoped_ptr<RasterBuffer>(
new RasterBufferImpl(resource_provider_, resource));
}
-void BitmapRasterWorkerPool::ReleaseBufferForRaster(
+void BitmapTileTaskWorkerPool::ReleaseBufferForRaster(
scoped_ptr<RasterBuffer> buffer) {
// Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-void BitmapRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
- TRACE_EVENT1(
- "cc", "BitmapRasterWorkerPool::OnRasterFinished", "task_set", task_set);
+void BitmapTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
+ TRACE_EVENT1("cc", "BitmapTileTaskWorkerPool::OnTaskSetFinished", "task_set",
+ task_set);
- DCHECK(raster_pending_[task_set]);
- raster_pending_[task_set] = false;
- if (raster_pending_.any()) {
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ DCHECK(tasks_pending_[task_set]);
+ tasks_pending_[task_set] = false;
+ if (tasks_pending_.any()) {
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running",
+ "state", StateAsValue());
} else {
TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this);
}
- client_->DidFinishRunningTasks(task_set);
+ client_->DidFinishRunningTileTasks(task_set);
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
-BitmapRasterWorkerPool::StateAsValue() const {
+BitmapTileTaskWorkerPool::StateAsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
state->BeginArray("tasks_pending");
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set)
- state->AppendBoolean(raster_pending_[task_set]);
+ state->AppendBoolean(tasks_pending_[task_set]);
state->EndArray();
return state;
}
diff --git a/cc/resources/bitmap_tile_task_worker_pool.h b/cc/resources/bitmap_tile_task_worker_pool.h
new file mode 100644
index 0000000..4f5d970
--- /dev/null
+++ b/cc/resources/bitmap_tile_task_worker_pool.h
@@ -0,0 +1,79 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_RESOURCES_BITMAP_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_BITMAP_TILE_TASK_WORKER_POOL_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/values.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/tile_task_worker_pool.h"
+
+namespace base {
+namespace debug {
+class ConvertableToTraceFormat;
+}
+}
+
+namespace cc {
+class ResourceProvider;
+
+class CC_EXPORT BitmapTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
+ public:
+ ~BitmapTileTaskWorkerPool() override;
+
+ static scoped_ptr<TileTaskWorkerPool> Create(
+ base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ResourceProvider* resource_provider);
+
+ // Overridden from TileTaskWorkerPool:
+ TileTaskRunner* AsTileTaskRunner() override;
+
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override;
+ void Shutdown() override;
+ void ScheduleTasks(TileTaskQueue* queue) override;
+ void CheckForCompletedTasks() override;
+
+ // Overridden from TileTaskClient:
+ scoped_ptr<RasterBuffer> AcquireBufferForRaster(
+ const Resource* resource) override;
+ void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
+
+ protected:
+ BitmapTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ResourceProvider* resource_provider);
+
+ private:
+ void OnTaskSetFinished(TaskSet task_set);
+ scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
+
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ TaskGraphRunner* task_graph_runner_;
+ const NamespaceToken namespace_token_;
+ TileTaskRunnerClient* client_;
+ ResourceProvider* resource_provider_;
+
+ TaskSetCollection tasks_pending_;
+
+ scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
+
+ // Task graph used when scheduling tasks and vector used to gather
+ // completed tasks.
+ TaskGraph graph_;
+ Task::Vector completed_tasks_;
+
+ base::WeakPtrFactory<BitmapTileTaskWorkerPool>
+ task_set_finished_weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BitmapTileTaskWorkerPool);
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_BITMAP_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/resources/gpu_raster_worker_pool.h b/cc/resources/gpu_raster_worker_pool.h
deleted file mode 100644
index c5ff13f..0000000
--- a/cc/resources/gpu_raster_worker_pool.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_RESOURCES_GPU_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_GPU_RASTER_WORKER_POOL_H_
-
-#include "base/memory/weak_ptr.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "cc/resources/rasterizer.h"
-#include "third_party/skia/include/core/SkMultiPictureDraw.h"
-
-namespace cc {
-class ContextProvider;
-class ResourceProvider;
-
-class CC_EXPORT GpuRasterWorkerPool : public RasterWorkerPool,
- public Rasterizer,
- public RasterizerTaskClient {
- public:
- ~GpuRasterWorkerPool() override;
-
- static scoped_ptr<RasterWorkerPool> Create(
- base::SequencedTaskRunner* task_runner,
- ContextProvider* context_provider,
- ResourceProvider* resource_provider,
- bool use_distance_field_text);
-
- // Overridden from RasterWorkerPool:
- Rasterizer* AsRasterizer() override;
-
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override;
- void Shutdown() override;
- void ScheduleTasks(RasterTaskQueue* queue) override;
- void CheckForCompletedTasks() override;
-
- // Overridden from RasterizerTaskClient:
- scoped_ptr<RasterBuffer> AcquireBufferForRaster(
- const Resource* resource) override;
- void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
-
- private:
- GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- ContextProvider* context_provider,
- ResourceProvider* resource_provider,
- bool use_distance_field_text);
-
- void OnRasterFinished(TaskSet task_set);
- void ScheduleRunTasksOnOriginThread();
- void RunTasksOnOriginThread();
- void RunTaskOnOriginThread(RasterizerTask* task);
-
- scoped_refptr<base::SequencedTaskRunner> task_runner_;
- scoped_ptr<TaskGraphRunner> task_graph_runner_;
- const NamespaceToken namespace_token_;
- RasterizerClient* client_;
- ContextProvider* context_provider_;
- ResourceProvider* resource_provider_;
- SkMultiPictureDraw multi_picture_draw_;
-
- bool run_tasks_on_origin_thread_pending_;
- bool use_distance_field_text_;
-
- TaskSetCollection raster_pending_;
-
- scoped_refptr<RasterizerTask> raster_finished_tasks_[kNumberOfTaskSets];
-
- // Task graph used when scheduling tasks and vector used to gather
- // completed tasks.
- TaskGraph graph_;
- Task::Vector completed_tasks_;
-
- base::WeakPtrFactory<GpuRasterWorkerPool> raster_finished_weak_ptr_factory_;
-
- base::WeakPtrFactory<GpuRasterWorkerPool> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuRasterWorkerPool);
-};
-
-} // namespace cc
-
-#endif // CC_RESOURCES_GPU_RASTER_WORKER_POOL_H_
diff --git a/cc/resources/gpu_raster_worker_pool.cc b/cc/resources/gpu_tile_task_worker_pool.cc
index d29855a..2cd4edd 100644
--- a/cc/resources/gpu_raster_worker_pool.cc
+++ b/cc/resources/gpu_tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/gpu_raster_worker_pool.h"
+#include "cc/resources/gpu_tile_task_worker_pool.h"
#include <algorithm>
@@ -50,10 +50,8 @@ class RasterBufferImpl : public RasterBuffer {
SkPictureRecorder recorder;
gfx::Size size = resource_->size();
const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag;
- skia::RefPtr<SkCanvas> canvas =
- skia::SharePtr(recorder.beginRecording(size.width(), size.height(),
- NULL, flags));
-
+ skia::RefPtr<SkCanvas> canvas = skia::SharePtr(
+ recorder.beginRecording(size.width(), size.height(), NULL, flags));
canvas->save();
raster_source->PlaybackToCanvas(canvas.get(), rect, scale);
@@ -76,22 +74,21 @@ class RasterBufferImpl : public RasterBuffer {
} // namespace
// static
-scoped_ptr<RasterWorkerPool> GpuRasterWorkerPool::Create(
+scoped_ptr<TileTaskWorkerPool> GpuTileTaskWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
bool use_distance_field_text) {
- return make_scoped_ptr<RasterWorkerPool>(
- new GpuRasterWorkerPool(task_runner,
- context_provider,
- resource_provider,
- use_distance_field_text));
+ return make_scoped_ptr<TileTaskWorkerPool>(
+ new GpuTileTaskWorkerPool(task_runner, context_provider,
+ resource_provider, use_distance_field_text));
}
-GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- ContextProvider* context_provider,
- ResourceProvider* resource_provider,
- bool use_distance_field_text)
+GpuTileTaskWorkerPool::GpuTileTaskWorkerPool(
+ base::SequencedTaskRunner* task_runner,
+ ContextProvider* context_provider,
+ ResourceProvider* resource_provider,
+ bool use_distance_field_text)
: task_runner_(task_runner),
task_graph_runner_(new TaskGraphRunner),
namespace_token_(task_graph_runner_->GetNamespaceToken()),
@@ -99,60 +96,58 @@ GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner,
resource_provider_(resource_provider),
run_tasks_on_origin_thread_pending_(false),
use_distance_field_text_(use_distance_field_text),
- raster_finished_weak_ptr_factory_(this),
+ task_set_finished_weak_ptr_factory_(this),
weak_ptr_factory_(this) {
DCHECK(context_provider_);
}
-GpuRasterWorkerPool::~GpuRasterWorkerPool() {
+GpuTileTaskWorkerPool::~GpuTileTaskWorkerPool() {
DCHECK_EQ(0u, completed_tasks_.size());
}
-Rasterizer* GpuRasterWorkerPool::AsRasterizer() {
+TileTaskRunner* GpuTileTaskWorkerPool::AsTileTaskRunner() {
return this;
}
-void GpuRasterWorkerPool::SetClient(RasterizerClient* client) {
+void GpuTileTaskWorkerPool::SetClient(TileTaskRunnerClient* client) {
client_ = client;
}
-void GpuRasterWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "GpuRasterWorkerPool::Shutdown");
+void GpuTileTaskWorkerPool::Shutdown() {
+ TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::Shutdown");
TaskGraph empty;
task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
}
-void GpuRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
- TRACE_EVENT0("cc", "GpuRasterWorkerPool::ScheduleTasks");
+void GpuTileTaskWorkerPool::ScheduleTasks(TileTaskQueue* queue) {
+ TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::ScheduleTasks");
// Mark all task sets as pending.
- raster_pending_.set();
+ tasks_pending_.set();
- unsigned priority = kRasterTaskPriorityBase;
+ unsigned priority = kTileTaskPriorityBase;
graph_.Reset();
- // Cancel existing OnRasterFinished callbacks.
- raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
+ // Cancel existing OnTaskSetFinished callbacks.
+ task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- scoped_refptr<RasterizerTask> new_raster_finished_tasks[kNumberOfTaskSets];
+ scoped_refptr<TileTask> new_task_set_finished_tasks[kNumberOfTaskSets];
size_t task_count[kNumberOfTaskSets] = {0};
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- new_raster_finished_tasks[task_set] = CreateRasterFinishedTask(
+ new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask(
task_runner_.get(),
- base::Bind(&GpuRasterWorkerPool::OnRasterFinished,
- raster_finished_weak_ptr_factory_.GetWeakPtr(),
- task_set));
+ base::Bind(&GpuTileTaskWorkerPool::OnTaskSetFinished,
+ task_set_finished_weak_ptr_factory_.GetWeakPtr(), task_set));
}
- for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
- it != queue->items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
DCHECK(!task->HasCompleted());
@@ -163,17 +158,15 @@ void GpuRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
++task_count[task_set];
graph_.edges.push_back(
- TaskGraph::Edge(task, new_raster_finished_tasks[task_set].get()));
+ TaskGraph::Edge(task, new_task_set_finished_tasks[task_set].get()));
}
InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++);
}
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- InsertNodeForTask(&graph_,
- new_raster_finished_tasks[task_set].get(),
- kRasterFinishedTaskPriority,
- task_count[task_set]);
+ InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(),
+ kTaskSetFinishedTaskPriority, task_count[task_set]);
}
ScheduleTasksOnOriginThread(this, &graph_);
@@ -181,20 +174,19 @@ void GpuRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
ScheduleRunTasksOnOriginThread();
- std::copy(new_raster_finished_tasks,
- new_raster_finished_tasks + kNumberOfTaskSets,
- raster_finished_tasks_);
+ std::copy(new_task_set_finished_tasks,
+ new_task_set_finished_tasks + kNumberOfTaskSets,
+ task_set_finished_tasks_);
}
-void GpuRasterWorkerPool::CheckForCompletedTasks() {
- TRACE_EVENT0("cc", "GpuRasterWorkerPool::CheckForCompletedTasks");
+void GpuTileTaskWorkerPool::CheckForCompletedTasks() {
+ TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::CheckForCompletedTasks");
task_graph_runner_->CollectCompletedTasks(namespace_token_,
&completed_tasks_);
for (Task::Vector::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end();
- ++it) {
- RasterizerTask* task = static_cast<RasterizerTask*>(it->get());
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
task->WillComplete();
task->CompleteOnOriginThread(this);
@@ -205,42 +197,39 @@ void GpuRasterWorkerPool::CheckForCompletedTasks() {
completed_tasks_.clear();
}
-scoped_ptr<RasterBuffer> GpuRasterWorkerPool::AcquireBufferForRaster(
+scoped_ptr<RasterBuffer> GpuTileTaskWorkerPool::AcquireBufferForRaster(
const Resource* resource) {
return make_scoped_ptr<RasterBuffer>(
- new RasterBufferImpl(resource_provider_,
- resource,
- &multi_picture_draw_,
+ new RasterBufferImpl(resource_provider_, resource, &multi_picture_draw_,
use_distance_field_text_));
}
-void GpuRasterWorkerPool::ReleaseBufferForRaster(
+void GpuTileTaskWorkerPool::ReleaseBufferForRaster(
scoped_ptr<RasterBuffer> buffer) {
// Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-void GpuRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
- TRACE_EVENT1(
- "cc", "GpuRasterWorkerPool::OnRasterFinished", "task_set", task_set);
+void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
+ TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set",
+ task_set);
- DCHECK(raster_pending_[task_set]);
- raster_pending_[task_set] = false;
- client_->DidFinishRunningTasks(task_set);
+ DCHECK(tasks_pending_[task_set]);
+ tasks_pending_[task_set] = false;
+ client_->DidFinishRunningTileTasks(task_set);
}
-void GpuRasterWorkerPool::ScheduleRunTasksOnOriginThread() {
+void GpuTileTaskWorkerPool::ScheduleRunTasksOnOriginThread() {
if (run_tasks_on_origin_thread_pending_)
return;
task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&GpuRasterWorkerPool::RunTasksOnOriginThread,
- weak_ptr_factory_.GetWeakPtr()));
+ FROM_HERE, base::Bind(&GpuTileTaskWorkerPool::RunTasksOnOriginThread,
+ weak_ptr_factory_.GetWeakPtr()));
run_tasks_on_origin_thread_pending_ = true;
}
-void GpuRasterWorkerPool::RunTasksOnOriginThread() {
- TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread");
+void GpuTileTaskWorkerPool::RunTasksOnOriginThread() {
+ TRACE_EVENT0("cc", "GpuTileTaskWorkerPool::RunTasksOnOriginThread");
DCHECK(run_tasks_on_origin_thread_pending_);
run_tasks_on_origin_thread_pending_ = false;
diff --git a/cc/resources/gpu_tile_task_worker_pool.h b/cc/resources/gpu_tile_task_worker_pool.h
new file mode 100644
index 0000000..363b0a6
--- /dev/null
+++ b/cc/resources/gpu_tile_task_worker_pool.h
@@ -0,0 +1,84 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_RESOURCES_GPU_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_GPU_TILE_TASK_WORKER_POOL_H_
+
+#include "base/memory/weak_ptr.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/tile_task_worker_pool.h"
+#include "third_party/skia/include/core/SkMultiPictureDraw.h"
+
+namespace cc {
+class ContextProvider;
+class ResourceProvider;
+
+class CC_EXPORT GpuTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
+ public:
+ ~GpuTileTaskWorkerPool() override;
+
+ static scoped_ptr<TileTaskWorkerPool> Create(
+ base::SequencedTaskRunner* task_runner,
+ ContextProvider* context_provider,
+ ResourceProvider* resource_provider,
+ bool use_distance_field_text);
+
+ // Overridden from TileTaskWorkerPool:
+ TileTaskRunner* AsTileTaskRunner() override;
+
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override;
+ void Shutdown() override;
+ void ScheduleTasks(TileTaskQueue* queue) override;
+ void CheckForCompletedTasks() override;
+
+ // Overridden from TileTaskClient:
+ scoped_ptr<RasterBuffer> AcquireBufferForRaster(
+ const Resource* resource) override;
+ void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
+
+ private:
+ GpuTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
+ ContextProvider* context_provider,
+ ResourceProvider* resource_provider,
+ bool use_distance_field_text);
+
+ void OnTaskSetFinished(TaskSet task_set);
+ void ScheduleRunTasksOnOriginThread();
+ void RunTasksOnOriginThread();
+ void RunTaskOnOriginThread(TileTask* task);
+
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ scoped_ptr<TaskGraphRunner> task_graph_runner_;
+ const NamespaceToken namespace_token_;
+ TileTaskRunnerClient* client_;
+ ContextProvider* context_provider_;
+ ResourceProvider* resource_provider_;
+ SkMultiPictureDraw multi_picture_draw_;
+
+ bool run_tasks_on_origin_thread_pending_;
+ bool use_distance_field_text_;
+
+ TaskSetCollection tasks_pending_;
+
+ scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
+
+ // Task graph used when scheduling tasks and vector used to gather
+ // completed tasks.
+ TaskGraph graph_;
+ Task::Vector completed_tasks_;
+
+ base::WeakPtrFactory<GpuTileTaskWorkerPool>
+ task_set_finished_weak_ptr_factory_;
+
+ base::WeakPtrFactory<GpuTileTaskWorkerPool> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuTileTaskWorkerPool);
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_GPU_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/resources/managed_tile_state.h b/cc/resources/managed_tile_state.h
index a0905c7..faba93c 100644
--- a/cc/resources/managed_tile_state.h
+++ b/cc/resources/managed_tile_state.h
@@ -7,11 +7,11 @@
#include "base/memory/scoped_ptr.h"
#include "cc/resources/platform_color.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/scoped_resource.h"
#include "cc/resources/tile_priority.h"
+#include "cc/resources/tile_task_runner.h"
namespace cc {
diff --git a/cc/resources/one_copy_raster_worker_pool.cc b/cc/resources/one_copy_tile_task_worker_pool.cc
index a8b838e..dcb8dea 100644
--- a/cc/resources/one_copy_raster_worker_pool.cc
+++ b/cc/resources/one_copy_tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/one_copy_raster_worker_pool.h"
+#include "cc/resources/one_copy_tile_task_worker_pool.h"
#include <algorithm>
#include <limits>
@@ -22,7 +22,7 @@ namespace {
class RasterBufferImpl : public RasterBuffer {
public:
- RasterBufferImpl(OneCopyRasterWorkerPool* worker_pool,
+ RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool,
ResourceProvider* resource_provider,
ResourcePool* resource_pool,
const Resource* resource)
@@ -61,7 +61,7 @@ class RasterBufferImpl : public RasterBuffer {
}
private:
- OneCopyRasterWorkerPool* worker_pool_;
+ OneCopyTileTaskWorkerPool* worker_pool_;
ResourceProvider* resource_provider_;
ResourcePool* resource_pool_;
const Resource* resource_;
@@ -87,32 +87,29 @@ const int kFailedAttemptsBeforeWaitIfNeeded = 256;
} // namespace
-OneCopyRasterWorkerPool::CopyOperation::CopyOperation(
+OneCopyTileTaskWorkerPool::CopyOperation::CopyOperation(
scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock,
scoped_ptr<ScopedResource> src,
const Resource* dst)
: write_lock(write_lock.Pass()), src(src.Pass()), dst(dst) {
}
-OneCopyRasterWorkerPool::CopyOperation::~CopyOperation() {
+OneCopyTileTaskWorkerPool::CopyOperation::~CopyOperation() {
}
// static
-scoped_ptr<RasterWorkerPool> OneCopyRasterWorkerPool::Create(
+scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
ResourcePool* resource_pool) {
- return make_scoped_ptr<RasterWorkerPool>(
- new OneCopyRasterWorkerPool(task_runner,
- task_graph_runner,
- context_provider,
- resource_provider,
- resource_pool));
+ return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool(
+ task_runner, task_graph_runner, context_provider, resource_provider,
+ resource_pool));
}
-OneCopyRasterWorkerPool::OneCopyRasterWorkerPool(
+OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
@@ -134,24 +131,24 @@ OneCopyRasterWorkerPool::OneCopyRasterWorkerPool(
check_for_completed_copy_operations_pending_(false),
shutdown_(false),
weak_ptr_factory_(this),
- raster_finished_weak_ptr_factory_(this) {
+ task_set_finished_weak_ptr_factory_(this) {
DCHECK(context_provider_);
}
-OneCopyRasterWorkerPool::~OneCopyRasterWorkerPool() {
+OneCopyTileTaskWorkerPool::~OneCopyTileTaskWorkerPool() {
DCHECK_EQ(scheduled_copy_operation_count_, 0u);
}
-Rasterizer* OneCopyRasterWorkerPool::AsRasterizer() {
+TileTaskRunner* OneCopyTileTaskWorkerPool::AsTileTaskRunner() {
return this;
}
-void OneCopyRasterWorkerPool::SetClient(RasterizerClient* client) {
+void OneCopyTileTaskWorkerPool::SetClient(TileTaskRunnerClient* client) {
client_ = client;
}
-void OneCopyRasterWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "OneCopyRasterWorkerPool::Shutdown");
+void OneCopyTileTaskWorkerPool::Shutdown() {
+ TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::Shutdown");
{
base::AutoLock lock(lock_);
@@ -165,40 +162,38 @@ void OneCopyRasterWorkerPool::Shutdown() {
task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
}
-void OneCopyRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
- TRACE_EVENT0("cc", "OneCopyRasterWorkerPool::ScheduleTasks");
+void OneCopyTileTaskWorkerPool::ScheduleTasks(TileTaskQueue* queue) {
+ TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks");
- if (raster_pending_.none())
+ if (tasks_pending_.none())
TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this);
// Mark all task sets as pending.
- raster_pending_.set();
+ tasks_pending_.set();
- unsigned priority = kRasterTaskPriorityBase;
+ unsigned priority = kTileTaskPriorityBase;
graph_.Reset();
- // Cancel existing OnRasterFinished callbacks.
- raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
+ // Cancel existing OnTaskSetFinished callbacks.
+ task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- scoped_refptr<RasterizerTask> new_raster_finished_tasks[kNumberOfTaskSets];
+ scoped_refptr<TileTask> new_task_set_finished_tasks[kNumberOfTaskSets];
size_t task_count[kNumberOfTaskSets] = {0};
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- new_raster_finished_tasks[task_set] = CreateRasterFinishedTask(
+ new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask(
task_runner_.get(),
- base::Bind(&OneCopyRasterWorkerPool::OnRasterFinished,
- raster_finished_weak_ptr_factory_.GetWeakPtr(),
- task_set));
+ base::Bind(&OneCopyTileTaskWorkerPool::OnTaskSetFinished,
+ task_set_finished_weak_ptr_factory_.GetWeakPtr(), task_set));
}
resource_pool_->CheckBusyResources(false);
- for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
- it != queue->items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
DCHECK(!task->HasCompleted());
@@ -209,42 +204,39 @@ void OneCopyRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
++task_count[task_set];
graph_.edges.push_back(
- TaskGraph::Edge(task, new_raster_finished_tasks[task_set].get()));
+ TaskGraph::Edge(task, new_task_set_finished_tasks[task_set].get()));
}
InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++);
}
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- InsertNodeForTask(&graph_,
- new_raster_finished_tasks[task_set].get(),
- kRasterFinishedTaskPriority,
- task_count[task_set]);
+ InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(),
+ kTaskSetFinishedTaskPriority, task_count[task_set]);
}
ScheduleTasksOnOriginThread(this, &graph_);
task_graph_runner_->ScheduleTasks(namespace_token_, &graph_);
- std::copy(new_raster_finished_tasks,
- new_raster_finished_tasks + kNumberOfTaskSets,
- raster_finished_tasks_);
+ std::copy(new_task_set_finished_tasks,
+ new_task_set_finished_tasks + kNumberOfTaskSets,
+ task_set_finished_tasks_);
resource_pool_->ReduceResourceUsage();
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state",
+ StateAsValue());
}
-void OneCopyRasterWorkerPool::CheckForCompletedTasks() {
- TRACE_EVENT0("cc", "OneCopyRasterWorkerPool::CheckForCompletedTasks");
+void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() {
+ TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks");
task_graph_runner_->CollectCompletedTasks(namespace_token_,
&completed_tasks_);
for (Task::Vector::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end();
- ++it) {
- RasterizerTask* task = static_cast<RasterizerTask*>(it->get());
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
task->WillComplete();
task->CompleteOnOriginThread(this);
@@ -255,20 +247,20 @@ void OneCopyRasterWorkerPool::CheckForCompletedTasks() {
completed_tasks_.clear();
}
-scoped_ptr<RasterBuffer> OneCopyRasterWorkerPool::AcquireBufferForRaster(
+scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster(
const Resource* resource) {
DCHECK_EQ(resource->format(), resource_pool_->resource_format());
return make_scoped_ptr<RasterBuffer>(
new RasterBufferImpl(this, resource_provider_, resource_pool_, resource));
}
-void OneCopyRasterWorkerPool::ReleaseBufferForRaster(
+void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster(
scoped_ptr<RasterBuffer> buffer) {
// Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
CopySequenceNumber
-OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
+OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock,
scoped_ptr<ScopedResource> src,
const Resource* dst,
@@ -313,13 +305,9 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
gfx::GpuMemoryBuffer* gpu_memory_buffer = write_lock->GetGpuMemoryBuffer();
if (gpu_memory_buffer) {
- RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(),
- src->format(),
- src->size(),
- gpu_memory_buffer->GetStride(),
- raster_source,
- rect,
- scale);
+ TileTaskWorkerPool::PlaybackToMemory(
+ gpu_memory_buffer->Map(), src->format(), src->size(),
+ gpu_memory_buffer->GetStride(), raster_source, rect, scale);
gpu_memory_buffer->Unmap();
}
}
@@ -335,15 +323,14 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
if ((sequence % kCopyFlushPeriod) == 0) {
task_runner_->PostTask(
FROM_HERE,
- base::Bind(&OneCopyRasterWorkerPool::AdvanceLastFlushedCopyTo,
- weak_ptr_factory_.GetWeakPtr(),
- sequence));
+ base::Bind(&OneCopyTileTaskWorkerPool::AdvanceLastFlushedCopyTo,
+ weak_ptr_factory_.GetWeakPtr(), sequence));
}
return sequence;
}
-void OneCopyRasterWorkerPool::AdvanceLastIssuedCopyTo(
+void OneCopyTileTaskWorkerPool::AdvanceLastIssuedCopyTo(
CopySequenceNumber sequence) {
if (last_issued_copy_operation_ >= sequence)
return;
@@ -352,7 +339,7 @@ void OneCopyRasterWorkerPool::AdvanceLastIssuedCopyTo(
last_issued_copy_operation_ = sequence;
}
-void OneCopyRasterWorkerPool::AdvanceLastFlushedCopyTo(
+void OneCopyTileTaskWorkerPool::AdvanceLastFlushedCopyTo(
CopySequenceNumber sequence) {
if (last_flushed_copy_operation_ >= sequence)
return;
@@ -364,24 +351,24 @@ void OneCopyRasterWorkerPool::AdvanceLastFlushedCopyTo(
last_flushed_copy_operation_ = last_issued_copy_operation_;
}
-void OneCopyRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
- TRACE_EVENT1(
- "cc", "OneCopyRasterWorkerPool::OnRasterFinished", "task_set", task_set);
+void OneCopyTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
+ TRACE_EVENT1("cc", "OneCopyTileTaskWorkerPool::OnTaskSetFinished", "task_set",
+ task_set);
- DCHECK(raster_pending_[task_set]);
- raster_pending_[task_set] = false;
- if (raster_pending_.any()) {
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ DCHECK(tasks_pending_[task_set]);
+ tasks_pending_[task_set] = false;
+ if (tasks_pending_.any()) {
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running",
+ "state", StateAsValue());
} else {
TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this);
}
- client_->DidFinishRunningTasks(task_set);
+ client_->DidFinishRunningTileTasks(task_set);
}
-void OneCopyRasterWorkerPool::IssueCopyOperations(int64 count) {
- TRACE_EVENT1(
- "cc", "OneCopyRasterWorkerPool::IssueCopyOperations", "count", count);
+void OneCopyTileTaskWorkerPool::IssueCopyOperations(int64 count) {
+ TRACE_EVENT1("cc", "OneCopyTileTaskWorkerPool::IssueCopyOperations", "count",
+ count);
CopyOperation::Deque copy_operations;
@@ -417,7 +404,7 @@ void OneCopyRasterWorkerPool::IssueCopyOperations(int64 count) {
}
}
-void OneCopyRasterWorkerPool::
+void OneCopyTileTaskWorkerPool::
ScheduleCheckForCompletedCopyOperationsWithLockAcquired(
bool wait_if_needed) {
lock_.AssertAcquired();
@@ -438,9 +425,8 @@ void OneCopyRasterWorkerPool::
task_runner_->PostDelayedTask(
FROM_HERE,
- base::Bind(&OneCopyRasterWorkerPool::CheckForCompletedCopyOperations,
- weak_ptr_factory_.GetWeakPtr(),
- wait_if_needed),
+ base::Bind(&OneCopyTileTaskWorkerPool::CheckForCompletedCopyOperations,
+ weak_ptr_factory_.GetWeakPtr(), wait_if_needed),
next_check_for_completed_copy_operations_time - now);
last_check_for_completed_copy_operations_time_ =
@@ -448,12 +434,11 @@ void OneCopyRasterWorkerPool::
check_for_completed_copy_operations_pending_ = true;
}
-void OneCopyRasterWorkerPool::CheckForCompletedCopyOperations(
+void OneCopyTileTaskWorkerPool::CheckForCompletedCopyOperations(
bool wait_if_needed) {
TRACE_EVENT1("cc",
- "OneCopyRasterWorkerPool::CheckForCompletedCopyOperations",
- "wait_if_needed",
- wait_if_needed);
+ "OneCopyTileTaskWorkerPool::CheckForCompletedCopyOperations",
+ "wait_if_needed", wait_if_needed);
resource_pool_->CheckBusyResources(wait_if_needed);
@@ -474,13 +459,13 @@ void OneCopyRasterWorkerPool::CheckForCompletedCopyOperations(
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
-OneCopyRasterWorkerPool::StateAsValue() const {
+OneCopyTileTaskWorkerPool::StateAsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
state->BeginArray("tasks_pending");
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set)
- state->AppendBoolean(raster_pending_[task_set]);
+ state->AppendBoolean(tasks_pending_[task_set]);
state->EndArray();
state->BeginDictionary("staging_state");
StagingStateAsValueInto(state.get());
@@ -489,7 +474,7 @@ OneCopyRasterWorkerPool::StateAsValue() const {
return state;
}
-void OneCopyRasterWorkerPool::StagingStateAsValueInto(
+void OneCopyTileTaskWorkerPool::StagingStateAsValueInto(
base::debug::TracedValue* staging_state) const {
staging_state->SetInteger("staging_resource_count",
resource_pool_->total_resource_count());
diff --git a/cc/resources/one_copy_raster_worker_pool.h b/cc/resources/one_copy_tile_task_worker_pool.h
index b209da2..c5b30ba 100644
--- a/cc/resources/one_copy_raster_worker_pool.h
+++ b/cc/resources/one_copy_tile_task_worker_pool.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_RESOURCES_ONE_COPY_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_ONE_COPY_RASTER_WORKER_POOL_H_
+#ifndef CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "base/values.h"
#include "cc/base/scoped_ptr_deque.h"
#include "cc/output/context_provider.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/resource_provider.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/tile_task_worker_pool.h"
namespace base {
namespace debug {
@@ -27,29 +27,29 @@ class ScopedResource;
typedef int64 CopySequenceNumber;
-class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool,
- public Rasterizer,
- public RasterizerTaskClient {
+class CC_EXPORT OneCopyTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
public:
- ~OneCopyRasterWorkerPool() override;
+ ~OneCopyTileTaskWorkerPool() override;
- static scoped_ptr<RasterWorkerPool> Create(
+ static scoped_ptr<TileTaskWorkerPool> Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
ResourcePool* resource_pool);
- // Overridden from RasterWorkerPool:
- Rasterizer* AsRasterizer() override;
+ // Overridden from TileTaskWorkerPool:
+ TileTaskRunner* AsTileTaskRunner() override;
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override;
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override;
void Shutdown() override;
- void ScheduleTasks(RasterTaskQueue* queue) override;
+ void ScheduleTasks(TileTaskQueue* queue) override;
void CheckForCompletedTasks() override;
- // Overridden from RasterizerTaskClient:
+ // Overridden from TileTaskClient:
scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource) override;
void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
@@ -69,11 +69,11 @@ class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool,
void AdvanceLastIssuedCopyTo(CopySequenceNumber sequence);
protected:
- OneCopyRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ContextProvider* context_provider,
- ResourceProvider* resource_provider,
- ResourcePool* resource_pool);
+ OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ContextProvider* context_provider,
+ ResourceProvider* resource_provider,
+ ResourcePool* resource_pool);
private:
struct CopyOperation {
@@ -90,7 +90,7 @@ class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool,
const Resource* dst;
};
- void OnRasterFinished(TaskSet task_set);
+ void OnTaskSetFinished(TaskSet task_set);
void AdvanceLastFlushedCopyTo(CopySequenceNumber sequence);
void IssueCopyOperations(int64 count);
void ScheduleCheckForCompletedCopyOperationsWithLockAcquired(
@@ -102,12 +102,12 @@ class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool,
scoped_refptr<base::SequencedTaskRunner> task_runner_;
TaskGraphRunner* task_graph_runner_;
const NamespaceToken namespace_token_;
- RasterizerClient* client_;
+ TileTaskRunnerClient* client_;
ContextProvider* context_provider_;
ResourceProvider* resource_provider_;
ResourcePool* resource_pool_;
- TaskSetCollection raster_pending_;
- scoped_refptr<RasterizerTask> raster_finished_tasks_[kNumberOfTaskSets];
+ TaskSetCollection tasks_pending_;
+ scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
CopySequenceNumber last_issued_copy_operation_;
CopySequenceNumber last_flushed_copy_operation_;
@@ -127,15 +127,15 @@ class CC_EXPORT OneCopyRasterWorkerPool : public RasterWorkerPool,
base::TimeTicks last_check_for_completed_copy_operations_time_;
bool shutdown_;
- base::WeakPtrFactory<OneCopyRasterWorkerPool> weak_ptr_factory_;
+ base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_;
// "raster finished" tasks need their own factory as they need to be
// canceled when ScheduleTasks() is called.
- base::WeakPtrFactory<OneCopyRasterWorkerPool>
- raster_finished_weak_ptr_factory_;
+ base::WeakPtrFactory<OneCopyTileTaskWorkerPool>
+ task_set_finished_weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(OneCopyRasterWorkerPool);
+ DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool);
};
} // namespace cc
-#endif // CC_RESOURCES_ONE_COPY_RASTER_WORKER_POOL_H_
+#endif // CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index c3050c3..698fe2c 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -10,7 +10,7 @@
#include "cc/base/region.h"
#include "cc/resources/picture_pile_impl.h"
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "skia/ext/analysis_canvas.h"
namespace {
@@ -545,7 +545,7 @@ void PicturePile::CreatePictures(ContentLayerClient* painter,
// raster thread doesn't provide any benefit. This might change
// in the future but we avoid it for now to reduce the cost of
// Picture::Create.
- bool gather_pixel_refs = RasterWorkerPool::GetNumRasterThreads() > 1;
+ bool gather_pixel_refs = TileTaskWorkerPool::GetNumWorkerThreads() > 1;
for (int i = 0; i < repeat_count; i++) {
picture = Picture::Create(padded_record_rect, painter, tile_grid_info_,
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_tile_task_worker_pool.cc
index 175e7d4..7256f94 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/pixel_buffer_raster_worker_pool.h"
+#include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
#include <algorithm>
@@ -41,9 +41,9 @@ class RasterBufferImpl : public RasterBuffer {
if (!memory_)
return;
- RasterWorkerPool::PlaybackToMemory(memory_, resource_->format(),
- resource_->size(), stride_,
- raster_source, rect, scale);
+ TileTaskWorkerPool::PlaybackToMemory(memory_, resource_->format(),
+ resource_->size(), stride_,
+ raster_source, rect, scale);
}
private:
@@ -89,28 +89,25 @@ void RemoveTaskSetsFromTaskCounts(size_t* task_counts,
} // namespace
-PixelBufferRasterWorkerPool::RasterTaskState::RasterTaskState(
+PixelBufferTileTaskWorkerPool::RasterTaskState::RasterTaskState(
RasterTask* task,
const TaskSetCollection& task_sets)
: type(UNSCHEDULED), task(task), task_sets(task_sets) {
}
// static
-scoped_ptr<RasterWorkerPool> PixelBufferRasterWorkerPool::Create(
+scoped_ptr<TileTaskWorkerPool> PixelBufferTileTaskWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
size_t max_transfer_buffer_usage_bytes) {
- return make_scoped_ptr<RasterWorkerPool>(
- new PixelBufferRasterWorkerPool(task_runner,
- task_graph_runner,
- context_provider,
- resource_provider,
- max_transfer_buffer_usage_bytes));
+ return make_scoped_ptr<TileTaskWorkerPool>(new PixelBufferTileTaskWorkerPool(
+ task_runner, task_graph_runner, context_provider, resource_provider,
+ max_transfer_buffer_usage_bytes));
}
-PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
+PixelBufferTileTaskWorkerPool::PixelBufferTileTaskWorkerPool(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
@@ -128,16 +125,17 @@ PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
has_performed_uploads_since_last_flush_(false),
check_for_completed_raster_task_notifier_(
task_runner,
- base::Bind(&PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks,
- base::Unretained(this)),
+ base::Bind(
+ &PixelBufferTileTaskWorkerPool::CheckForCompletedRasterTasks,
+ base::Unretained(this)),
base::TimeDelta::FromMilliseconds(
kCheckForCompletedRasterTasksDelayMs)),
- raster_finished_weak_ptr_factory_(this) {
+ task_set_finished_weak_ptr_factory_(this) {
DCHECK(context_provider_);
std::fill(task_counts_, task_counts_ + kNumberOfTaskSets, 0);
}
-PixelBufferRasterWorkerPool::~PixelBufferRasterWorkerPool() {
+PixelBufferTileTaskWorkerPool::~PixelBufferTileTaskWorkerPool() {
DCHECK_EQ(0u, raster_task_states_.size());
DCHECK_EQ(0u, raster_tasks_with_pending_upload_.size());
DCHECK_EQ(0u, completed_raster_tasks_.size());
@@ -145,14 +143,16 @@ PixelBufferRasterWorkerPool::~PixelBufferRasterWorkerPool() {
DCHECK(NonEmptyTaskSetsFromTaskCounts(task_counts_).none());
}
-Rasterizer* PixelBufferRasterWorkerPool::AsRasterizer() { return this; }
+TileTaskRunner* PixelBufferTileTaskWorkerPool::AsTileTaskRunner() {
+ return this;
+}
-void PixelBufferRasterWorkerPool::SetClient(RasterizerClient* client) {
+void PixelBufferTileTaskWorkerPool::SetClient(TileTaskRunnerClient* client) {
client_ = client;
}
-void PixelBufferRasterWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::Shutdown");
+void PixelBufferTileTaskWorkerPool::Shutdown() {
+ TRACE_EVENT0("cc", "PixelBufferTileTaskWorkerPool::Shutdown");
shutdown_ = true;
@@ -166,8 +166,7 @@ void PixelBufferRasterWorkerPool::Shutdown() {
check_for_completed_raster_task_notifier_.Shutdown();
for (RasterTaskState::Vector::iterator it = raster_task_states_.begin();
- it != raster_task_states_.end();
- ++it) {
+ it != raster_task_states_.end(); ++it) {
RasterTaskState& state = *it;
// All unscheduled tasks need to be canceled.
@@ -179,8 +178,8 @@ void PixelBufferRasterWorkerPool::Shutdown() {
DCHECK_EQ(completed_raster_tasks_.size(), raster_task_states_.size());
}
-void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
- TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleTasks");
+void PixelBufferTileTaskWorkerPool::ScheduleTasks(TileTaskQueue* queue) {
+ TRACE_EVENT0("cc", "PixelBufferTileTaskWorkerPool::ScheduleTasks");
if (should_notify_client_if_no_tasks_are_pending_.none())
TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this);
@@ -189,27 +188,24 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
std::fill(task_counts_, task_counts_ + kNumberOfTaskSets, 0);
// Update raster task state and remove items from old queue.
- for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
- it != queue->items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
// Remove any old items that are associated with this task. The result is
// that the old queue is left with all items not present in this queue,
// which we use below to determine what tasks need to be canceled.
- RasterTaskQueue::Item::Vector::iterator old_it =
- std::find_if(raster_tasks_.items.begin(),
- raster_tasks_.items.end(),
- RasterTaskQueue::Item::TaskComparator(task));
+ TileTaskQueue::Item::Vector::iterator old_it =
+ std::find_if(raster_tasks_.items.begin(), raster_tasks_.items.end(),
+ TileTaskQueue::Item::TaskComparator(task));
if (old_it != raster_tasks_.items.end()) {
std::swap(*old_it, raster_tasks_.items.back());
raster_tasks_.items.pop_back();
}
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
if (state_it != raster_task_states_.end()) {
RasterTaskState& state = *state_it;
@@ -230,16 +226,14 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
}
// Determine what tasks in old queue need to be canceled.
- for (RasterTaskQueue::Item::Vector::const_iterator it =
+ for (TileTaskQueue::Item::Vector::const_iterator it =
raster_tasks_.items.begin();
- it != raster_tasks_.items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ it != raster_tasks_.items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
// We've already processed completion if we can't find a RasterTaskState for
// this task.
@@ -277,33 +271,30 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
// Reschedule check for completed raster tasks.
check_for_completed_raster_task_notifier_.Schedule();
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, StateName(), "state", StateAsValue());
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, StateName(),
+ "state", StateAsValue());
}
-void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
- TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks");
+void PixelBufferTileTaskWorkerPool::CheckForCompletedTasks() {
+ TRACE_EVENT0("cc", "PixelBufferTileTaskWorkerPool::CheckForCompletedTasks");
CheckForCompletedRasterizerTasks();
CheckForCompletedUploads();
FlushUploads();
- for (RasterizerTask::Vector::const_iterator it =
+ for (TileTask::Vector::const_iterator it =
completed_image_decode_tasks_.begin();
- it != completed_image_decode_tasks_.end();
- ++it) {
- RasterizerTask* task = it->get();
+ it != completed_image_decode_tasks_.end(); ++it) {
+ TileTask* task = it->get();
task->RunReplyOnOriginThread();
}
completed_image_decode_tasks_.clear();
for (RasterTask::Vector::const_iterator it = completed_raster_tasks_.begin();
- it != completed_raster_tasks_.end();
- ++it) {
+ it != completed_raster_tasks_.end(); ++it) {
RasterTask* task = it->get();
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
DCHECK(state_it != raster_task_states_.end());
DCHECK_EQ(RasterTaskState::COMPLETED, state_it->type);
@@ -316,22 +307,20 @@ void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
completed_raster_tasks_.clear();
}
-scoped_ptr<RasterBuffer> PixelBufferRasterWorkerPool::AcquireBufferForRaster(
+scoped_ptr<RasterBuffer> PixelBufferTileTaskWorkerPool::AcquireBufferForRaster(
const Resource* resource) {
return make_scoped_ptr<RasterBuffer>(
new RasterBufferImpl(resource_provider_, resource));
}
-void PixelBufferRasterWorkerPool::ReleaseBufferForRaster(
+void PixelBufferTileTaskWorkerPool::ReleaseBufferForRaster(
scoped_ptr<RasterBuffer> buffer) {
// Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-void PixelBufferRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
- TRACE_EVENT2("cc",
- "PixelBufferRasterWorkerPool::OnRasterFinished",
- "task_set",
- task_set,
+void PixelBufferTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
+ TRACE_EVENT2("cc", "PixelBufferTileTaskWorkerPool::OnTaskSetFinished",
+ "task_set", task_set,
"should_notify_client_if_no_tasks_are_pending",
should_notify_client_if_no_tasks_are_pending_[task_set]);
@@ -339,7 +328,7 @@ void PixelBufferRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
// already been notified.
if (!should_notify_client_if_no_tasks_are_pending_[task_set])
return;
- raster_finished_tasks_pending_[task_set] = false;
+ task_set_finished_tasks_pending_[task_set] = false;
// This reduces latency between the time when all tasks required for
// activation have finished running and the time when the client is
@@ -347,7 +336,7 @@ void PixelBufferRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
CheckForCompletedRasterTasks();
}
-void PixelBufferRasterWorkerPool::FlushUploads() {
+void PixelBufferTileTaskWorkerPool::FlushUploads() {
if (!has_performed_uploads_since_last_flush_)
return;
@@ -355,20 +344,19 @@ void PixelBufferRasterWorkerPool::FlushUploads() {
has_performed_uploads_since_last_flush_ = false;
}
-void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
+void PixelBufferTileTaskWorkerPool::CheckForCompletedUploads() {
RasterTask::Vector tasks_with_completed_uploads;
// First check if any have completed.
while (!raster_tasks_with_pending_upload_.empty()) {
RasterTask* task = raster_tasks_with_pending_upload_.front().get();
- DCHECK(std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ DCHECK(std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task)) !=
raster_task_states_.end());
- DCHECK_EQ(RasterTaskState::UPLOADING,
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
- RasterTaskState::TaskComparator(task))->type);
+ DCHECK_EQ(
+ RasterTaskState::UPLOADING,
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
+ RasterTaskState::TaskComparator(task))->type);
// Uploads complete in the order they are issued.
if (!resource_provider_->DidSetPixelsComplete(task->resource()->id()))
@@ -390,8 +378,7 @@ void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
while (it != raster_tasks_with_pending_upload_.end()) {
RasterTask* task = it->get();
RasterTaskState::Vector::const_iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
DCHECK(state_it != raster_task_states_.end());
const RasterTaskState& state = *state_it;
@@ -413,8 +400,7 @@ void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
// all previous uploads, we would rather wait only once downstream.
for (RasterTask::Vector::reverse_iterator it =
tasks_with_uploads_to_force.rbegin();
- it != tasks_with_uploads_to_force.rend();
- ++it) {
+ it != tasks_with_uploads_to_force.rend(); ++it) {
RasterTask* task = it->get();
resource_provider_->ForceSetPixelsToComplete(task->resource()->id());
@@ -426,12 +412,10 @@ void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
// to |completed_raster_tasks_|.
for (RasterTask::Vector::const_iterator it =
tasks_with_completed_uploads.begin();
- it != tasks_with_completed_uploads.end();
- ++it) {
+ it != tasks_with_completed_uploads.end(); ++it) {
RasterTask* task = it->get();
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
DCHECK(state_it != raster_task_states_.end());
RasterTaskState& state = *state_it;
@@ -454,9 +438,9 @@ void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
}
}
-void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
+void PixelBufferTileTaskWorkerPool::CheckForCompletedRasterTasks() {
TRACE_EVENT0("cc",
- "PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks");
+ "PixelBufferTileTaskWorkerPool::CheckForCompletedRasterTasks");
// Since this function can be called directly, cancel any pending checks.
check_for_completed_raster_task_notifier_.Cancel();
@@ -470,7 +454,7 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
// Determine what client notifications to generate.
TaskSetCollection will_notify_client_that_no_tasks_are_pending =
should_notify_client_if_no_tasks_are_pending_ &
- ~raster_finished_tasks_pending_ & ~PendingTasks();
+ ~task_set_finished_tasks_pending_ & ~PendingTasks();
// Adjust the need to generate notifications before scheduling more tasks.
should_notify_client_if_no_tasks_are_pending_ &=
@@ -480,8 +464,8 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
if (PendingRasterTaskCount())
ScheduleMoreTasks();
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, StateName(), "state", StateAsValue());
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, StateName(),
+ "state", StateAsValue());
// Schedule another check for completed raster tasks while there are
// pending raster tasks or pending uploads.
@@ -495,17 +479,17 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterTasks() {
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
if (will_notify_client_that_no_tasks_are_pending[task_set]) {
DCHECK(!PendingTasks()[task_set]);
- client_->DidFinishRunningTasks(task_set);
+ client_->DidFinishRunningTileTasks(task_set);
}
}
}
-void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
- TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleMoreTasks");
+void PixelBufferTileTaskWorkerPool::ScheduleMoreTasks() {
+ TRACE_EVENT0("cc", "PixelBufferTileTaskWorkerPool::ScheduleMoreTasks");
RasterTaskVector tasks[kNumberOfTaskSets];
- unsigned priority = kRasterTaskPriorityBase;
+ unsigned priority = kTileTaskPriorityBase;
graph_.Reset();
@@ -513,19 +497,17 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
TaskSetCollection did_throttle_raster_tasks;
size_t scheduled_raster_task_count = 0;
- for (RasterTaskQueue::Item::Vector::const_iterator it =
+ for (TileTaskQueue::Item::Vector::const_iterator it =
raster_tasks_.items.begin();
- it != raster_tasks_.items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ it != raster_tasks_.items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
DCHECK(item.task_sets.any());
// |raster_task_states_| contains the state of all tasks that we have not
// yet run reply callbacks for.
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(task));
if (state_it == raster_task_states_.end())
continue;
@@ -581,36 +563,34 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
}
}
- // Cancel existing OnRasterFinished callbacks.
- raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
+ // Cancel existing OnTaskSetFinished callbacks.
+ task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- scoped_refptr<RasterizerTask> new_raster_finished_tasks[kNumberOfTaskSets];
+ scoped_refptr<TileTask> new_task_set_finished_tasks[kNumberOfTaskSets];
size_t scheduled_task_counts[kNumberOfTaskSets] = {0};
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
scheduled_task_counts[task_set] = tasks[task_set].container().size();
DCHECK_LE(scheduled_task_counts[task_set], task_counts_[task_set]);
- // Schedule OnRasterFinished call for task set only when notification is
+ // Schedule OnTaskSetFinished call for task set only when notification is
// pending and throttling is not preventing all pending tasks in the set
// from being scheduled.
if (!did_throttle_raster_tasks[task_set] &&
should_notify_client_if_no_tasks_are_pending_[task_set]) {
- new_raster_finished_tasks[task_set] = CreateRasterFinishedTask(
+ new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask(
task_runner_.get(),
- base::Bind(&PixelBufferRasterWorkerPool::OnRasterFinished,
- raster_finished_weak_ptr_factory_.GetWeakPtr(),
+ base::Bind(&PixelBufferTileTaskWorkerPool::OnTaskSetFinished,
+ task_set_finished_weak_ptr_factory_.GetWeakPtr(),
task_set));
- raster_finished_tasks_pending_[task_set] = true;
- InsertNodeForTask(&graph_,
- new_raster_finished_tasks[task_set].get(),
- kRasterFinishedTaskPriority,
+ task_set_finished_tasks_pending_[task_set] = true;
+ InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(),
+ kTaskSetFinishedTaskPriority,
scheduled_task_counts[task_set]);
for (RasterTaskVector::ContainerType::const_iterator it =
tasks[task_set].container().begin();
- it != tasks[task_set].container().end();
- ++it) {
+ it != tasks[task_set].container().end(); ++it) {
graph_.edges.push_back(
- TaskGraph::Edge(*it, new_raster_finished_tasks[task_set].get()));
+ TaskGraph::Edge(*it, new_task_set_finished_tasks[task_set].get()));
}
}
}
@@ -622,23 +602,23 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
scheduled_raster_task_count_ = scheduled_raster_task_count;
- std::copy(new_raster_finished_tasks,
- new_raster_finished_tasks + kNumberOfTaskSets,
- raster_finished_tasks_);
+ std::copy(new_task_set_finished_tasks,
+ new_task_set_finished_tasks + kNumberOfTaskSets,
+ task_set_finished_tasks_);
}
-unsigned PixelBufferRasterWorkerPool::PendingRasterTaskCount() const {
+unsigned PixelBufferTileTaskWorkerPool::PendingRasterTaskCount() const {
unsigned num_completed_raster_tasks =
raster_tasks_with_pending_upload_.size() + completed_raster_tasks_.size();
DCHECK_GE(raster_task_states_.size(), num_completed_raster_tasks);
return raster_task_states_.size() - num_completed_raster_tasks;
}
-TaskSetCollection PixelBufferRasterWorkerPool::PendingTasks() const {
+TaskSetCollection PixelBufferTileTaskWorkerPool::PendingTasks() const {
return NonEmptyTaskSetsFromTaskCounts(task_counts_);
}
-const char* PixelBufferRasterWorkerPool::StateName() const {
+const char* PixelBufferTileTaskWorkerPool::StateName() const {
if (scheduled_raster_task_count_)
return "rasterizing";
if (PendingRasterTaskCount())
@@ -649,16 +629,15 @@ const char* PixelBufferRasterWorkerPool::StateName() const {
return "finishing";
}
-void PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks() {
- TRACE_EVENT0("cc",
- "PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks");
+void PixelBufferTileTaskWorkerPool::CheckForCompletedRasterizerTasks() {
+ TRACE_EVENT0(
+ "cc", "PixelBufferTileTaskWorkerPool::CheckForCompletedRasterizerTasks");
task_graph_runner_->CollectCompletedTasks(namespace_token_,
&completed_tasks_);
for (Task::Vector::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end();
- ++it) {
- RasterizerTask* task = static_cast<RasterizerTask*>(it->get());
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
RasterTask* raster_task = task->AsRasterTask();
if (!raster_task) {
@@ -671,8 +650,7 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks() {
}
RasterTaskState::Vector::iterator state_it =
- std::find_if(raster_task_states_.begin(),
- raster_task_states_.end(),
+ std::find_if(raster_task_states_.begin(), raster_task_states_.end(),
RasterTaskState::TaskComparator(raster_task));
DCHECK(state_it != raster_task_states_.end());
@@ -689,10 +667,9 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks() {
raster_task->CompleteOnOriginThread(this);
raster_task->DidComplete();
- RasterTaskQueue::Item::Vector::const_iterator item_it =
- std::find_if(raster_tasks_.items.begin(),
- raster_tasks_.items.end(),
- RasterTaskQueue::Item::TaskComparator(raster_task));
+ TileTaskQueue::Item::Vector::const_iterator item_it =
+ std::find_if(raster_tasks_.items.begin(), raster_tasks_.items.end(),
+ TileTaskQueue::Item::TaskComparator(raster_task));
if (item_it != raster_tasks_.items.end()) {
state.type = RasterTaskState::UNSCHEDULED;
continue;
@@ -721,7 +698,7 @@ void PixelBufferRasterWorkerPool::CheckForCompletedRasterizerTasks() {
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
-PixelBufferRasterWorkerPool::StateAsValue() const {
+PixelBufferTileTaskWorkerPool::StateAsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
state->SetInteger("completed_count", completed_raster_tasks_.size());
@@ -737,7 +714,7 @@ PixelBufferRasterWorkerPool::StateAsValue() const {
return state;
}
-void PixelBufferRasterWorkerPool::ThrottleStateAsValueInto(
+void PixelBufferTileTaskWorkerPool::ThrottleStateAsValueInto(
base::debug::TracedValue* throttle_state) const {
throttle_state->SetInteger("bytes_available_for_upload",
max_bytes_pending_upload_ - bytes_pending_upload_);
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.h b/cc/resources/pixel_buffer_tile_task_worker_pool.h
index 7fb45ec..1135dc9 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.h
+++ b/cc/resources/pixel_buffer_tile_task_worker_pool.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_RESOURCES_PIXEL_BUFFER_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_PIXEL_BUFFER_RASTER_WORKER_POOL_H_
+#ifndef CC_RESOURCES_PIXEL_BUFFER_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_PIXEL_BUFFER_TILE_TASK_WORKER_POOL_H_
#include <deque>
#include <vector>
@@ -12,8 +12,8 @@
#include "base/values.h"
#include "cc/base/delayed_unique_notifier.h"
#include "cc/output/context_provider.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "cc/resources/rasterizer.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/tile_task_worker_pool.h"
namespace base {
namespace debug {
@@ -25,29 +25,29 @@ class TracedValue;
namespace cc {
class ResourceProvider;
-class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool,
- public Rasterizer,
- public RasterizerTaskClient {
+class CC_EXPORT PixelBufferTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
public:
- ~PixelBufferRasterWorkerPool() override;
+ ~PixelBufferTileTaskWorkerPool() override;
- static scoped_ptr<RasterWorkerPool> Create(
+ static scoped_ptr<TileTaskWorkerPool> Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
size_t max_transfer_buffer_usage_bytes);
- // Overridden from RasterWorkerPool:
- Rasterizer* AsRasterizer() override;
+ // Overridden from TileTaskWorkerPool:
+ TileTaskRunner* AsTileTaskRunner() override;
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override;
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override;
void Shutdown() override;
- void ScheduleTasks(RasterTaskQueue* queue) override;
+ void ScheduleTasks(TileTaskQueue* queue) override;
void CheckForCompletedTasks() override;
- // Overridden from RasterizerTaskClient:
+ // Overridden from TileTaskClient:
scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource) override;
void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
@@ -77,13 +77,13 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool,
typedef std::deque<scoped_refptr<RasterTask>> RasterTaskDeque;
- PixelBufferRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ContextProvider* context_provider,
- ResourceProvider* resource_provider,
- size_t max_transfer_buffer_usage_bytes);
+ PixelBufferTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ContextProvider* context_provider,
+ ResourceProvider* resource_provider,
+ size_t max_transfer_buffer_usage_bytes);
- void OnRasterFinished(TaskSet task_set);
+ void OnTaskSetFinished(TaskSet task_set);
void FlushUploads();
void CheckForCompletedUploads();
void CheckForCompletedRasterTasks();
@@ -99,17 +99,17 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool,
scoped_refptr<base::SequencedTaskRunner> task_runner_;
TaskGraphRunner* task_graph_runner_;
const NamespaceToken namespace_token_;
- RasterizerClient* client_;
+ TileTaskRunnerClient* client_;
ContextProvider* context_provider_;
ResourceProvider* resource_provider_;
bool shutdown_;
- RasterTaskQueue raster_tasks_;
+ TileTaskQueue raster_tasks_;
RasterTaskState::Vector raster_task_states_;
RasterTaskDeque raster_tasks_with_pending_upload_;
RasterTask::Vector completed_raster_tasks_;
- RasterizerTask::Vector completed_image_decode_tasks_;
+ TileTask::Vector completed_image_decode_tasks_;
size_t scheduled_raster_task_count_;
size_t task_counts_[kNumberOfTaskSets];
@@ -118,23 +118,23 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool,
bool has_performed_uploads_since_last_flush_;
TaskSetCollection should_notify_client_if_no_tasks_are_pending_;
- TaskSetCollection raster_finished_tasks_pending_;
+ TaskSetCollection task_set_finished_tasks_pending_;
DelayedUniqueNotifier check_for_completed_raster_task_notifier_;
- scoped_refptr<RasterizerTask> raster_finished_tasks_[kNumberOfTaskSets];
+ scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
// Task graph used when scheduling tasks and vector used to gather
// completed tasks.
TaskGraph graph_;
Task::Vector completed_tasks_;
- base::WeakPtrFactory<PixelBufferRasterWorkerPool>
- raster_finished_weak_ptr_factory_;
+ base::WeakPtrFactory<PixelBufferTileTaskWorkerPool>
+ task_set_finished_weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(PixelBufferRasterWorkerPool);
+ DISALLOW_COPY_AND_ASSIGN(PixelBufferTileTaskWorkerPool);
};
} // namespace cc
-#endif // CC_RESOURCES_PIXEL_BUFFER_RASTER_WORKER_POOL_H_
+#endif // CC_RESOURCES_PIXEL_BUFFER_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/resources/rasterizer.cc b/cc/resources/rasterizer.cc
deleted file mode 100644
index 4ce8987..0000000
--- a/cc/resources/rasterizer.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/resources/rasterizer.h"
-
-#include <algorithm>
-
-namespace cc {
-
-RasterizerTask::RasterizerTask() : did_schedule_(false), did_complete_(false) {}
-
-RasterizerTask::~RasterizerTask() {
- // Debugging CHECKs to help track down a use-after-free.
- CHECK(!did_schedule_);
- CHECK(!did_run_ || did_complete_);
-}
-
-ImageDecodeTask* RasterizerTask::AsImageDecodeTask() { return NULL; }
-
-RasterTask* RasterizerTask::AsRasterTask() { return NULL; }
-
-void RasterizerTask::WillSchedule() { DCHECK(!did_schedule_); }
-
-void RasterizerTask::DidSchedule() {
- did_schedule_ = true;
- did_complete_ = false;
-}
-
-bool RasterizerTask::HasBeenScheduled() const { return did_schedule_; }
-
-void RasterizerTask::WillComplete() { DCHECK(!did_complete_); }
-
-void RasterizerTask::DidComplete() {
- DCHECK(did_schedule_);
- DCHECK(!did_complete_);
- did_schedule_ = false;
- did_complete_ = true;
-}
-
-bool RasterizerTask::HasCompleted() const { return did_complete_; }
-
-ImageDecodeTask::ImageDecodeTask() {}
-
-ImageDecodeTask::~ImageDecodeTask() {}
-
-ImageDecodeTask* ImageDecodeTask::AsImageDecodeTask() { return this; }
-
-RasterTask::RasterTask(const Resource* resource,
- ImageDecodeTask::Vector* dependencies)
- : resource_(resource) {
- dependencies_.swap(*dependencies);
-}
-
-RasterTask::~RasterTask() {}
-
-RasterTask* RasterTask::AsRasterTask() { return this; }
-
-RasterTaskQueue::Item::Item(RasterTask* task,
- const TaskSetCollection& task_sets)
- : task(task), task_sets(task_sets) {
- DCHECK(task_sets.any());
-}
-
-RasterTaskQueue::Item::~Item() {}
-
-RasterTaskQueue::RasterTaskQueue() {
-}
-
-RasterTaskQueue::~RasterTaskQueue() {}
-
-void RasterTaskQueue::Swap(RasterTaskQueue* other) {
- items.swap(other->items);
-}
-
-void RasterTaskQueue::Reset() {
- items.clear();
-}
-
-} // namespace cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 66f95da..d38fa19 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -18,8 +18,8 @@
#include "cc/debug/traced_value.h"
#include "cc/layers/picture_layer_impl.h"
#include "cc/resources/raster_buffer.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/tile.h"
+#include "cc/resources/tile_task_runner.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace cc {
@@ -73,12 +73,12 @@ class RasterTaskImpl : public RasterTask {
Raster(raster_source_.get());
}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {
DCHECK(!raster_buffer_);
raster_buffer_ = client->AcquireBufferForRaster(resource());
}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {
+ void CompleteOnOriginThread(TileTaskClient* client) override {
client->ReleaseBufferForRaster(raster_buffer_.Pass());
}
void RunReplyOnOriginThread() override {
@@ -158,9 +158,9 @@ class ImageDecodeTaskImpl : public ImageDecodeTask {
pixel_ref_->unlockPixels();
}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {}
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {}
+ void CompleteOnOriginThread(TileTaskClient* client) override {}
void RunReplyOnOriginThread() override { reply_.Run(!HasFinishedRunning()); }
protected:
@@ -208,28 +208,25 @@ scoped_ptr<TileManager> TileManager::Create(
TileManagerClient* client,
base::SequencedTaskRunner* task_runner,
ResourcePool* resource_pool,
- Rasterizer* rasterizer,
+ TileTaskRunner* tile_task_runner,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
size_t scheduled_raster_task_limit) {
- return make_scoped_ptr(new TileManager(client,
- task_runner,
- resource_pool,
- rasterizer,
- rendering_stats_instrumentation,
- scheduled_raster_task_limit));
+ return make_scoped_ptr(new TileManager(
+ client, task_runner, resource_pool, tile_task_runner,
+ rendering_stats_instrumentation, scheduled_raster_task_limit));
}
TileManager::TileManager(
TileManagerClient* client,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
ResourcePool* resource_pool,
- Rasterizer* rasterizer,
+ TileTaskRunner* tile_task_runner,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
size_t scheduled_raster_task_limit)
: client_(client),
task_runner_(task_runner),
resource_pool_(resource_pool),
- rasterizer_(rasterizer),
+ tile_task_runner_(tile_task_runner),
scheduled_raster_task_limit_(scheduled_raster_task_limit),
all_tiles_that_need_to_be_rasterized_are_scheduled_(true),
rendering_stats_instrumentation_(rendering_stats_instrumentation),
@@ -244,7 +241,7 @@ TileManager::TileManager(
base::Bind(&TileManager::CheckIfReadyToDraw, base::Unretained(this))),
did_notify_ready_to_activate_(false),
did_notify_ready_to_draw_(false) {
- rasterizer_->SetClient(this);
+ tile_task_runner_->SetClient(this);
}
TileManager::~TileManager() {
@@ -252,14 +249,14 @@ TileManager::~TileManager() {
// our memory usage to drop to zero.
global_state_ = GlobalStateThatImpactsTilePriority();
- RasterTaskQueue empty;
- rasterizer_->ScheduleTasks(&empty);
+ TileTaskQueue empty;
+ tile_task_runner_->ScheduleTasks(&empty);
orphan_raster_tasks_.clear();
// This should finish all pending tasks and release any uninitialized
// resources.
- rasterizer_->Shutdown();
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->Shutdown();
+ tile_task_runner_->CheckForCompletedTasks();
FreeResourcesForReleasedTiles();
CleanUpReleasedTiles();
@@ -312,8 +309,8 @@ void TileManager::CleanUpReleasedTiles() {
}
}
-void TileManager::DidFinishRunningTasks(TaskSet task_set) {
- TRACE_EVENT1("cc", "TileManager::DidFinishRunningTasks", "task_set",
+void TileManager::DidFinishRunningTileTasks(TaskSet task_set) {
+ TRACE_EVENT1("cc", "TileManager::DidFinishRunningTileTasks", "task_set",
TaskSetName(task_set));
switch (task_set) {
@@ -328,7 +325,7 @@ void TileManager::DidFinishRunningTasks(TaskSet task_set) {
!memory_usage_above_limit)
return;
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->CheckForCompletedTasks();
did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
TileVector tiles_that_need_to_be_rasterized;
@@ -408,7 +405,7 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
// We need to call CheckForCompletedTasks() once in-between each call
// to ScheduleTasks() to prevent canceled tasks from being scheduled.
if (!did_check_for_completed_tasks_since_last_schedule_tasks_) {
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->CheckForCompletedTasks();
did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
}
@@ -418,7 +415,7 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
TileVector tiles_that_need_to_be_rasterized;
AssignGpuMemoryToTiles(&tiles_that_need_to_be_rasterized);
- // Schedule rasterizer tasks.
+ // Schedule tile tasks.
ScheduleTasks(tiles_that_need_to_be_rasterized);
did_notify_ready_to_activate_ = false;
@@ -440,7 +437,7 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
void TileManager::UpdateVisibleTiles() {
TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles");
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->CheckForCompletedTasks();
did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
TRACE_EVENT_INSTANT1(
@@ -698,7 +695,7 @@ void TileManager::ScheduleTasks(
task_sets.set(REQUIRED_FOR_DRAW);
task_sets.set(ALL);
raster_queue_.items.push_back(
- RasterTaskQueue::Item(mts.raster_task.get(), task_sets));
+ TileTaskQueue::Item(mts.raster_task.get(), task_sets));
}
// We must reduce the amount of unused resoruces before calling
@@ -708,7 +705,7 @@ void TileManager::ScheduleTasks(
// Schedule running of |raster_queue_|. This replaces any previously
// scheduled tasks and effectively cancels all tasks not present
// in |raster_queue_|.
- rasterizer_->ScheduleTasks(&raster_queue_);
+ tile_task_runner_->ScheduleTasks(&raster_queue_);
// It's now safe to clean up orphan tasks as raster worker pool is not
// allowed to keep around unreferenced raster tasks after ScheduleTasks() has
@@ -853,9 +850,10 @@ scoped_refptr<Tile> TileManager::CreateTile(RasterSource* raster_source,
return tile;
}
-void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) {
- rasterizer_ = rasterizer;
- rasterizer_->SetClient(this);
+void TileManager::SetTileTaskRunnerForTesting(
+ TileTaskRunner* tile_task_runner) {
+ tile_task_runner_ = tile_task_runner;
+ tile_task_runner_->SetClient(this);
}
bool TileManager::IsReadyToActivate() const {
@@ -884,7 +882,7 @@ bool TileManager::IsReadyToDraw() const {
void TileManager::CheckIfReadyToActivate() {
TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate");
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->CheckForCompletedTasks();
did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
if (did_notify_ready_to_activate_)
@@ -899,7 +897,7 @@ void TileManager::CheckIfReadyToActivate() {
void TileManager::CheckIfReadyToDraw() {
TRACE_EVENT0("cc", "TileManager::CheckIfReadyToDraw");
- rasterizer_->CheckForCompletedTasks();
+ tile_task_runner_->CheckForCompletedTasks();
did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
if (did_notify_ready_to_draw_)
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index 8d19520..e9156fd 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -22,9 +22,9 @@
#include "cc/resources/memory_history.h"
#include "cc/resources/raster_source.h"
#include "cc/resources/raster_tile_priority_queue.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/tile.h"
+#include "cc/resources/tile_task_runner.h"
namespace base {
namespace debug {
@@ -86,7 +86,7 @@ scoped_refptr<base::debug::ConvertableToTraceFormat>
// should no longer have any memory assigned to them. Tile objects are "owned"
// by layers; they automatically register with the manager when they are
// created, and unregister from the manager when they are deleted.
-class CC_EXPORT TileManager : public RasterizerClient,
+class CC_EXPORT TileManager : public TileTaskRunnerClient,
public RefCountedManager<Tile> {
public:
enum NamedTaskSet {
@@ -101,7 +101,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
TileManagerClient* client,
base::SequencedTaskRunner* task_runner,
ResourcePool* resource_pool,
- Rasterizer* rasterizer,
+ TileTaskRunner* tile_task_runner,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
size_t scheduled_raster_task_limit);
~TileManager() override;
@@ -146,7 +146,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
global_state_ = state;
}
- void SetRasterizerForTesting(Rasterizer* rasterizer);
+ void SetTileTaskRunnerForTesting(TileTaskRunner* tile_task_runner);
void FreeResourcesAndCleanUpReleasedTilesForTesting() {
FreeResourcesForReleasedTiles();
@@ -170,7 +170,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
TileManager(TileManagerClient* client,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
ResourcePool* resource_pool,
- Rasterizer* rasterizer,
+ TileTaskRunner* tile_task_runner,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
size_t scheduled_raster_task_limit);
@@ -181,8 +181,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
friend class Tile;
void Release(Tile* tile) override;
- // Overriden from RasterizerClient:
- void DidFinishRunningTasks(TaskSet task_set) override;
+ // Overriden from TileTaskRunnerClient:
+ void DidFinishRunningTileTasks(TaskSet task_set) override;
TaskSetCollection TasksThatShouldBeForcedToComplete() const override;
typedef std::vector<Tile*> TileVector;
@@ -245,7 +245,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
TileManagerClient* client_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
ResourcePool* resource_pool_;
- Rasterizer* rasterizer_;
+ TileTaskRunner* tile_task_runner_;
GlobalStateThatImpactsTilePriority global_state_;
size_t scheduled_raster_task_limit_;
@@ -275,7 +275,7 @@ class CC_EXPORT TileManager : public RasterizerClient,
ResourceFormat resource_format_;
// Queue used when scheduling raster tasks.
- RasterTaskQueue raster_queue_;
+ TileTaskQueue raster_queue_;
std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_;
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index 2204ab8..29e174d 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -34,16 +34,14 @@ static const int kTimeLimitMillis = 2000;
static const int kWarmupRuns = 5;
static const int kTimeCheckInterval = 10;
-class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
+class FakeTileTaskRunnerImpl : public TileTaskRunner, public TileTaskClient {
public:
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override {}
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override {}
void Shutdown() override {}
- void ScheduleTasks(RasterTaskQueue* queue) override {
- for (RasterTaskQueue::Item::Vector::const_iterator it =
- queue->items.begin();
- it != queue->items.end();
- ++it) {
+ void ScheduleTasks(TileTaskQueue* queue) override {
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
RasterTask* task = it->task;
task->WillSchedule();
@@ -68,7 +66,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
completed_tasks_.clear();
}
- // Overridden from RasterizerTaskClient:
+ // Overridden from TileTaskClient:
scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource) override {
return nullptr;
@@ -78,7 +76,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
private:
RasterTask::Vector completed_tasks_;
};
-base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer =
+base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner =
LAZY_INSTANCE_INITIALIZER;
class TileManagerPerfTest : public testing::Test {
@@ -118,7 +116,8 @@ class TileManagerPerfTest : public testing::Test {
virtual void InitializeRenderer() {
host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass());
- tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer());
+ tile_manager()->SetTileTaskRunnerForTesting(
+ g_fake_tile_task_runner.Pointer());
}
void SetupDefaultTrees(const gfx::Size& layer_bounds) {
diff --git a/cc/resources/tile_task_runner.cc b/cc/resources/tile_task_runner.cc
new file mode 100644
index 0000000..8775d32
--- /dev/null
+++ b/cc/resources/tile_task_runner.cc
@@ -0,0 +1,101 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/resources/tile_task_runner.h"
+
+#include <algorithm>
+
+namespace cc {
+
+TileTask::TileTask() : did_schedule_(false), did_complete_(false) {
+}
+
+TileTask::~TileTask() {
+ // Debugging CHECKs to help track down a use-after-free.
+ CHECK(!did_schedule_);
+ CHECK(!did_run_ || did_complete_);
+}
+
+ImageDecodeTask* TileTask::AsImageDecodeTask() {
+ return NULL;
+}
+
+RasterTask* TileTask::AsRasterTask() {
+ return NULL;
+}
+
+void TileTask::WillSchedule() {
+ DCHECK(!did_schedule_);
+}
+
+void TileTask::DidSchedule() {
+ did_schedule_ = true;
+ did_complete_ = false;
+}
+
+bool TileTask::HasBeenScheduled() const {
+ return did_schedule_;
+}
+
+void TileTask::WillComplete() {
+ DCHECK(!did_complete_);
+}
+
+void TileTask::DidComplete() {
+ DCHECK(did_schedule_);
+ DCHECK(!did_complete_);
+ did_schedule_ = false;
+ did_complete_ = true;
+}
+
+bool TileTask::HasCompleted() const {
+ return did_complete_;
+}
+
+ImageDecodeTask::ImageDecodeTask() {
+}
+
+ImageDecodeTask::~ImageDecodeTask() {
+}
+
+ImageDecodeTask* ImageDecodeTask::AsImageDecodeTask() {
+ return this;
+}
+
+RasterTask::RasterTask(const Resource* resource,
+ ImageDecodeTask::Vector* dependencies)
+ : resource_(resource) {
+ dependencies_.swap(*dependencies);
+}
+
+RasterTask::~RasterTask() {
+}
+
+RasterTask* RasterTask::AsRasterTask() {
+ return this;
+}
+
+TileTaskQueue::Item::Item(RasterTask* task, const TaskSetCollection& task_sets)
+ : task(task), task_sets(task_sets) {
+ DCHECK(task_sets.any());
+}
+
+TileTaskQueue::Item::~Item() {
+}
+
+TileTaskQueue::TileTaskQueue() {
+}
+
+TileTaskQueue::~TileTaskQueue() {
+}
+
+void TileTaskQueue::Swap(TileTaskQueue* other) {
+ items.swap(other->items);
+}
+
+void TileTaskQueue::Reset() {
+ items.clear();
+}
+
+} // namespace cc
diff --git a/cc/resources/rasterizer.h b/cc/resources/tile_task_runner.h
index db84c22..1de0f4f 100644
--- a/cc/resources/rasterizer.h
+++ b/cc/resources/tile_task_runner.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_RESOURCES_RASTERIZER_H_
-#define CC_RESOURCES_RASTERIZER_H_
+#ifndef CC_RESOURCES_TILE_TASK_RUNNER_H_
+#define CC_RESOURCES_TILE_TASK_RUNNER_H_
#include <bitset>
#include <vector>
@@ -18,22 +18,22 @@ class RasterTask;
class Resource;
class RasterBuffer;
-class CC_EXPORT RasterizerTaskClient {
+class CC_EXPORT TileTaskClient {
public:
virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource) = 0;
virtual void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) = 0;
protected:
- virtual ~RasterizerTaskClient() {}
+ virtual ~TileTaskClient() {}
};
-class CC_EXPORT RasterizerTask : public Task {
+class CC_EXPORT TileTask : public Task {
public:
- typedef std::vector<scoped_refptr<RasterizerTask>> Vector;
+ typedef std::vector<scoped_refptr<TileTask>> Vector;
- virtual void ScheduleOnOriginThread(RasterizerTaskClient* client) = 0;
- virtual void CompleteOnOriginThread(RasterizerTaskClient* client) = 0;
+ virtual void ScheduleOnOriginThread(TileTaskClient* client) = 0;
+ virtual void CompleteOnOriginThread(TileTaskClient* client) = 0;
virtual void RunReplyOnOriginThread() = 0;
// Type-checking downcast routines.
@@ -49,18 +49,18 @@ class CC_EXPORT RasterizerTask : public Task {
bool HasCompleted() const;
protected:
- RasterizerTask();
- ~RasterizerTask() override;
+ TileTask();
+ ~TileTask() override;
bool did_schedule_;
bool did_complete_;
};
-class CC_EXPORT ImageDecodeTask : public RasterizerTask {
+class CC_EXPORT ImageDecodeTask : public TileTask {
public:
typedef std::vector<scoped_refptr<ImageDecodeTask>> Vector;
- // Overridden from RasterizerTask:
+ // Overridden from TileTask:
ImageDecodeTask* AsImageDecodeTask() override;
protected:
@@ -68,11 +68,11 @@ class CC_EXPORT ImageDecodeTask : public RasterizerTask {
~ImageDecodeTask() override;
};
-class CC_EXPORT RasterTask : public RasterizerTask {
+class CC_EXPORT RasterTask : public TileTask {
public:
typedef std::vector<scoped_refptr<RasterTask>> Vector;
- // Overridden from RasterizerTask:
+ // Overridden from TileTask:
RasterTask* AsRasterTask() override;
const Resource* resource() const { return resource_; }
@@ -95,16 +95,16 @@ static const size_t kNumberOfTaskSets = 3;
typedef size_t TaskSet;
typedef std::bitset<kNumberOfTaskSets> TaskSetCollection;
-class CC_EXPORT RasterizerClient {
+class CC_EXPORT TileTaskRunnerClient {
public:
- virtual void DidFinishRunningTasks(TaskSet task_set) = 0;
+ virtual void DidFinishRunningTileTasks(TaskSet task_set) = 0;
virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const = 0;
protected:
- virtual ~RasterizerClient() {}
+ virtual ~TileTaskRunnerClient() {}
};
-struct CC_EXPORT RasterTaskQueue {
+struct CC_EXPORT TileTaskQueue {
struct CC_EXPORT Item {
class TaskComparator {
public:
@@ -125,44 +125,45 @@ struct CC_EXPORT RasterTaskQueue {
TaskSetCollection task_sets;
};
- RasterTaskQueue();
- ~RasterTaskQueue();
+ TileTaskQueue();
+ ~TileTaskQueue();
- void Swap(RasterTaskQueue* other);
+ void Swap(TileTaskQueue* other);
void Reset();
Item::Vector items;
};
-// This interface can be used to schedule and run raster tasks. The client will
+// This interface can be used to schedule and run tile tasks. The client will
// be notified asynchronously when the set of tasks marked as "required for
-// activation" have finished running and when all scheduled tasks have finished
-// running. The client can call CheckForCompletedTasks() at any time to dispatch
+// activation" have finished running, when tasks marked "required for draw"
+// have finished running, and when all scheduled tasks have finished running.
+// The client can call CheckForCompletedTasks() at any time to dispatch
// pending completion callbacks for all tasks that have finished running.
-class CC_EXPORT Rasterizer {
+class CC_EXPORT TileTaskRunner {
public:
// Set the client instance to be notified when finished running tasks.
- virtual void SetClient(RasterizerClient* client) = 0;
+ virtual void SetClient(TileTaskRunnerClient* client) = 0;
// Tells the worker pool to shutdown after canceling all previously scheduled
// tasks. Reply callbacks are still guaranteed to run when
// CheckForCompletedTasks() is called.
virtual void Shutdown() = 0;
- // Schedule running of raster tasks in |queue| and all dependencies.
+ // Schedule running of tile tasks in |queue| and all dependencies.
// Previously scheduled tasks that are not in |queue| will be canceled unless
// already running. Once scheduled, reply callbacks are guaranteed to run for
// all tasks even if they later get canceled by another call to
// ScheduleTasks().
- virtual void ScheduleTasks(RasterTaskQueue* queue) = 0;
+ virtual void ScheduleTasks(TileTaskQueue* queue) = 0;
// Check for completed tasks and dispatch reply callbacks.
virtual void CheckForCompletedTasks() = 0;
protected:
- virtual ~Rasterizer() {}
+ virtual ~TileTaskRunner() {}
};
} // namespace cc
-#endif // CC_RESOURCES_RASTERIZER_H_
+#endif // CC_RESOURCES_TILE_TASK_RUNNER_H_
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/tile_task_worker_pool.cc
index ca951f6..1c0d6b9 100644
--- a/cc/resources/raster_worker_pool.cc
+++ b/cc/resources/tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include <algorithm>
@@ -19,18 +19,17 @@
namespace cc {
namespace {
-class RasterTaskGraphRunner : public TaskGraphRunner,
- public base::DelegateSimpleThread::Delegate {
+class TileTaskGraphRunner : public TaskGraphRunner,
+ public base::DelegateSimpleThread::Delegate {
public:
- RasterTaskGraphRunner() {
- size_t num_threads = RasterWorkerPool::GetNumRasterThreads();
+ TileTaskGraphRunner() {
+ size_t num_threads = TileTaskWorkerPool::GetNumWorkerThreads();
while (workers_.size() < num_threads) {
scoped_ptr<base::DelegateSimpleThread> worker =
make_scoped_ptr(new base::DelegateSimpleThread(
- this,
- base::StringPrintf("CompositorRasterWorker%u",
- static_cast<unsigned>(workers_.size() + 1))
- .c_str()));
+ this, base::StringPrintf(
+ "CompositorTileWorker%u",
+ static_cast<unsigned>(workers_.size() + 1)).c_str()));
worker->Start();
#if defined(OS_ANDROID) || defined(OS_LINUX)
worker->SetThreadPriority(base::kThreadPriority_Background);
@@ -39,7 +38,7 @@ class RasterTaskGraphRunner : public TaskGraphRunner,
}
}
- ~RasterTaskGraphRunner() override { NOTREACHED(); }
+ ~TileTaskGraphRunner() override { NOTREACHED(); }
private:
// Overridden from base::DelegateSimpleThread::Delegate:
@@ -48,99 +47,100 @@ class RasterTaskGraphRunner : public TaskGraphRunner,
ScopedPtrDeque<base::DelegateSimpleThread> workers_;
};
-base::LazyInstance<RasterTaskGraphRunner>::Leaky g_task_graph_runner =
+base::LazyInstance<TileTaskGraphRunner>::Leaky g_task_graph_runner =
LAZY_INSTANCE_INITIALIZER;
-const int kDefaultNumRasterThreads = 1;
+const int kDefaultNumWorkerThreads = 1;
-int g_num_raster_threads = 0;
+int g_num_worker_threads = 0;
-class RasterFinishedTaskImpl : public RasterizerTask {
+class TaskSetFinishedTaskImpl : public TileTask {
public:
- explicit RasterFinishedTaskImpl(
+ explicit TaskSetFinishedTaskImpl(
base::SequencedTaskRunner* task_runner,
- const base::Closure& on_raster_finished_callback)
+ const base::Closure& on_task_set_finished_callback)
: task_runner_(task_runner),
- on_raster_finished_callback_(on_raster_finished_callback) {}
+ on_task_set_finished_callback_(on_task_set_finished_callback) {}
// Overridden from Task:
void RunOnWorkerThread() override {
- TRACE_EVENT0("cc", "RasterFinishedTaskImpl::RunOnWorkerThread");
- RasterFinished();
+ TRACE_EVENT0("cc", "TaskSetFinishedTaskImpl::RunOnWorkerThread");
+ TaskSetFinished();
}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {}
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {}
+ void CompleteOnOriginThread(TileTaskClient* client) override {}
void RunReplyOnOriginThread() override {}
protected:
- ~RasterFinishedTaskImpl() override {}
+ ~TaskSetFinishedTaskImpl() override {}
- void RasterFinished() {
- task_runner_->PostTask(FROM_HERE, on_raster_finished_callback_);
+ void TaskSetFinished() {
+ task_runner_->PostTask(FROM_HERE, on_task_set_finished_callback_);
}
private:
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- const base::Closure on_raster_finished_callback_;
+ const base::Closure on_task_set_finished_callback_;
- DISALLOW_COPY_AND_ASSIGN(RasterFinishedTaskImpl);
+ DISALLOW_COPY_AND_ASSIGN(TaskSetFinishedTaskImpl);
};
} // namespace
// This allows a micro benchmark system to run tasks with highest priority,
// since it should finish as quickly as possible.
-unsigned RasterWorkerPool::kBenchmarkRasterTaskPriority = 0u;
-// Task priorities that make sure raster finished tasks run before any
-// remaining raster tasks.
-unsigned RasterWorkerPool::kRasterFinishedTaskPriority = 1u;
-unsigned RasterWorkerPool::kRasterTaskPriorityBase = 2u;
+unsigned TileTaskWorkerPool::kBenchmarkTaskPriority = 0u;
+// Task priorities that make sure task set finished tasks run before any
+// other remaining tasks.
+unsigned TileTaskWorkerPool::kTaskSetFinishedTaskPriority = 1u;
+unsigned TileTaskWorkerPool::kTileTaskPriorityBase = 2u;
-RasterWorkerPool::RasterWorkerPool() {}
+TileTaskWorkerPool::TileTaskWorkerPool() {
+}
-RasterWorkerPool::~RasterWorkerPool() {}
+TileTaskWorkerPool::~TileTaskWorkerPool() {
+}
// static
-void RasterWorkerPool::SetNumRasterThreads(int num_threads) {
+void TileTaskWorkerPool::SetNumWorkerThreads(int num_threads) {
DCHECK_LT(0, num_threads);
- DCHECK_EQ(0, g_num_raster_threads);
+ DCHECK_EQ(0, g_num_worker_threads);
- g_num_raster_threads = num_threads;
+ g_num_worker_threads = num_threads;
}
// static
-int RasterWorkerPool::GetNumRasterThreads() {
- if (!g_num_raster_threads)
- g_num_raster_threads = kDefaultNumRasterThreads;
+int TileTaskWorkerPool::GetNumWorkerThreads() {
+ if (!g_num_worker_threads)
+ g_num_worker_threads = kDefaultNumWorkerThreads;
- return g_num_raster_threads;
+ return g_num_worker_threads;
}
// static
-TaskGraphRunner* RasterWorkerPool::GetTaskGraphRunner() {
+TaskGraphRunner* TileTaskWorkerPool::GetTaskGraphRunner() {
return g_task_graph_runner.Pointer();
}
// static
-scoped_refptr<RasterizerTask> RasterWorkerPool::CreateRasterFinishedTask(
+scoped_refptr<TileTask> TileTaskWorkerPool::CreateTaskSetFinishedTask(
base::SequencedTaskRunner* task_runner,
- const base::Closure& on_raster_finished_callback) {
+ const base::Closure& on_task_set_finished_callback) {
return make_scoped_refptr(
- new RasterFinishedTaskImpl(task_runner, on_raster_finished_callback));
+ new TaskSetFinishedTaskImpl(task_runner, on_task_set_finished_callback));
}
// static
-void RasterWorkerPool::ScheduleTasksOnOriginThread(RasterizerTaskClient* client,
- TaskGraph* graph) {
- TRACE_EVENT0("cc", "Rasterizer::ScheduleTasksOnOriginThread");
+void TileTaskWorkerPool::ScheduleTasksOnOriginThread(TileTaskClient* client,
+ TaskGraph* graph) {
+ TRACE_EVENT0("cc", "TileTaskWorkerPool::ScheduleTasksOnOriginThread");
for (TaskGraph::Node::Vector::iterator it = graph->nodes.begin();
- it != graph->nodes.end();
- ++it) {
+ it != graph->nodes.end(); ++it) {
TaskGraph::Node& node = *it;
- RasterizerTask* task = static_cast<RasterizerTask*>(node.task);
+ TileTask* task = static_cast<TileTask*>(node.task);
if (!task->HasBeenScheduled()) {
task->WillSchedule();
@@ -151,19 +151,18 @@ void RasterWorkerPool::ScheduleTasksOnOriginThread(RasterizerTaskClient* client,
}
// static
-void RasterWorkerPool::InsertNodeForTask(TaskGraph* graph,
- RasterizerTask* task,
- unsigned priority,
- size_t dependencies) {
- DCHECK(std::find_if(graph->nodes.begin(),
- graph->nodes.end(),
+void TileTaskWorkerPool::InsertNodeForTask(TaskGraph* graph,
+ TileTask* task,
+ unsigned priority,
+ size_t dependencies) {
+ DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(),
TaskGraph::Node::TaskComparator(task)) ==
graph->nodes.end());
graph->nodes.push_back(TaskGraph::Node(task, priority, dependencies));
}
// static
-void RasterWorkerPool::InsertNodesForRasterTask(
+void TileTaskWorkerPool::InsertNodesForRasterTask(
TaskGraph* graph,
RasterTask* raster_task,
const ImageDecodeTask::Vector& decode_tasks,
@@ -172,8 +171,7 @@ void RasterWorkerPool::InsertNodesForRasterTask(
// Insert image decode tasks.
for (ImageDecodeTask::Vector::const_iterator it = decode_tasks.begin();
- it != decode_tasks.end();
- ++it) {
+ it != decode_tasks.end(); ++it) {
ImageDecodeTask* decode_task = it->get();
// Skip if already decoded.
@@ -184,8 +182,7 @@ void RasterWorkerPool::InsertNodesForRasterTask(
// Add decode task if it doesn't already exists in graph.
TaskGraph::Node::Vector::iterator decode_it =
- std::find_if(graph->nodes.begin(),
- graph->nodes.end(),
+ std::find_if(graph->nodes.begin(), graph->nodes.end(),
TaskGraph::Node::TaskComparator(decode_task));
if (decode_it == graph->nodes.end())
InsertNodeForTask(graph, decode_task, priority, 0u);
@@ -214,13 +211,13 @@ static bool IsSupportedPlaybackToMemoryFormat(ResourceFormat format) {
}
// static
-void RasterWorkerPool::PlaybackToMemory(void* memory,
- ResourceFormat format,
- const gfx::Size& size,
- int stride,
- const RasterSource* raster_source,
- const gfx::Rect& rect,
- float scale) {
+void TileTaskWorkerPool::PlaybackToMemory(void* memory,
+ ResourceFormat format,
+ const gfx::Size& size,
+ int stride,
+ const RasterSource* raster_source,
+ const gfx::Rect& rect,
+ float scale) {
DCHECK(IsSupportedPlaybackToMemoryFormat(format)) << format;
// Uses kPremul_SkAlphaType since the result is not known to be opaque.
diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/tile_task_worker_pool.h
index 5259f83..0440655 100644
--- a/cc/resources/raster_worker_pool.h
+++ b/cc/resources/tile_task_worker_pool.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_RESOURCES_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_RASTER_WORKER_POOL_H_
+#ifndef CC_RESOURCES_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_TILE_TASK_WORKER_POOL_H_
-#include "cc/resources/rasterizer.h"
+#include "cc/resources/tile_task_runner.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -17,42 +17,42 @@ namespace cc {
class RasterSource;
class RenderingStatsInstrumentation;
-class CC_EXPORT RasterWorkerPool {
+class CC_EXPORT TileTaskWorkerPool {
public:
- static unsigned kBenchmarkRasterTaskPriority;
- static unsigned kRasterFinishedTaskPriority;
- static unsigned kRasterTaskPriorityBase;
+ static unsigned kBenchmarkTaskPriority;
+ static unsigned kTaskSetFinishedTaskPriority;
+ static unsigned kTileTaskPriorityBase;
- RasterWorkerPool();
- virtual ~RasterWorkerPool();
+ TileTaskWorkerPool();
+ virtual ~TileTaskWorkerPool();
// Set the number of threads to use for the global TaskGraphRunner instance.
// This can only be called once and must be called prior to
- // GetNumRasterThreads().
- static void SetNumRasterThreads(int num_threads);
+ // GetNumWorkerThreads().
+ static void SetNumWorkerThreads(int num_threads);
// Returns the number of threads used for the global TaskGraphRunner instance.
- static int GetNumRasterThreads();
+ static int GetNumWorkerThreads();
// Returns a pointer to the global TaskGraphRunner instance.
static TaskGraphRunner* GetTaskGraphRunner();
- // Utility function that can be used to create a "raster finished" task that
+ // Utility function that can be used to create a "Task set finished" task that
// posts |callback| to |task_runner| when run.
- static scoped_refptr<RasterizerTask> CreateRasterFinishedTask(
+ static scoped_refptr<TileTask> CreateTaskSetFinishedTask(
base::SequencedTaskRunner* task_runner,
const base::Closure& callback);
// Utility function that can be used to call ::ScheduleOnOriginThread() for
// each task in |graph|.
- static void ScheduleTasksOnOriginThread(RasterizerTaskClient* client,
+ static void ScheduleTasksOnOriginThread(TileTaskClient* client,
TaskGraph* graph);
// Utility function that can be used to build a task graph. Inserts a node
// that represents |task| in |graph|. See TaskGraph definition for valid
// |priority| values.
static void InsertNodeForTask(TaskGraph* graph,
- RasterizerTask* task,
+ TileTask* task,
unsigned priority,
size_t dependencies);
@@ -75,9 +75,9 @@ class CC_EXPORT RasterWorkerPool {
float scale);
// Type-checking downcast routine.
- virtual Rasterizer* AsRasterizer() = 0;
+ virtual TileTaskRunner* AsTileTaskRunner() = 0;
};
} // namespace cc
-#endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
+#endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/tile_task_worker_pool_perftest.cc
index d86155a..2c64029 100644
--- a/cc/resources/raster_worker_pool_perftest.cc
+++ b/cc/resources/tile_task_worker_pool_perftest.cc
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "cc/debug/lap_timer.h"
#include "cc/output/context_provider.h"
-#include "cc/resources/bitmap_raster_worker_pool.h"
-#include "cc/resources/gpu_raster_worker_pool.h"
-#include "cc/resources/one_copy_raster_worker_pool.h"
-#include "cc/resources/pixel_buffer_raster_worker_pool.h"
+#include "cc/resources/bitmap_tile_task_worker_pool.h"
+#include "cc/resources/gpu_tile_task_worker_pool.h"
+#include "cc/resources/one_copy_tile_task_worker_pool.h"
+#include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
#include "cc/resources/raster_buffer.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/scoped_resource.h"
-#include "cc/resources/zero_copy_raster_worker_pool.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/zero_copy_tile_task_worker_pool.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/test_context_support.h"
@@ -94,12 +94,12 @@ class PerfContextProvider : public ContextProvider {
TestContextSupport support_;
};
-enum RasterWorkerPoolType {
- RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER,
- RASTER_WORKER_POOL_TYPE_ZERO_COPY,
- RASTER_WORKER_POOL_TYPE_ONE_COPY,
- RASTER_WORKER_POOL_TYPE_GPU,
- RASTER_WORKER_POOL_TYPE_BITMAP
+enum TileTaskWorkerPoolType {
+ TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
+ TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_GPU,
+ TILE_TASK_WORKER_POOL_TYPE_BITMAP
};
static const int kTimeLimitMillis = 2000;
@@ -113,9 +113,9 @@ class PerfImageDecodeTaskImpl : public ImageDecodeTask {
// Overridden from Task:
void RunOnWorkerThread() override {}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {}
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {}
+ void CompleteOnOriginThread(TileTaskClient* client) override {}
void RunReplyOnOriginThread() override { Reset(); }
void Reset() {
@@ -139,11 +139,11 @@ class PerfRasterTaskImpl : public RasterTask {
// Overridden from Task:
void RunOnWorkerThread() override {}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {
raster_buffer_ = client->AcquireBufferForRaster(resource());
}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {
+ void CompleteOnOriginThread(TileTaskClient* client) override {
client->ReleaseBufferForRaster(raster_buffer_.Pass());
}
void RunReplyOnOriginThread() override { Reset(); }
@@ -163,13 +163,13 @@ class PerfRasterTaskImpl : public RasterTask {
DISALLOW_COPY_AND_ASSIGN(PerfRasterTaskImpl);
};
-class RasterWorkerPoolPerfTestBase {
+class TileTaskWorkerPoolPerfTestBase {
public:
typedef std::vector<scoped_refptr<RasterTask>> RasterTaskVector;
enum NamedTaskSet { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW };
- RasterWorkerPoolPerfTestBase()
+ TileTaskWorkerPoolPerfTestBase()
: context_provider_(make_scoped_refptr(new PerfContextProvider)),
task_runner_(new base::TestSimpleTaskRunner),
task_graph_runner_(new TaskGraphRunner),
@@ -191,8 +191,8 @@ class RasterWorkerPoolPerfTestBase {
for (unsigned i = 0; i < num_raster_tasks; ++i) {
scoped_ptr<ScopedResource> resource(
ScopedResource::Create(resource_provider_.get()));
- resource->Allocate(
- size, ResourceProvider::TextureHintImmutable, RGBA_8888);
+ resource->Allocate(size, ResourceProvider::TextureHintImmutable,
+ RGBA_8888);
ImageDecodeTask::Vector dependencies = image_decode_tasks;
raster_tasks->push_back(
@@ -200,15 +200,15 @@ class RasterWorkerPoolPerfTestBase {
}
}
- void BuildRasterTaskQueue(RasterTaskQueue* queue,
- const RasterTaskVector& raster_tasks) {
+ void BuildTileTaskQueue(TileTaskQueue* queue,
+ const RasterTaskVector& raster_tasks) {
for (size_t i = 0u; i < raster_tasks.size(); ++i) {
bool required_for_activation = (i % 2) == 0;
TaskSetCollection task_set_collection;
task_set_collection[ALL] = true;
task_set_collection[REQUIRED_FOR_ACTIVATION] = required_for_activation;
queue->items.push_back(
- RasterTaskQueue::Item(raster_tasks[i].get(), task_set_collection));
+ TileTaskQueue::Item(raster_tasks[i].get(), task_set_collection));
}
}
@@ -222,69 +222,61 @@ class RasterWorkerPoolPerfTestBase {
LapTimer timer_;
};
-class RasterWorkerPoolPerfTest
- : public RasterWorkerPoolPerfTestBase,
- public testing::TestWithParam<RasterWorkerPoolType>,
- public RasterizerClient {
+class TileTaskWorkerPoolPerfTest
+ : public TileTaskWorkerPoolPerfTestBase,
+ public testing::TestWithParam<TileTaskWorkerPoolType>,
+ public TileTaskRunnerClient {
public:
// Overridden from testing::Test:
void SetUp() override {
switch (GetParam()) {
- case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER:
+ case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ = PixelBufferRasterWorkerPool::Create(
- task_runner_.get(),
- task_graph_runner_.get(),
- context_provider_.get(),
- resource_provider_.get(),
+ tile_task_worker_pool_ = PixelBufferTileTaskWorkerPool::Create(
+ task_runner_.get(), task_graph_runner_.get(),
+ context_provider_.get(), resource_provider_.get(),
std::numeric_limits<size_t>::max());
break;
- case RASTER_WORKER_POOL_TYPE_ZERO_COPY:
+ case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ =
- ZeroCopyRasterWorkerPool::Create(task_runner_.get(),
- task_graph_runner_.get(),
- resource_provider_.get());
+ tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create(
+ task_runner_.get(), task_graph_runner_.get(),
+ resource_provider_.get());
break;
- case RASTER_WORKER_POOL_TYPE_ONE_COPY:
+ case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY:
Create3dOutputSurfaceAndResourceProvider();
- staging_resource_pool_ = ResourcePool::Create(
- resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
- raster_worker_pool_ =
- OneCopyRasterWorkerPool::Create(task_runner_.get(),
- task_graph_runner_.get(),
- context_provider_.get(),
- resource_provider_.get(),
- staging_resource_pool_.get());
+ staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(),
+ GL_TEXTURE_2D, RGBA_8888);
+ tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create(
+ task_runner_.get(), task_graph_runner_.get(),
+ context_provider_.get(), resource_provider_.get(),
+ staging_resource_pool_.get());
break;
- case RASTER_WORKER_POOL_TYPE_GPU:
+ case TILE_TASK_WORKER_POOL_TYPE_GPU:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ =
- GpuRasterWorkerPool::Create(task_runner_.get(),
- context_provider_.get(),
- resource_provider_.get(),
- false);
+ tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create(
+ task_runner_.get(), context_provider_.get(),
+ resource_provider_.get(), false);
break;
- case RASTER_WORKER_POOL_TYPE_BITMAP:
+ case TILE_TASK_WORKER_POOL_TYPE_BITMAP:
CreateSoftwareOutputSurfaceAndResourceProvider();
- raster_worker_pool_ =
- BitmapRasterWorkerPool::Create(task_runner_.get(),
- task_graph_runner_.get(),
- resource_provider_.get());
+ tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create(
+ task_runner_.get(), task_graph_runner_.get(),
+ resource_provider_.get());
break;
}
- DCHECK(raster_worker_pool_);
- raster_worker_pool_->AsRasterizer()->SetClient(this);
+ DCHECK(tile_task_worker_pool_);
+ tile_task_worker_pool_->AsTileTaskRunner()->SetClient(this);
}
void TearDown() override {
- raster_worker_pool_->AsRasterizer()->Shutdown();
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ tile_task_worker_pool_->AsTileTaskRunner()->Shutdown();
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
}
- // Overriden from RasterizerClient:
- void DidFinishRunningTasks(TaskSet task_set) override {
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ // Overriden from TileTaskRunnerClient:
+ void DidFinishRunningTileTasks(TaskSet task_set) override {
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
}
TaskSetCollection TasksThatShouldBeForcedToComplete() const override {
return TaskSetCollection();
@@ -304,27 +296,23 @@ class RasterWorkerPoolPerfTest
CreateRasterTasks(num_raster_tasks, image_decode_tasks, &raster_tasks);
// Avoid unnecessary heap allocations by reusing the same queue.
- RasterTaskQueue queue;
+ TileTaskQueue queue;
timer_.Reset();
do {
queue.Reset();
- BuildRasterTaskQueue(&queue, raster_tasks);
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&queue);
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ BuildTileTaskQueue(&queue, raster_tasks);
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&queue);
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
- RasterTaskQueue empty;
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&empty);
+ TileTaskQueue empty;
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&empty);
RunMessageLoopUntilAllTasksHaveCompleted();
- perf_test::PrintResult("schedule_tasks",
- TestModifierString(),
- test_name,
- timer_.LapsPerSecond(),
- "runs/s",
- true);
+ perf_test::PrintResult("schedule_tasks", TestModifierString(), test_name,
+ timer_.LapsPerSecond(), "runs/s", true);
}
void RunScheduleAlternateTasksTest(const std::string& test_name,
@@ -335,34 +323,30 @@ class RasterWorkerPoolPerfTest
RasterTaskVector raster_tasks[kNumVersions];
for (size_t i = 0; i < kNumVersions; ++i) {
CreateImageDecodeTasks(num_image_decode_tasks, &image_decode_tasks[i]);
- CreateRasterTasks(
- num_raster_tasks, image_decode_tasks[i], &raster_tasks[i]);
+ CreateRasterTasks(num_raster_tasks, image_decode_tasks[i],
+ &raster_tasks[i]);
}
// Avoid unnecessary heap allocations by reusing the same queue.
- RasterTaskQueue queue;
+ TileTaskQueue queue;
size_t count = 0;
timer_.Reset();
do {
queue.Reset();
- BuildRasterTaskQueue(&queue, raster_tasks[count % kNumVersions]);
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&queue);
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ BuildTileTaskQueue(&queue, raster_tasks[count % kNumVersions]);
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&queue);
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
++count;
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
- RasterTaskQueue empty;
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&empty);
+ TileTaskQueue empty;
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&empty);
RunMessageLoopUntilAllTasksHaveCompleted();
- perf_test::PrintResult("schedule_alternate_tasks",
- TestModifierString(),
- test_name,
- timer_.LapsPerSecond(),
- "runs/s",
- true);
+ perf_test::PrintResult("schedule_alternate_tasks", TestModifierString(),
+ test_name, timer_.LapsPerSecond(), "runs/s", true);
}
void RunScheduleAndExecuteTasksTest(const std::string& test_name,
@@ -374,79 +358,67 @@ class RasterWorkerPoolPerfTest
CreateRasterTasks(num_raster_tasks, image_decode_tasks, &raster_tasks);
// Avoid unnecessary heap allocations by reusing the same queue.
- RasterTaskQueue queue;
+ TileTaskQueue queue;
timer_.Reset();
do {
queue.Reset();
- BuildRasterTaskQueue(&queue, raster_tasks);
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&queue);
+ BuildTileTaskQueue(&queue, raster_tasks);
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&queue);
RunMessageLoopUntilAllTasksHaveCompleted();
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
- RasterTaskQueue empty;
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&empty);
+ TileTaskQueue empty;
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&empty);
RunMessageLoopUntilAllTasksHaveCompleted();
- perf_test::PrintResult("schedule_and_execute_tasks",
- TestModifierString(),
- test_name,
- timer_.LapsPerSecond(),
- "runs/s",
- true);
+ perf_test::PrintResult("schedule_and_execute_tasks", TestModifierString(),
+ test_name, timer_.LapsPerSecond(), "runs/s", true);
}
private:
void Create3dOutputSurfaceAndResourceProvider() {
output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(output_surface_.get(),
- NULL,
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL,
&gpu_memory_buffer_manager_,
- NULL,
- 0,
- false,
- 1).Pass();
+ NULL, 0, false, 1).Pass();
}
void CreateSoftwareOutputSurfaceAndResourceProvider() {
output_surface_ = FakeOutputSurface::CreateSoftware(
make_scoped_ptr(new SoftwareOutputDevice));
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(output_surface_.get(),
- &shared_bitmap_manager_,
- NULL,
- NULL,
- 0,
- false,
- 1).Pass();
+ resource_provider_ =
+ ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_,
+ NULL, NULL, 0, false, 1).Pass();
}
std::string TestModifierString() const {
switch (GetParam()) {
- case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER:
- return std::string("_pixel_raster_worker_pool");
- case RASTER_WORKER_POOL_TYPE_ZERO_COPY:
- return std::string("_zero_copy_raster_worker_pool");
- case RASTER_WORKER_POOL_TYPE_ONE_COPY:
- return std::string("_one_copy_raster_worker_pool");
- case RASTER_WORKER_POOL_TYPE_GPU:
- return std::string("_gpu_raster_worker_pool");
- case RASTER_WORKER_POOL_TYPE_BITMAP:
- return std::string("_bitmap_raster_worker_pool");
+ case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER:
+ return std::string("_pixel_tile_task_worker_pool");
+ case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY:
+ return std::string("_zero_copy_tile_task_worker_pool");
+ case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY:
+ return std::string("_one_copy_tile_task_worker_pool");
+ case TILE_TASK_WORKER_POOL_TYPE_GPU:
+ return std::string("_gpu_tile_task_worker_pool");
+ case TILE_TASK_WORKER_POOL_TYPE_BITMAP:
+ return std::string("_bitmap_tile_task_worker_pool");
}
NOTREACHED();
return std::string();
}
scoped_ptr<ResourcePool> staging_resource_pool_;
- scoped_ptr<RasterWorkerPool> raster_worker_pool_;
+ scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
TestSharedBitmapManager shared_bitmap_manager_;
};
-TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) {
+TEST_P(TileTaskWorkerPoolPerfTest, ScheduleTasks) {
RunScheduleTasksTest("1_0", 1, 0);
RunScheduleTasksTest("32_0", 32, 0);
RunScheduleTasksTest("1_1", 1, 1);
@@ -455,7 +427,7 @@ TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) {
RunScheduleTasksTest("32_4", 32, 4);
}
-TEST_P(RasterWorkerPoolPerfTest, ScheduleAlternateTasks) {
+TEST_P(TileTaskWorkerPoolPerfTest, ScheduleAlternateTasks) {
RunScheduleAlternateTasksTest("1_0", 1, 0);
RunScheduleAlternateTasksTest("32_0", 32, 0);
RunScheduleAlternateTasksTest("1_1", 1, 1);
@@ -464,7 +436,7 @@ TEST_P(RasterWorkerPoolPerfTest, ScheduleAlternateTasks) {
RunScheduleAlternateTasksTest("32_4", 32, 4);
}
-TEST_P(RasterWorkerPoolPerfTest, ScheduleAndExecuteTasks) {
+TEST_P(TileTaskWorkerPoolPerfTest, ScheduleAndExecuteTasks) {
RunScheduleAndExecuteTasksTest("1_0", 1, 0);
RunScheduleAndExecuteTasksTest("32_0", 32, 0);
RunScheduleAndExecuteTasksTest("1_1", 1, 1);
@@ -473,60 +445,57 @@ TEST_P(RasterWorkerPoolPerfTest, ScheduleAndExecuteTasks) {
RunScheduleAndExecuteTasksTest("32_4", 32, 4);
}
-INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests,
- RasterWorkerPoolPerfTest,
- ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER,
- RASTER_WORKER_POOL_TYPE_ZERO_COPY,
- RASTER_WORKER_POOL_TYPE_ONE_COPY,
- RASTER_WORKER_POOL_TYPE_GPU,
- RASTER_WORKER_POOL_TYPE_BITMAP));
-
-class RasterWorkerPoolCommonPerfTest : public RasterWorkerPoolPerfTestBase,
- public testing::Test {
+INSTANTIATE_TEST_CASE_P(
+ TileTaskWorkerPoolPerfTests,
+ TileTaskWorkerPoolPerfTest,
+ ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
+ TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_GPU,
+ TILE_TASK_WORKER_POOL_TYPE_BITMAP));
+
+class TileTaskWorkerPoolCommonPerfTest : public TileTaskWorkerPoolPerfTestBase,
+ public testing::Test {
public:
// Overridden from testing::Test:
void SetUp() override {
output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
resource_provider_ =
- ResourceProvider::Create(
- output_surface_.get(), NULL, NULL, NULL, 0, false, 1).Pass();
+ ResourceProvider::Create(output_surface_.get(), NULL, NULL, NULL, 0,
+ false, 1).Pass();
}
- void RunBuildRasterTaskQueueTest(const std::string& test_name,
- unsigned num_raster_tasks,
- unsigned num_image_decode_tasks) {
+ void RunBuildTileTaskQueueTest(const std::string& test_name,
+ unsigned num_raster_tasks,
+ unsigned num_image_decode_tasks) {
ImageDecodeTask::Vector image_decode_tasks;
RasterTaskVector raster_tasks;
CreateImageDecodeTasks(num_image_decode_tasks, &image_decode_tasks);
CreateRasterTasks(num_raster_tasks, image_decode_tasks, &raster_tasks);
// Avoid unnecessary heap allocations by reusing the same queue.
- RasterTaskQueue queue;
+ TileTaskQueue queue;
timer_.Reset();
do {
queue.Reset();
- BuildRasterTaskQueue(&queue, raster_tasks);
+ BuildTileTaskQueue(&queue, raster_tasks);
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
- perf_test::PrintResult("build_raster_task_queue",
- "",
- test_name,
- timer_.LapsPerSecond(),
- "runs/s",
- true);
+ perf_test::PrintResult("build_raster_task_queue", "", test_name,
+ timer_.LapsPerSecond(), "runs/s", true);
}
};
-TEST_F(RasterWorkerPoolCommonPerfTest, BuildRasterTaskQueue) {
- RunBuildRasterTaskQueueTest("1_0", 1, 0);
- RunBuildRasterTaskQueueTest("32_0", 32, 0);
- RunBuildRasterTaskQueueTest("1_1", 1, 1);
- RunBuildRasterTaskQueueTest("32_1", 32, 1);
- RunBuildRasterTaskQueueTest("1_4", 1, 4);
- RunBuildRasterTaskQueueTest("32_4", 32, 4);
+TEST_F(TileTaskWorkerPoolCommonPerfTest, BuildTileTaskQueue) {
+ RunBuildTileTaskQueueTest("1_0", 1, 0);
+ RunBuildTileTaskQueueTest("32_0", 32, 0);
+ RunBuildTileTaskQueueTest("1_1", 1, 1);
+ RunBuildTileTaskQueueTest("32_1", 32, 1);
+ RunBuildTileTaskQueueTest("1_4", 1, 4);
+ RunBuildTileTaskQueueTest("32_4", 32, 4);
}
} // namespace
diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/tile_task_worker_pool_unittest.cc
index 0518f64..02ca225 100644
--- a/cc/resources/raster_worker_pool_unittest.cc
+++ b/cc/resources/tile_task_worker_pool_unittest.cc
@@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include <limits>
#include <vector>
#include "base/cancelable_callback.h"
-#include "cc/resources/bitmap_raster_worker_pool.h"
-#include "cc/resources/gpu_raster_worker_pool.h"
-#include "cc/resources/one_copy_raster_worker_pool.h"
+#include "cc/resources/bitmap_tile_task_worker_pool.h"
+#include "cc/resources/gpu_tile_task_worker_pool.h"
+#include "cc/resources/one_copy_tile_task_worker_pool.h"
#include "cc/resources/picture_pile.h"
#include "cc/resources/picture_pile_impl.h"
-#include "cc/resources/pixel_buffer_raster_worker_pool.h"
+#include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
#include "cc/resources/raster_buffer.h"
-#include "cc/resources/rasterizer.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/scoped_resource.h"
-#include "cc/resources/zero_copy_raster_worker_pool.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/zero_copy_tile_task_worker_pool.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_picture_pile_impl.h"
@@ -36,12 +36,12 @@ const size_t kMaxTransferBufferUsageBytes = 10000U;
// buffer constant.
const size_t kLargeResourceDimension = 1000U;
-enum RasterWorkerPoolType {
- RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER,
- RASTER_WORKER_POOL_TYPE_ZERO_COPY,
- RASTER_WORKER_POOL_TYPE_ONE_COPY,
- RASTER_WORKER_POOL_TYPE_GPU,
- RASTER_WORKER_POOL_TYPE_BITMAP
+enum TileTaskWorkerPoolType {
+ TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
+ TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_GPU,
+ TILE_TASK_WORKER_POOL_TYPE_BITMAP
};
class TestRasterTaskImpl : public RasterTask {
@@ -62,11 +62,11 @@ class TestRasterTaskImpl : public RasterTask {
raster_buffer_->Playback(picture_pile_.get(), gfx::Rect(0, 0, 1, 1), 1.0);
}
- // Overridden from RasterizerTask:
- void ScheduleOnOriginThread(RasterizerTaskClient* client) override {
+ // Overridden from TileTask:
+ void ScheduleOnOriginThread(TileTaskClient* client) override {
raster_buffer_ = client->AcquireBufferForRaster(resource());
}
- void CompleteOnOriginThread(RasterizerTaskClient* client) override {
+ void CompleteOnOriginThread(TileTaskClient* client) override {
client->ReleaseBufferForRaster(raster_buffer_.Pass());
}
void RunReplyOnOriginThread() override {
@@ -98,7 +98,7 @@ class BlockingTestRasterTaskImpl : public TestRasterTaskImpl {
TestRasterTaskImpl::RunOnWorkerThread();
}
- // Overridden from RasterizerTask:
+ // Overridden from TileTask:
void RunReplyOnOriginThread() override {}
protected:
@@ -110,9 +110,9 @@ class BlockingTestRasterTaskImpl : public TestRasterTaskImpl {
DISALLOW_COPY_AND_ASSIGN(BlockingTestRasterTaskImpl);
};
-class RasterWorkerPoolTest
- : public testing::TestWithParam<RasterWorkerPoolType>,
- public RasterizerClient {
+class TileTaskWorkerPoolTest
+ : public testing::TestWithParam<TileTaskWorkerPoolType>,
+ public TileTaskRunnerClient {
public:
struct RasterTaskResult {
unsigned id;
@@ -123,7 +123,7 @@ class RasterWorkerPoolTest
enum NamedTaskSet { ALL, REQUIRED_FOR_ACTIVATION, REQUIRED_FOR_DRAW };
- RasterWorkerPoolTest()
+ TileTaskWorkerPoolTest()
: context_provider_(TestContextProvider::Create()),
timeout_seconds_(5),
timed_out_(false) {}
@@ -131,63 +131,55 @@ class RasterWorkerPoolTest
// Overridden from testing::Test:
void SetUp() override {
switch (GetParam()) {
- case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER:
+ case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ = PixelBufferRasterWorkerPool::Create(
+ tile_task_worker_pool_ = PixelBufferTileTaskWorkerPool::Create(
base::MessageLoopProxy::current().get(),
- RasterWorkerPool::GetTaskGraphRunner(),
- context_provider_.get(),
- resource_provider_.get(),
- kMaxTransferBufferUsageBytes);
+ TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(),
+ resource_provider_.get(), kMaxTransferBufferUsageBytes);
break;
- case RASTER_WORKER_POOL_TYPE_ZERO_COPY:
+ case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ = ZeroCopyRasterWorkerPool::Create(
+ tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create(
base::MessageLoopProxy::current().get(),
- RasterWorkerPool::GetTaskGraphRunner(),
- resource_provider_.get());
+ TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get());
break;
- case RASTER_WORKER_POOL_TYPE_ONE_COPY:
+ case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY:
Create3dOutputSurfaceAndResourceProvider();
- staging_resource_pool_ = ResourcePool::Create(
- resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
- raster_worker_pool_ = OneCopyRasterWorkerPool::Create(
+ staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(),
+ GL_TEXTURE_2D, RGBA_8888);
+ tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create(
base::MessageLoopProxy::current().get(),
- RasterWorkerPool::GetTaskGraphRunner(),
- context_provider_.get(),
- resource_provider_.get(),
- staging_resource_pool_.get());
+ TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(),
+ resource_provider_.get(), staging_resource_pool_.get());
break;
- case RASTER_WORKER_POOL_TYPE_GPU:
+ case TILE_TASK_WORKER_POOL_TYPE_GPU:
Create3dOutputSurfaceAndResourceProvider();
- raster_worker_pool_ =
- GpuRasterWorkerPool::Create(base::MessageLoopProxy::current().get(),
- context_provider_.get(),
- resource_provider_.get(),
- false);
+ tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create(
+ base::MessageLoopProxy::current().get(), context_provider_.get(),
+ resource_provider_.get(), false);
break;
- case RASTER_WORKER_POOL_TYPE_BITMAP:
+ case TILE_TASK_WORKER_POOL_TYPE_BITMAP:
CreateSoftwareOutputSurfaceAndResourceProvider();
- raster_worker_pool_ = BitmapRasterWorkerPool::Create(
+ tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create(
base::MessageLoopProxy::current().get(),
- RasterWorkerPool::GetTaskGraphRunner(),
- resource_provider_.get());
+ TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get());
break;
}
- DCHECK(raster_worker_pool_);
- raster_worker_pool_->AsRasterizer()->SetClient(this);
+ DCHECK(tile_task_worker_pool_);
+ tile_task_worker_pool_->AsTileTaskRunner()->SetClient(this);
}
void TearDown() override {
- raster_worker_pool_->AsRasterizer()->Shutdown();
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ tile_task_worker_pool_->AsTileTaskRunner()->Shutdown();
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
}
- // Overriden from RasterWorkerPoolClient:
- void DidFinishRunningTasks(TaskSet task_set) override {
+ // Overriden from TileTaskWorkerPoolClient:
+ void DidFinishRunningTileTasks(TaskSet task_set) override {
if (task_set == ALL) {
- raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
+ tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks();
base::MessageLoop::current()->Quit();
}
}
@@ -197,11 +189,10 @@ class RasterWorkerPoolTest
void RunMessageLoopUntilAllTasksHaveCompleted() {
if (timeout_seconds_) {
- timeout_.Reset(
- base::Bind(&RasterWorkerPoolTest::OnTimeout, base::Unretained(this)));
+ timeout_.Reset(base::Bind(&TileTaskWorkerPoolTest::OnTimeout,
+ base::Unretained(this)));
base::MessageLoopProxy::current()->PostDelayedTask(
- FROM_HERE,
- timeout_.callback(),
+ FROM_HERE, timeout_.callback(),
base::TimeDelta::FromSeconds(timeout_seconds_));
}
@@ -213,17 +204,16 @@ class RasterWorkerPoolTest
}
void ScheduleTasks() {
- RasterTaskQueue queue;
+ TileTaskQueue queue;
for (RasterTaskVector::const_iterator it = tasks_.begin();
- it != tasks_.end();
- ++it) {
+ it != tasks_.end(); ++it) {
TaskSetCollection task_sets;
task_sets[ALL] = true;
- queue.items.push_back(RasterTaskQueue::Item(it->get(), task_sets));
+ queue.items.push_back(TileTaskQueue::Item(it->get(), task_sets));
}
- raster_worker_pool_->AsRasterizer()->ScheduleTasks(&queue);
+ tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&queue);
}
void AppendTask(unsigned id, const gfx::Size& size) {
@@ -235,10 +225,8 @@ class RasterWorkerPoolTest
ImageDecodeTask::Vector empty;
tasks_.push_back(new TestRasterTaskImpl(
const_resource,
- base::Bind(&RasterWorkerPoolTest::OnTaskCompleted,
- base::Unretained(this),
- base::Passed(&resource),
- id),
+ base::Bind(&TileTaskWorkerPoolTest::OnTaskCompleted,
+ base::Unretained(this), base::Passed(&resource), id),
&empty));
}
@@ -255,12 +243,9 @@ class RasterWorkerPoolTest
ImageDecodeTask::Vector empty;
tasks_.push_back(new BlockingTestRasterTaskImpl(
const_resource,
- base::Bind(&RasterWorkerPoolTest::OnTaskCompleted,
- base::Unretained(this),
- base::Passed(&resource),
- id),
- lock,
- &empty));
+ base::Bind(&TileTaskWorkerPoolTest::OnTaskCompleted,
+ base::Unretained(this), base::Passed(&resource), id),
+ lock, &empty));
}
const std::vector<RasterTaskResult>& completed_tasks() const {
@@ -273,26 +258,18 @@ class RasterWorkerPoolTest
CHECK(output_surface_->BindToClient(&output_surface_client_));
TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d();
context3d->set_support_sync_query(true);
- resource_provider_ = ResourceProvider::Create(output_surface_.get(),
- NULL,
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL,
&gpu_memory_buffer_manager_,
- NULL,
- 0,
- false,
- 1).Pass();
+ NULL, 0, false, 1).Pass();
}
void CreateSoftwareOutputSurfaceAndResourceProvider() {
output_surface_ = FakeOutputSurface::CreateSoftware(
make_scoped_ptr(new SoftwareOutputDevice));
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(output_surface_.get(),
- &shared_bitmap_manager_,
- NULL,
- NULL,
- 0,
- false,
- 1).Pass();
+ resource_provider_ =
+ ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_,
+ NULL, NULL, 0, false, 1).Pass();
}
void OnTaskCompleted(scoped_ptr<ScopedResource> resource,
@@ -316,7 +293,7 @@ class RasterWorkerPoolTest
scoped_ptr<FakeOutputSurface> output_surface_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<ResourcePool> staging_resource_pool_;
- scoped_ptr<RasterWorkerPool> raster_worker_pool_;
+ scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
TestSharedBitmapManager shared_bitmap_manager_;
base::CancelableClosure timeout_;
@@ -326,7 +303,7 @@ class RasterWorkerPoolTest
std::vector<RasterTaskResult> completed_tasks_;
};
-TEST_P(RasterWorkerPoolTest, Basic) {
+TEST_P(TileTaskWorkerPoolTest, Basic) {
AppendTask(0u);
AppendTask(1u);
ScheduleTasks();
@@ -338,8 +315,8 @@ TEST_P(RasterWorkerPoolTest, Basic) {
EXPECT_FALSE(completed_tasks()[1].canceled);
}
-TEST_P(RasterWorkerPoolTest, FailedMapResource) {
- if (GetParam() == RASTER_WORKER_POOL_TYPE_BITMAP)
+TEST_P(TileTaskWorkerPoolTest, FailedMapResource) {
+ if (GetParam() == TILE_TASK_WORKER_POOL_TYPE_BITMAP)
return;
TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d();
@@ -354,8 +331,8 @@ TEST_P(RasterWorkerPoolTest, FailedMapResource) {
}
// This test checks that replacing a pending raster task with another does
-// not prevent the DidFinishRunningTasks notification from being sent.
-TEST_P(RasterWorkerPoolTest, FalseThrottling) {
+// not prevent the DidFinishRunningTileTasks notification from being sent.
+TEST_P(TileTaskWorkerPoolTest, FalseThrottling) {
base::Lock lock;
// Schedule a task that is prevented from completing with a lock.
@@ -365,7 +342,7 @@ TEST_P(RasterWorkerPoolTest, FalseThrottling) {
// Schedule another task to replace the still-pending task. Because the old
// task is not a throttled task in the new task set, it should not prevent
- // DidFinishRunningTasks from getting signaled.
+ // DidFinishRunningTileTasks from getting signaled.
RasterTaskVector tasks;
tasks.swap(tasks_);
AppendTask(1u);
@@ -377,7 +354,7 @@ TEST_P(RasterWorkerPoolTest, FalseThrottling) {
RunMessageLoopUntilAllTasksHaveCompleted();
}
-TEST_P(RasterWorkerPoolTest, LargeResources) {
+TEST_P(TileTaskWorkerPoolTest, LargeResources) {
gfx::Size size(kLargeResourceDimension, kLargeResourceDimension);
{
@@ -398,13 +375,14 @@ TEST_P(RasterWorkerPoolTest, LargeResources) {
RunMessageLoopUntilAllTasksHaveCompleted();
}
-INSTANTIATE_TEST_CASE_P(RasterWorkerPoolTests,
- RasterWorkerPoolTest,
- ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER,
- RASTER_WORKER_POOL_TYPE_ZERO_COPY,
- RASTER_WORKER_POOL_TYPE_ONE_COPY,
- RASTER_WORKER_POOL_TYPE_GPU,
- RASTER_WORKER_POOL_TYPE_BITMAP));
+INSTANTIATE_TEST_CASE_P(
+ TileTaskWorkerPoolTests,
+ TileTaskWorkerPoolTest,
+ ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
+ TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
+ TILE_TASK_WORKER_POOL_TYPE_GPU,
+ TILE_TASK_WORKER_POOL_TYPE_BITMAP));
} // namespace
} // namespace cc
diff --git a/cc/resources/zero_copy_raster_worker_pool.h b/cc/resources/zero_copy_raster_worker_pool.h
deleted file mode 100644
index d1f583e..0000000
--- a/cc/resources/zero_copy_raster_worker_pool.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_RESOURCES_ZERO_COPY_RASTER_WORKER_POOL_H_
-#define CC_RESOURCES_ZERO_COPY_RASTER_WORKER_POOL_H_
-
-#include "base/memory/weak_ptr.h"
-#include "base/values.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "cc/resources/rasterizer.h"
-
-namespace base {
-namespace debug {
-class ConvertableToTraceFormat;
-}
-}
-
-namespace cc {
-class ResourceProvider;
-
-class CC_EXPORT ZeroCopyRasterWorkerPool : public RasterWorkerPool,
- public Rasterizer,
- public RasterizerTaskClient {
- public:
- ~ZeroCopyRasterWorkerPool() override;
-
- static scoped_ptr<RasterWorkerPool> Create(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider);
-
- // Overridden from RasterWorkerPool:
- Rasterizer* AsRasterizer() override;
-
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override;
- void Shutdown() override;
- void ScheduleTasks(RasterTaskQueue* queue) override;
- void CheckForCompletedTasks() override;
-
- // Overridden from RasterizerTaskClient:
- scoped_ptr<RasterBuffer> AcquireBufferForRaster(
- const Resource* resource) override;
- void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
-
- protected:
- ZeroCopyRasterWorkerPool(base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
- ResourceProvider* resource_provider);
-
- private:
- void OnRasterFinished(TaskSet task_set);
- scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
-
- scoped_refptr<base::SequencedTaskRunner> task_runner_;
- TaskGraphRunner* task_graph_runner_;
- const NamespaceToken namespace_token_;
- RasterizerClient* client_;
- ResourceProvider* resource_provider_;
-
- TaskSetCollection raster_pending_;
-
- scoped_refptr<RasterizerTask> raster_finished_tasks_[kNumberOfTaskSets];
-
- // Task graph used when scheduling tasks and vector used to gather
- // completed tasks.
- TaskGraph graph_;
- Task::Vector completed_tasks_;
-
- base::WeakPtrFactory<ZeroCopyRasterWorkerPool>
- raster_finished_weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ZeroCopyRasterWorkerPool);
-};
-
-} // namespace cc
-
-#endif // CC_RESOURCES_ZERO_COPY_RASTER_WORKER_POOL_H_
diff --git a/cc/resources/zero_copy_raster_worker_pool.cc b/cc/resources/zero_copy_tile_task_worker_pool.cc
index ca2bc9b..6ef78f4 100644
--- a/cc/resources/zero_copy_raster_worker_pool.cc
+++ b/cc/resources/zero_copy_tile_task_worker_pool.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/resources/zero_copy_raster_worker_pool.h"
+#include "cc/resources/zero_copy_tile_task_worker_pool.h"
#include <algorithm>
@@ -31,7 +31,7 @@ class RasterBufferImpl : public RasterBuffer {
if (!gpu_memory_buffer)
return;
- RasterWorkerPool::PlaybackToMemory(
+ TileTaskWorkerPool::PlaybackToMemory(
gpu_memory_buffer->Map(), resource_->format(), resource_->size(),
gpu_memory_buffer->GetStride(), raster_source, rect, scale);
gpu_memory_buffer->Unmap();
@@ -47,15 +47,15 @@ class RasterBufferImpl : public RasterBuffer {
} // namespace
// static
-scoped_ptr<RasterWorkerPool> ZeroCopyRasterWorkerPool::Create(
+scoped_ptr<TileTaskWorkerPool> ZeroCopyTileTaskWorkerPool::Create(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ResourceProvider* resource_provider) {
- return make_scoped_ptr<RasterWorkerPool>(new ZeroCopyRasterWorkerPool(
+ return make_scoped_ptr<TileTaskWorkerPool>(new ZeroCopyTileTaskWorkerPool(
task_runner, task_graph_runner, resource_provider));
}
-ZeroCopyRasterWorkerPool::ZeroCopyRasterWorkerPool(
+ZeroCopyTileTaskWorkerPool::ZeroCopyTileTaskWorkerPool(
base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
ResourceProvider* resource_provider)
@@ -63,60 +63,58 @@ ZeroCopyRasterWorkerPool::ZeroCopyRasterWorkerPool(
task_graph_runner_(task_graph_runner),
namespace_token_(task_graph_runner->GetNamespaceToken()),
resource_provider_(resource_provider),
- raster_finished_weak_ptr_factory_(this) {
+ task_set_finished_weak_ptr_factory_(this) {
}
-ZeroCopyRasterWorkerPool::~ZeroCopyRasterWorkerPool() {
+ZeroCopyTileTaskWorkerPool::~ZeroCopyTileTaskWorkerPool() {
}
-Rasterizer* ZeroCopyRasterWorkerPool::AsRasterizer() {
+TileTaskRunner* ZeroCopyTileTaskWorkerPool::AsTileTaskRunner() {
return this;
}
-void ZeroCopyRasterWorkerPool::SetClient(RasterizerClient* client) {
+void ZeroCopyTileTaskWorkerPool::SetClient(TileTaskRunnerClient* client) {
client_ = client;
}
-void ZeroCopyRasterWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "ZeroCopyRasterWorkerPool::Shutdown");
+void ZeroCopyTileTaskWorkerPool::Shutdown() {
+ TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::Shutdown");
TaskGraph empty;
task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
}
-void ZeroCopyRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
- TRACE_EVENT0("cc", "ZeroCopyRasterWorkerPool::ScheduleTasks");
+void ZeroCopyTileTaskWorkerPool::ScheduleTasks(TileTaskQueue* queue) {
+ TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::ScheduleTasks");
- if (raster_pending_.none())
+ if (tasks_pending_.none())
TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this);
// Mark all task sets as pending.
- raster_pending_.set();
+ tasks_pending_.set();
- unsigned priority = kRasterTaskPriorityBase;
+ unsigned priority = kTileTaskPriorityBase;
graph_.Reset();
- // Cancel existing OnRasterFinished callbacks.
- raster_finished_weak_ptr_factory_.InvalidateWeakPtrs();
+ // Cancel existing OnTaskSetFinished callbacks.
+ task_set_finished_weak_ptr_factory_.InvalidateWeakPtrs();
- scoped_refptr<RasterizerTask> new_raster_finished_tasks[kNumberOfTaskSets];
+ scoped_refptr<TileTask> new_task_set_finished_tasks[kNumberOfTaskSets];
size_t task_count[kNumberOfTaskSets] = {0};
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- new_raster_finished_tasks[task_set] = CreateRasterFinishedTask(
+ new_task_set_finished_tasks[task_set] = CreateTaskSetFinishedTask(
task_runner_.get(),
- base::Bind(&ZeroCopyRasterWorkerPool::OnRasterFinished,
- raster_finished_weak_ptr_factory_.GetWeakPtr(),
- task_set));
+ base::Bind(&ZeroCopyTileTaskWorkerPool::OnTaskSetFinished,
+ task_set_finished_weak_ptr_factory_.GetWeakPtr(), task_set));
}
- for (RasterTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
- it != queue->items.end();
- ++it) {
- const RasterTaskQueue::Item& item = *it;
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
+ const TileTaskQueue::Item& item = *it;
RasterTask* task = item.task;
DCHECK(!task->HasCompleted());
@@ -127,39 +125,36 @@ void ZeroCopyRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) {
++task_count[task_set];
graph_.edges.push_back(
- TaskGraph::Edge(task, new_raster_finished_tasks[task_set].get()));
+ TaskGraph::Edge(task, new_task_set_finished_tasks[task_set].get()));
}
InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++);
}
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set) {
- InsertNodeForTask(&graph_,
- new_raster_finished_tasks[task_set].get(),
- kRasterFinishedTaskPriority,
- task_count[task_set]);
+ InsertNodeForTask(&graph_, new_task_set_finished_tasks[task_set].get(),
+ kTaskSetFinishedTaskPriority, task_count[task_set]);
}
ScheduleTasksOnOriginThread(this, &graph_);
task_graph_runner_->ScheduleTasks(namespace_token_, &graph_);
- std::copy(new_raster_finished_tasks,
- new_raster_finished_tasks + kNumberOfTaskSets,
- raster_finished_tasks_);
+ std::copy(new_task_set_finished_tasks,
+ new_task_set_finished_tasks + kNumberOfTaskSets,
+ task_set_finished_tasks_);
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state",
+ StateAsValue());
}
-void ZeroCopyRasterWorkerPool::CheckForCompletedTasks() {
- TRACE_EVENT0("cc", "ZeroCopyRasterWorkerPool::CheckForCompletedTasks");
+void ZeroCopyTileTaskWorkerPool::CheckForCompletedTasks() {
+ TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::CheckForCompletedTasks");
task_graph_runner_->CollectCompletedTasks(namespace_token_,
&completed_tasks_);
for (Task::Vector::const_iterator it = completed_tasks_.begin();
- it != completed_tasks_.end();
- ++it) {
- RasterizerTask* task = static_cast<RasterizerTask*>(it->get());
+ it != completed_tasks_.end(); ++it) {
+ TileTask* task = static_cast<TileTask*>(it->get());
task->WillComplete();
task->CompleteOnOriginThread(this);
@@ -170,40 +165,40 @@ void ZeroCopyRasterWorkerPool::CheckForCompletedTasks() {
completed_tasks_.clear();
}
-scoped_ptr<RasterBuffer> ZeroCopyRasterWorkerPool::AcquireBufferForRaster(
+scoped_ptr<RasterBuffer> ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster(
const Resource* resource) {
return make_scoped_ptr<RasterBuffer>(
new RasterBufferImpl(resource_provider_, resource));
}
-void ZeroCopyRasterWorkerPool::ReleaseBufferForRaster(
+void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster(
scoped_ptr<RasterBuffer> buffer) {
// Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-void ZeroCopyRasterWorkerPool::OnRasterFinished(TaskSet task_set) {
- TRACE_EVENT1(
- "cc", "ZeroCopyRasterWorkerPool::OnRasterFinished", "task_set", task_set);
+void ZeroCopyTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
+ TRACE_EVENT1("cc", "ZeroCopyTileTaskWorkerPool::OnTaskSetFinished",
+ "task_set", task_set);
- DCHECK(raster_pending_[task_set]);
- raster_pending_[task_set] = false;
- if (raster_pending_.any()) {
- TRACE_EVENT_ASYNC_STEP_INTO1(
- "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue());
+ DCHECK(tasks_pending_[task_set]);
+ tasks_pending_[task_set] = false;
+ if (tasks_pending_.any()) {
+ TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running",
+ "state", StateAsValue());
} else {
TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this);
}
- client_->DidFinishRunningTasks(task_set);
+ client_->DidFinishRunningTileTasks(task_set);
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
-ZeroCopyRasterWorkerPool::StateAsValue() const {
+ZeroCopyTileTaskWorkerPool::StateAsValue() const {
scoped_refptr<base::debug::TracedValue> state =
new base::debug::TracedValue();
state->BeginArray("tasks_pending");
for (TaskSet task_set = 0; task_set < kNumberOfTaskSets; ++task_set)
- state->AppendBoolean(raster_pending_[task_set]);
+ state->AppendBoolean(tasks_pending_[task_set]);
state->EndArray();
return state;
}
diff --git a/cc/resources/zero_copy_tile_task_worker_pool.h b/cc/resources/zero_copy_tile_task_worker_pool.h
new file mode 100644
index 0000000..9cc5ee9
--- /dev/null
+++ b/cc/resources/zero_copy_tile_task_worker_pool.h
@@ -0,0 +1,79 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_
+#define CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/values.h"
+#include "cc/resources/tile_task_runner.h"
+#include "cc/resources/tile_task_worker_pool.h"
+
+namespace base {
+namespace debug {
+class ConvertableToTraceFormat;
+}
+}
+
+namespace cc {
+class ResourceProvider;
+
+class CC_EXPORT ZeroCopyTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
+ public:
+ ~ZeroCopyTileTaskWorkerPool() override;
+
+ static scoped_ptr<TileTaskWorkerPool> Create(
+ base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ResourceProvider* resource_provider);
+
+ // Overridden from TileTaskWorkerPool:
+ TileTaskRunner* AsTileTaskRunner() override;
+
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override;
+ void Shutdown() override;
+ void ScheduleTasks(TileTaskQueue* queue) override;
+ void CheckForCompletedTasks() override;
+
+ // Overridden from TileTaskClient:
+ scoped_ptr<RasterBuffer> AcquireBufferForRaster(
+ const Resource* resource) override;
+ void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
+
+ protected:
+ ZeroCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
+ TaskGraphRunner* task_graph_runner,
+ ResourceProvider* resource_provider);
+
+ private:
+ void OnTaskSetFinished(TaskSet task_set);
+ scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
+
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ TaskGraphRunner* task_graph_runner_;
+ const NamespaceToken namespace_token_;
+ TileTaskRunnerClient* client_;
+ ResourceProvider* resource_provider_;
+
+ TaskSetCollection tasks_pending_;
+
+ scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
+
+ // Task graph used when scheduling tasks and vector used to gather
+ // completed tasks.
+ TaskGraph graph_;
+ Task::Vector completed_tasks_;
+
+ base::WeakPtrFactory<ZeroCopyTileTaskWorkerPool>
+ task_set_finished_weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ZeroCopyTileTaskWorkerPool);
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc
index 8aa343b..f85946a 100644
--- a/cc/test/fake_tile_manager.cc
+++ b/cc/test/fake_tile_manager.cc
@@ -9,22 +9,20 @@
#include "base/lazy_instance.h"
#include "cc/resources/raster_buffer.h"
-#include "cc/resources/rasterizer.h"
+#include "cc/resources/tile_task_runner.h"
namespace cc {
namespace {
-class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
+class FakeTileTaskRunnerImpl : public TileTaskRunner, public TileTaskClient {
public:
- // Overridden from Rasterizer:
- void SetClient(RasterizerClient* client) override {}
+ // Overridden from TileTaskRunner:
+ void SetClient(TileTaskRunnerClient* client) override {}
void Shutdown() override {}
- void ScheduleTasks(RasterTaskQueue* queue) override {
- for (RasterTaskQueue::Item::Vector::const_iterator it =
- queue->items.begin();
- it != queue->items.end();
- ++it) {
+ void ScheduleTasks(TileTaskQueue* queue) override {
+ for (TileTaskQueue::Item::Vector::const_iterator it = queue->items.begin();
+ it != queue->items.end(); ++it) {
RasterTask* task = it->task;
task->WillSchedule();
@@ -49,7 +47,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
completed_tasks_.clear();
}
- // Overridden from RasterizerTaskClient:
+ // Overridden from TileTaskClient:
scoped_ptr<RasterBuffer> AcquireBufferForRaster(
const Resource* resource) override {
return nullptr;
@@ -59,7 +57,7 @@ class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient {
private:
RasterTask::Vector completed_tasks_;
};
-base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer =
+base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner =
LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -68,7 +66,7 @@ FakeTileManager::FakeTileManager(TileManagerClient* client)
: TileManager(client,
base::MessageLoopProxy::current(),
NULL,
- g_fake_rasterizer.Pointer(),
+ g_fake_tile_task_runner.Pointer(),
NULL,
std::numeric_limits<size_t>::max()) {
}
@@ -78,7 +76,7 @@ FakeTileManager::FakeTileManager(TileManagerClient* client,
: TileManager(client,
base::MessageLoopProxy::current(),
resource_pool,
- g_fake_rasterizer.Pointer(),
+ g_fake_tile_task_runner.Pointer(),
NULL,
std::numeric_limits<size_t>::max()) {
}
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc
index 1839643..d5b5127 100644
--- a/cc/test/layer_tree_pixel_resource_test.cc
+++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -5,13 +5,13 @@
#include "cc/test/layer_tree_pixel_resource_test.h"
#include "cc/layers/layer.h"
-#include "cc/resources/bitmap_raster_worker_pool.h"
-#include "cc/resources/gpu_raster_worker_pool.h"
-#include "cc/resources/one_copy_raster_worker_pool.h"
-#include "cc/resources/pixel_buffer_raster_worker_pool.h"
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/bitmap_tile_task_worker_pool.h"
+#include "cc/resources/gpu_tile_task_worker_pool.h"
+#include "cc/resources/one_copy_tile_task_worker_pool.h"
+#include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
#include "cc/resources/resource_pool.h"
-#include "cc/resources/zero_copy_raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
+#include "cc/resources/zero_copy_tile_task_worker_pool.h"
#include "cc/test/fake_output_surface.h"
#include "gpu/GLES2/gl2extchromium.h"
@@ -46,7 +46,7 @@ LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest(
PixelResourceTestCase test_case)
: staging_texture_target_(GL_INVALID_VALUE),
draw_texture_target_(GL_INVALID_VALUE),
- resource_pool_option_(BITMAP_RASTER_WORKER_POOL),
+ resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL),
test_case_(test_case) {
InitializeFromTestCase(test_case);
}
@@ -58,63 +58,63 @@ void LayerTreeHostPixelResourceTest::InitializeFromTestCase(
test_type_ = PIXEL_TEST_SOFTWARE;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_INVALID_VALUE;
- resource_pool_option_ = BITMAP_RASTER_WORKER_POOL;
+ resource_pool_option_ = BITMAP_TILE_TASK_WORKER_POOL;
return;
case GL_GPU_RASTER_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = GPU_RASTER_WORKER_POOL;
+ resource_pool_option_ = GPU_TILE_TASK_WORKER_POOL;
return;
case GL_ONE_COPY_2D_STAGING_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_TEXTURE_2D;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = ONE_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ONE_COPY_RECT_STAGING_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_TEXTURE_RECTANGLE_ARB;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = ONE_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_TEXTURE_EXTERNAL_OES;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = ONE_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ZERO_COPY_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = ZERO_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ZERO_COPY_RECT_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_TEXTURE_RECTANGLE_ARB;
- resource_pool_option_ = ZERO_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ZERO_COPY_EXTERNAL_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_TEXTURE_EXTERNAL_OES;
- resource_pool_option_ = ZERO_COPY_RASTER_WORKER_POOL;
+ resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL;
return;
case GL_ASYNC_UPLOAD_2D_DRAW:
test_type_ = PIXEL_TEST_GL;
staging_texture_target_ = GL_INVALID_VALUE;
draw_texture_target_ = GL_TEXTURE_2D;
- resource_pool_option_ = PIXEL_BUFFER_RASTER_WORKER_POOL;
+ resource_pool_option_ = PIXEL_BUFFER_TILE_TASK_WORKER_POOL;
return;
}
NOTREACHED();
}
-void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
+void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool(
LayerTreeHostImpl* host_impl,
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool) {
base::SingleThreadTaskRunner* task_runner =
@@ -129,7 +129,7 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u;
switch (resource_pool_option_) {
- case BITMAP_RASTER_WORKER_POOL:
+ case BITMAP_TILE_TASK_WORKER_POOL:
EXPECT_FALSE(context_provider);
EXPECT_EQ(PIXEL_TEST_SOFTWARE, test_type_);
*resource_pool =
@@ -137,12 +137,11 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
draw_texture_target_,
resource_provider->best_texture_format());
- *raster_worker_pool =
- BitmapRasterWorkerPool::Create(task_runner,
- RasterWorkerPool::GetTaskGraphRunner(),
- resource_provider);
+ *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ resource_provider);
break;
- case GPU_RASTER_WORKER_POOL:
+ case GPU_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
EXPECT_EQ(PIXEL_TEST_GL, test_type_);
*resource_pool =
@@ -150,13 +149,11 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
draw_texture_target_,
resource_provider->best_texture_format());
- *raster_worker_pool =
- GpuRasterWorkerPool::Create(task_runner,
- context_provider,
- resource_provider,
- use_distance_field_text);
+ *tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
+ task_runner, context_provider, resource_provider,
+ use_distance_field_text);
break;
- case ZERO_COPY_RASTER_WORKER_POOL:
+ case ZERO_COPY_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
EXPECT_EQ(PIXEL_TEST_GL, test_type_);
EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image);
@@ -165,12 +162,11 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
draw_texture_target_,
resource_provider->best_texture_format());
- *raster_worker_pool = ZeroCopyRasterWorkerPool::Create(
- task_runner,
- RasterWorkerPool::GetTaskGraphRunner(),
+ *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
resource_provider);
break;
- case ONE_COPY_RASTER_WORKER_POOL:
+ case ONE_COPY_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
EXPECT_EQ(PIXEL_TEST_GL, test_type_);
EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image);
@@ -184,14 +180,11 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
draw_texture_target_,
resource_provider->best_texture_format());
- *raster_worker_pool = OneCopyRasterWorkerPool::Create(
- task_runner,
- RasterWorkerPool::GetTaskGraphRunner(),
- context_provider,
- resource_provider,
- staging_resource_pool->get());
+ *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ context_provider, resource_provider, staging_resource_pool->get());
break;
- case PIXEL_BUFFER_RASTER_WORKER_POOL:
+ case PIXEL_BUFFER_TILE_TASK_WORKER_POOL:
EXPECT_TRUE(context_provider);
EXPECT_EQ(PIXEL_TEST_GL, test_type_);
*resource_pool = ResourcePool::Create(
@@ -199,12 +192,9 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndRasterWorkerPool(
draw_texture_target_,
resource_provider->memory_efficient_texture_format());
- *raster_worker_pool = PixelBufferRasterWorkerPool::Create(
- task_runner,
- RasterWorkerPool::GetTaskGraphRunner(),
- context_provider,
- resource_provider,
- max_transfer_buffer_usage_bytes);
+ *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ context_provider, resource_provider, max_transfer_buffer_usage_bytes);
break;
}
}
diff --git a/cc/test/layer_tree_pixel_resource_test.h b/cc/test/layer_tree_pixel_resource_test.h
index da3da25..08900a2 100644
--- a/cc/test/layer_tree_pixel_resource_test.h
+++ b/cc/test/layer_tree_pixel_resource_test.h
@@ -11,7 +11,7 @@
namespace cc {
class LayerTreeHostImpl;
-class RasterWorkerPool;
+class TileTaskWorkerPool;
class ResourcePool;
// Enumerate the various combinations of renderer, resource pool, staging
@@ -34,27 +34,27 @@ class LayerTreeHostPixelResourceTest : public LayerTreePixelTest {
public:
explicit LayerTreeHostPixelResourceTest(PixelResourceTestCase test_case);
- void CreateResourceAndRasterWorkerPool(
+ void CreateResourceAndTileTaskWorkerPool(
LayerTreeHostImpl* host_impl,
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool) override;
void RunPixelResourceTest(scoped_refptr<Layer> content_root,
base::FilePath file_name);
- enum RasterWorkerPoolOption {
- BITMAP_RASTER_WORKER_POOL,
- GPU_RASTER_WORKER_POOL,
- ZERO_COPY_RASTER_WORKER_POOL,
- ONE_COPY_RASTER_WORKER_POOL,
- PIXEL_BUFFER_RASTER_WORKER_POOL,
+ enum TileTaskWorkerPoolOption {
+ BITMAP_TILE_TASK_WORKER_POOL,
+ GPU_TILE_TASK_WORKER_POOL,
+ ZERO_COPY_TILE_TASK_WORKER_POOL,
+ ONE_COPY_TILE_TASK_WORKER_POOL,
+ PIXEL_BUFFER_TILE_TASK_WORKER_POOL,
};
protected:
unsigned staging_texture_target_;
unsigned draw_texture_target_;
- RasterWorkerPoolOption resource_pool_option_;
+ TileTaskWorkerPoolOption resource_pool_option_;
private:
void InitializeFromTestCase(PixelResourceTestCase test_case);
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 5be1240..cf83fa7 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -45,13 +45,13 @@ DrawResult TestHooks::PrepareToDrawOnThread(
return draw_result;
}
-void TestHooks::CreateResourceAndRasterWorkerPool(
+void TestHooks::CreateResourceAndTileTaskWorkerPool(
LayerTreeHostImpl* host_impl,
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool) {
- host_impl->LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
- raster_worker_pool, resource_pool, staging_resource_pool);
+ host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
+ tile_task_worker_pool, resource_pool, staging_resource_pool);
}
class ExternalBeginFrameSourceForTest
@@ -211,12 +211,12 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
block_notify_ready_to_activate_for_testing_(false),
notify_ready_to_activate_was_blocked_(false) {}
- void CreateResourceAndRasterWorkerPool(
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ void CreateResourceAndTileTaskWorkerPool(
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool) override {
- test_hooks_->CreateResourceAndRasterWorkerPool(
- this, raster_worker_pool, resource_pool, staging_resource_pool);
+ test_hooks_->CreateResourceAndTileTaskWorkerPool(
+ this, tile_task_worker_pool, resource_pool, staging_resource_pool);
}
void WillBeginImplFrame(const BeginFrameArgs& args) override {
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 863100b..d52a0eb 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -35,9 +35,9 @@ class TestHooks : public AnimationDelegate {
void ReadSettings(const LayerTreeSettings& settings);
- virtual void CreateResourceAndRasterWorkerPool(
+ virtual void CreateResourceAndTileTaskWorkerPool(
LayerTreeHostImpl* host_impl,
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool);
virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 76966e9..aecd657 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -15,9 +15,9 @@
#include "cc/output/gl_renderer.h"
#include "cc/output/output_surface_client.h"
#include "cc/output/software_renderer.h"
-#include "cc/resources/raster_worker_pool.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/texture_mailbox_deleter.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/paths.h"
#include "cc/test/pixel_test_output_surface.h"
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index e19c9a2cc..2c3a808 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -47,20 +47,20 @@
#include "cc/quads/shared_quad_state.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
-#include "cc/resources/bitmap_raster_worker_pool.h"
+#include "cc/resources/bitmap_tile_task_worker_pool.h"
#include "cc/resources/eviction_tile_priority_queue.h"
-#include "cc/resources/gpu_raster_worker_pool.h"
+#include "cc/resources/gpu_tile_task_worker_pool.h"
#include "cc/resources/memory_history.h"
-#include "cc/resources/one_copy_raster_worker_pool.h"
+#include "cc/resources/one_copy_tile_task_worker_pool.h"
#include "cc/resources/picture_layer_tiling.h"
-#include "cc/resources/pixel_buffer_raster_worker_pool.h"
+#include "cc/resources/pixel_buffer_tile_task_worker_pool.h"
#include "cc/resources/prioritized_resource_manager.h"
#include "cc/resources/raster_tile_priority_queue.h"
-#include "cc/resources/raster_worker_pool.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/texture_mailbox_deleter.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "cc/resources/ui_resource_bitmap.h"
-#include "cc/resources/zero_copy_raster_worker_pool.h"
+#include "cc/resources/zero_copy_tile_task_worker_pool.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/trees/damage_tracker.h"
#include "cc/trees/layer_tree_host.h"
@@ -1950,9 +1950,9 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
DCHECK(output_surface_);
DCHECK(resource_provider_);
- CreateResourceAndRasterWorkerPool(
- &raster_worker_pool_, &resource_pool_, &staging_resource_pool_);
- DCHECK(raster_worker_pool_);
+ CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_,
+ &staging_resource_pool_);
+ DCHECK(tile_task_worker_pool_);
DCHECK(resource_pool_);
base::SingleThreadTaskRunner* task_runner =
@@ -1962,18 +1962,16 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
size_t scheduled_raster_task_limit =
IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max()
: settings_.scheduled_raster_task_limit;
- tile_manager_ = TileManager::Create(this,
- task_runner,
- resource_pool_.get(),
- raster_worker_pool_->AsRasterizer(),
- rendering_stats_instrumentation_,
- scheduled_raster_task_limit);
+ tile_manager_ = TileManager::Create(
+ this, task_runner, resource_pool_.get(),
+ tile_task_worker_pool_->AsTileTaskRunner(),
+ rendering_stats_instrumentation_, scheduled_raster_task_limit);
UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
}
-void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool) {
base::SingleThreadTaskRunner* task_runner =
@@ -1988,10 +1986,9 @@ void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
GL_TEXTURE_2D,
resource_provider_->best_texture_format());
- *raster_worker_pool =
- BitmapRasterWorkerPool::Create(task_runner,
- RasterWorkerPool::GetTaskGraphRunner(),
- resource_provider_.get());
+ *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ resource_provider_.get());
return;
}
@@ -2001,11 +1998,9 @@ void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
GL_TEXTURE_2D,
resource_provider_->best_texture_format());
- *raster_worker_pool =
- GpuRasterWorkerPool::Create(task_runner,
- context_provider,
- resource_provider_.get(),
- settings_.use_distance_field_text);
+ *tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
+ task_runner, context_provider, resource_provider_.get(),
+ settings_.use_distance_field_text);
return;
}
@@ -2029,10 +2024,10 @@ void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner);
task_graph_runner = single_thread_synchronous_task_graph_runner_.get();
} else {
- task_graph_runner = RasterWorkerPool::GetTaskGraphRunner();
+ task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner();
}
- *raster_worker_pool = ZeroCopyRasterWorkerPool::Create(
+ *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
task_runner, task_graph_runner, resource_provider_.get());
return;
}
@@ -2046,9 +2041,10 @@ void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D,
resource_provider_->best_texture_format());
- *raster_worker_pool = OneCopyRasterWorkerPool::Create(
- task_runner, RasterWorkerPool::GetTaskGraphRunner(), context_provider,
- resource_provider_.get(), staging_resource_pool_.get());
+ *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
+ context_provider, resource_provider_.get(),
+ staging_resource_pool_.get());
return;
}
}
@@ -2057,8 +2053,8 @@ void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
resource_provider_.get(), GL_TEXTURE_2D,
resource_provider_->memory_efficient_texture_format());
- *raster_worker_pool = PixelBufferRasterWorkerPool::Create(
- task_runner, RasterWorkerPool::GetTaskGraphRunner(), context_provider,
+ *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
+ task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider,
resource_provider_.get(),
GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(),
settings_.renderer_settings.refresh_rate));
@@ -2068,7 +2064,7 @@ void LayerTreeHostImpl::DestroyTileManager() {
tile_manager_ = nullptr;
resource_pool_ = nullptr;
staging_resource_pool_ = nullptr;
- raster_worker_pool_ = nullptr;
+ tile_task_worker_pool_ = nullptr;
single_thread_synchronous_task_graph_runner_ = nullptr;
}
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 1702e09..323c024 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -51,7 +51,7 @@ class PageScaleAnimation;
class PaintTimeCounter;
class PictureLayerImpl;
class RasterTilePriorityQueue;
-class RasterWorkerPool;
+class TileTaskWorkerPool;
class RenderPassDrawQuad;
class RenderingStatsInstrumentation;
class ResourcePool;
@@ -499,8 +499,8 @@ class CC_EXPORT LayerTreeHostImpl
// Only valid for synchronous (non-scheduled) single-threaded case.
void SynchronouslyInitializeAllTiles();
- virtual void CreateResourceAndRasterWorkerPool(
- scoped_ptr<RasterWorkerPool>* raster_worker_pool,
+ virtual void CreateResourceAndTileTaskWorkerPool(
+ scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
scoped_ptr<ResourcePool>* resource_pool,
scoped_ptr<ResourcePool>* staging_resource_pool);
@@ -610,7 +610,7 @@ class CC_EXPORT LayerTreeHostImpl
scoped_ptr<TileManager> tile_manager_;
bool use_gpu_rasterization_;
GpuRasterizationStatus gpu_rasterization_status_;
- scoped_ptr<RasterWorkerPool> raster_worker_pool_;
+ scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
scoped_ptr<ResourcePool> resource_pool_;
scoped_ptr<ResourcePool> staging_resource_pool_;
scoped_ptr<Renderer> renderer_;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index e465c6a..74c5b18 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -33,7 +33,7 @@
#include "cc/base/switches.h"
#include "cc/blink/web_external_bitmap_impl.h"
#include "cc/blink/web_layer_impl.h"
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/tile_task_worker_pool.h"
#include "content/child/appcache/appcache_dispatcher.h"
#include "content/child/appcache/appcache_frontend_impl.h"
#include "content/child/child_discardable_shared_memory_manager.h"
@@ -605,7 +605,7 @@ void RenderThreadImpl::Init() {
base::StringToInt(string_value, &num_raster_threads);
DCHECK(parsed_num_raster_threads) << string_value;
DCHECK_GT(num_raster_threads, 0);
- cc::RasterWorkerPool::SetNumRasterThreads(num_raster_threads);
+ cc::TileTaskWorkerPool::SetNumWorkerThreads(num_raster_threads);
}
base::DiscardableMemoryShmemAllocator::SetInstance(