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

Unified Diff: cc/raster/bitmap_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/bitmap_raster_buffer_provider.h ('k') | cc/raster/bitmap_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/bitmap_raster_buffer_provider.cc
diff --git a/cc/raster/bitmap_tile_task_worker_pool.cc b/cc/raster/bitmap_raster_buffer_provider.cc
similarity index 55%
rename from cc/raster/bitmap_tile_task_worker_pool.cc
rename to cc/raster/bitmap_raster_buffer_provider.cc
index c08bdcd65b2d3d13bb2fe576e2aa490a7357e8c3..b148860b21e4b16fe1eb8236e6d9a0fe2d2df69d 100644
--- a/cc/raster/bitmap_tile_task_worker_pool.cc
+++ b/cc/raster/bitmap_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/bitmap_tile_task_worker_pool.h"
+#include "cc/raster/bitmap_raster_buffer_provider.h"
#include <stddef.h>
#include <stdint.h>
@@ -50,7 +50,7 @@ class RasterBufferImpl : public RasterBuffer {
<< "Why are we rastering a tile that's not dirty?";
size_t stride = 0u;
- TileTaskWorkerPool::PlaybackToMemory(
+ RasterBufferProvider::PlaybackToMemory(
lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(),
stride, raster_source, raster_full_rect, playback_rect, scale,
playback_settings);
@@ -67,82 +67,46 @@ class RasterBufferImpl : public RasterBuffer {
} // namespace
// static
-std::unique_ptr<TileTaskWorkerPool> BitmapTileTaskWorkerPool::Create(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
+std::unique_ptr<RasterBufferProvider> BitmapRasterBufferProvider::Create(
ResourceProvider* resource_provider) {
- return base::WrapUnique<TileTaskWorkerPool>(new BitmapTileTaskWorkerPool(
- task_runner, task_graph_runner, resource_provider));
+ return base::WrapUnique<RasterBufferProvider>(
+ new BitmapRasterBufferProvider(resource_provider));
}
-BitmapTileTaskWorkerPool::BitmapTileTaskWorkerPool(
- base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
+BitmapRasterBufferProvider::BitmapRasterBufferProvider(
ResourceProvider* resource_provider)
- : task_runner_(task_runner),
- task_graph_runner_(task_graph_runner),
- namespace_token_(task_graph_runner->GetNamespaceToken()),
- resource_provider_(resource_provider) {}
+ : resource_provider_(resource_provider) {}
-BitmapTileTaskWorkerPool::~BitmapTileTaskWorkerPool() {
-}
-
-void BitmapTileTaskWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::Shutdown");
+BitmapRasterBufferProvider::~BitmapRasterBufferProvider() {}
- TaskGraph empty;
- task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
- task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
+std::unique_ptr<RasterBuffer>
+BitmapRasterBufferProvider::AcquireBufferForRaster(
+ const Resource* resource,
+ uint64_t resource_content_id,
+ uint64_t previous_content_id) {
+ return std::unique_ptr<RasterBuffer>(new RasterBufferImpl(
+ resource_provider_, resource, resource_content_id, previous_content_id));
}
-void BitmapTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
- TRACE_EVENT0("cc", "BitmapTileTaskWorkerPool::ScheduleTasks");
-
- ScheduleTasksOnOriginThread(this, graph);
- task_graph_runner_->ScheduleTasks(namespace_token_, graph);
+void BitmapRasterBufferProvider::ReleaseBufferForRaster(
+ std::unique_ptr<RasterBuffer> buffer) {
+ // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
}
-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) {
- TileTask* task = static_cast<TileTask*>(it->get());
-
- task->WillComplete();
- task->CompleteOnOriginThread(this);
- task->DidComplete();
- }
- completed_tasks_.clear();
+void BitmapRasterBufferProvider::OrderingBarrier() {
+ // No need to sync resources as this provider does not use GL context.
}
-ResourceFormat BitmapTileTaskWorkerPool::GetResourceFormat(
+ResourceFormat BitmapRasterBufferProvider::GetResourceFormat(
bool must_support_alpha) const {
return resource_provider_->best_texture_format();
}
-bool BitmapTileTaskWorkerPool::GetResourceRequiresSwizzle(
+bool BitmapRasterBufferProvider::GetResourceRequiresSwizzle(
bool must_support_alpha) const {
return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
}
-RasterBufferProvider* BitmapTileTaskWorkerPool::AsRasterBufferProvider() {
- return this;
-}
-
-std::unique_ptr<RasterBuffer> BitmapTileTaskWorkerPool::AcquireBufferForRaster(
- const Resource* resource,
- uint64_t resource_content_id,
- uint64_t previous_content_id) {
- return std::unique_ptr<RasterBuffer>(new RasterBufferImpl(
- resource_provider_, resource, resource_content_id, previous_content_id));
-}
-
-void BitmapTileTaskWorkerPool::ReleaseBufferForRaster(
- std::unique_ptr<RasterBuffer> buffer) {
- // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
-}
+void BitmapRasterBufferProvider::Shutdown() {}
} // namespace cc
« no previous file with comments | « cc/raster/bitmap_raster_buffer_provider.h ('k') | cc/raster/bitmap_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698