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

Unified Diff: cc/raster/zero_copy_raster_buffer_provider.cc

Issue 1910213005: cc: Refactor TileTaskWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_states
Patch Set: feedback Created 4 years, 8 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
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.h ('k') | cc/raster/zero_copy_tile_task_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/zero_copy_raster_buffer_provider.cc
diff --git a/cc/raster/zero_copy_tile_task_worker_pool.cc b/cc/raster/zero_copy_raster_buffer_provider.cc
similarity index 55%
rename from cc/raster/zero_copy_tile_task_worker_pool.cc
rename to cc/raster/zero_copy_raster_buffer_provider.cc
index e423450baf3e1ddc8cb21211a899b0263429837d..93e8d7e13f07440d2bb6982b62466a5f0cc436d4 100644
--- a/cc/raster/zero_copy_tile_task_worker_pool.cc
+++ b/cc/raster/zero_copy_raster_buffer_provider.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/raster/zero_copy_tile_task_worker_pool.h"
+#include "cc/raster/zero_copy_raster_buffer_provider.h"
#include <stdint.h>
@@ -44,11 +44,11 @@ class RasterBufferImpl : public RasterBuffer {
bool rv = buffer->Map();
DCHECK(rv);
DCHECK(buffer->memory(0));
- // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides.
+ // RasterBufferProvider::PlaybackToMemory only supports unsigned strides.
DCHECK_GE(buffer->stride(0), 0);
// TODO(danakj): Implement partial raster with raster_dirty_rect.
- TileTaskWorkerPool::PlaybackToMemory(
+ RasterBufferProvider::PlaybackToMemory(
buffer->memory(0), resource_->format(), resource_->size(),
buffer->stride(0), raster_source, raster_full_rect, raster_full_rect,
scale, playback_settings);
@@ -65,62 +65,41 @@ class RasterBufferImpl : public RasterBuffer {
} // namespace
// static
-std::unique_ptr<TileTaskWorkerPool> ZeroCopyTileTaskWorkerPool::Create(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
+std::unique_ptr<RasterBufferProvider> ZeroCopyRasterBufferProvider::Create(
ResourceProvider* resource_provider,
ResourceFormat preferred_tile_format) {
- return base::WrapUnique<TileTaskWorkerPool>(
- new ZeroCopyTileTaskWorkerPool(task_runner, task_graph_runner,
- resource_provider, preferred_tile_format));
+ return base::WrapUnique<RasterBufferProvider>(
+ new ZeroCopyRasterBufferProvider(resource_provider,
+ preferred_tile_format));
}
-ZeroCopyTileTaskWorkerPool::ZeroCopyTileTaskWorkerPool(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
+ZeroCopyRasterBufferProvider::ZeroCopyRasterBufferProvider(
ResourceProvider* resource_provider,
ResourceFormat preferred_tile_format)
- : task_runner_(task_runner),
- task_graph_runner_(task_graph_runner),
- namespace_token_(task_graph_runner->GetNamespaceToken()),
- resource_provider_(resource_provider),
+ : resource_provider_(resource_provider),
preferred_tile_format_(preferred_tile_format) {}
-ZeroCopyTileTaskWorkerPool::~ZeroCopyTileTaskWorkerPool() {
-}
-
-void ZeroCopyTileTaskWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::Shutdown");
+ZeroCopyRasterBufferProvider::~ZeroCopyRasterBufferProvider() {}
- TaskGraph empty;
- task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
- task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
+std::unique_ptr<RasterBuffer>
+ZeroCopyRasterBufferProvider::AcquireBufferForRaster(
+ const Resource* resource,
+ uint64_t resource_content_id,
+ uint64_t previous_content_id) {
+ return base::WrapUnique<RasterBuffer>(
+ new RasterBufferImpl(resource_provider_, resource));
}
-void ZeroCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
- TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::ScheduleTasks");
-
- ScheduleTasksOnOriginThread(this, graph);
- task_graph_runner_->ScheduleTasks(namespace_token_, graph);
+void ZeroCopyRasterBufferProvider::ReleaseBufferForRaster(
+ std::unique_ptr<RasterBuffer> buffer) {
+ // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-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) {
- TileTask* task = static_cast<TileTask*>(it->get());
-
- task->WillComplete();
- task->CompleteOnOriginThread(this);
- task->DidComplete();
- }
- completed_tasks_.clear();
+void ZeroCopyRasterBufferProvider::OrderingBarrier() {
+ // No need to sync resources as this provider does not use GL context.
}
-ResourceFormat ZeroCopyTileTaskWorkerPool::GetResourceFormat(
+ResourceFormat ZeroCopyRasterBufferProvider::GetResourceFormat(
bool must_support_alpha) const {
if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) &&
(DoesResourceFormatSupportAlpha(preferred_tile_format_) ||
@@ -131,27 +110,11 @@ ResourceFormat ZeroCopyTileTaskWorkerPool::GetResourceFormat(
return resource_provider_->best_texture_format();
}
-bool ZeroCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
+bool ZeroCopyRasterBufferProvider::GetResourceRequiresSwizzle(
bool must_support_alpha) const {
return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
}
-RasterBufferProvider* ZeroCopyTileTaskWorkerPool::AsRasterBufferProvider() {
- return this;
-}
-
-std::unique_ptr<RasterBuffer>
-ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster(
- const Resource* resource,
- uint64_t resource_content_id,
- uint64_t previous_content_id) {
- return base::WrapUnique<RasterBuffer>(
- new RasterBufferImpl(resource_provider_, resource));
-}
-
-void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster(
- std::unique_ptr<RasterBuffer> buffer) {
- // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
-}
+void ZeroCopyRasterBufferProvider::Shutdown() {}
} // namespace cc
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.h ('k') | cc/raster/zero_copy_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698