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

Unified Diff: cc/resources/pixel_buffer_raster_worker_pool.cc

Issue 154003006: cc: Switch to vector based TaskGraph implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/pixel_buffer_raster_worker_pool.cc
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index 2ef6c83bf78f26dd1e7f1dce04d824c352cb6b1e..82888abc7c11dd77ca6beecd1cb246f161501366 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -9,11 +9,6 @@
#include "base/values.h"
#include "cc/debug/traced_value.h"
#include "cc/resources/resource.h"
-#include "third_party/skia/include/core/SkBitmapDevice.h"
-
-#if defined(OS_ANDROID)
-#include "base/android/sys_utils.h"
-#endif
namespace cc {
namespace {
@@ -22,20 +17,8 @@ const int kCheckForCompletedRasterTasksDelayMs = 6;
const size_t kMaxScheduledRasterTasks = 48;
-typedef base::StackVector<internal::GraphNode*, kMaxScheduledRasterTasks>
- NodeVector;
-
-void AddDependenciesToGraphNode(internal::GraphNode* node,
- const NodeVector::ContainerType& dependencies) {
- for (NodeVector::ContainerType::const_iterator it = dependencies.begin();
- it != dependencies.end();
- ++it) {
- internal::GraphNode* dependency = *it;
-
- node->add_dependency();
- dependency->add_dependent(node);
- }
-}
+typedef base::StackVector<internal::WorkerPoolTask*, kMaxScheduledRasterTasks>
+ WorkerPoolTaskVector;
// Only used as std::find_if predicate for DCHECKs.
bool WasCanceled(const internal::RasterWorkerPoolTask* task) {
@@ -491,9 +474,10 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
REQUIRED_FOR_ACTIVATION_TYPE = 1,
NUM_TYPES = 2
};
- NodeVector tasks[NUM_TYPES];
+ WorkerPoolTaskVector tasks[NUM_TYPES];
+
unsigned priority = 2u; // 0-1 reserved for RasterFinished tasks.
- TaskGraph graph;
+ internal::TaskGraph graph;
size_t bytes_pending_upload = bytes_pending_upload_;
bool did_throttle_raster_tasks = false;
@@ -552,8 +536,9 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
DCHECK(state_it->second == UNSCHEDULED || state_it->second == SCHEDULED);
state_it->second = SCHEDULED;
- tasks[type].container().push_back(CreateGraphNodeForRasterTask(
- task, task->dependencies(), priority++, &graph));
+ InsertNodeForRasterTask(&graph, task, task->dependencies(), priority++);
+
+ tasks[type].container().push_back(task);
}
scoped_refptr<internal::WorkerPoolTask>
@@ -573,13 +558,17 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
CreateRasterRequiredForActivationFinishedTask(
raster_tasks_required_for_activation_.size());
raster_required_for_activation_finished_task_pending_ = true;
- internal::GraphNode* raster_required_for_activation_finished_node =
- CreateGraphNodeForTask(
- new_raster_required_for_activation_finished_task.get(),
- 0u, // Priority 0
- &graph);
- AddDependenciesToGraphNode(raster_required_for_activation_finished_node,
- tasks[REQUIRED_FOR_ACTIVATION_TYPE].container());
+ InsertNodeForTask(&graph,
+ new_raster_required_for_activation_finished_task.get(),
+ 0u, // Priority 0
+ scheduled_raster_task_required_for_activation_count);
+ for (WorkerPoolTaskVector::ContainerType::const_iterator it =
+ tasks[REQUIRED_FOR_ACTIVATION_TYPE].container().begin();
+ it != tasks[REQUIRED_FOR_ACTIVATION_TYPE].container().end();
+ ++it) {
+ graph.edges.push_back(internal::TaskGraph::Edge(
+ *it, new_raster_required_for_activation_finished_task.get()));
+ }
}
scoped_refptr<internal::WorkerPoolTask> new_raster_finished_task;
@@ -594,12 +583,23 @@ void PixelBufferRasterWorkerPool::ScheduleMoreTasks() {
should_notify_client_if_no_tasks_are_pending_) {
new_raster_finished_task = CreateRasterFinishedTask();
raster_finished_task_pending_ = true;
- internal::GraphNode* raster_finished_node =
- CreateGraphNodeForTask(new_raster_finished_task.get(),
- 1u, // Priority 1
- &graph);
- for (unsigned type = 0; type < NUM_TYPES; ++type) {
- AddDependenciesToGraphNode(raster_finished_node, tasks[type].container());
+ InsertNodeForTask(&graph,
+ new_raster_finished_task.get(),
+ 1u, // Priority 1
+ scheduled_raster_task_count);
+ for (WorkerPoolTaskVector::ContainerType::const_iterator it =
+ tasks[REQUIRED_FOR_ACTIVATION_TYPE].container().begin();
+ it != tasks[REQUIRED_FOR_ACTIVATION_TYPE].container().end();
+ ++it) {
+ graph.edges.push_back(
+ internal::TaskGraph::Edge(*it, new_raster_finished_task.get()));
+ }
+ for (WorkerPoolTaskVector::ContainerType::const_iterator it =
+ tasks[PREPAINT_TYPE].container().begin();
+ it != tasks[PREPAINT_TYPE].container().end();
+ ++it) {
+ graph.edges.push_back(
+ internal::TaskGraph::Edge(*it, new_raster_finished_task.get()));
}
}

Powered by Google App Engine
This is Rietveld 408576698