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

Unified Diff: cc/raster/one_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/one_copy_raster_buffer_provider.h ('k') | cc/raster/one_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/one_copy_raster_buffer_provider.cc
diff --git a/cc/raster/one_copy_tile_task_worker_pool.cc b/cc/raster/one_copy_raster_buffer_provider.cc
similarity index 82%
rename from cc/raster/one_copy_tile_task_worker_pool.cc
rename to cc/raster/one_copy_raster_buffer_provider.cc
index 3c12301f2320406e1deb3090aaf41da35748a7e8..816820b02f3ea13bd0da90de2bead452279ce364 100644
--- a/cc/raster/one_copy_tile_task_worker_pool.cc
+++ b/cc/raster/one_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/one_copy_tile_task_worker_pool.h"
+#include "cc/raster/one_copy_raster_buffer_provider.h"
#include <stdint.h>
@@ -27,7 +27,7 @@ namespace {
class RasterBufferImpl : public RasterBuffer {
public:
- RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool,
+ RasterBufferImpl(OneCopyRasterBufferProvider* worker_pool,
ResourceProvider* resource_provider,
ResourceFormat resource_format,
const Resource* resource,
@@ -53,7 +53,7 @@ class RasterBufferImpl : public RasterBuffer {
}
private:
- OneCopyTileTaskWorkerPool* worker_pool_;
+ OneCopyRasterBufferProvider* worker_pool_;
const Resource* resource_;
ResourceProvider::ScopedWriteLockGL lock_;
uint64_t previous_content_id_;
@@ -68,32 +68,28 @@ const int kMaxBytesPerCopyOperation = 1024 * 1024 * 4;
} // namespace
// static
-std::unique_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create(
+std::unique_ptr<RasterBufferProvider> OneCopyRasterBufferProvider::Create(
base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
int max_copy_texture_chromium_size,
bool use_partial_raster,
int max_staging_buffer_usage_in_bytes,
ResourceFormat preferred_tile_format) {
- return base::WrapUnique<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool(
- task_runner, task_graph_runner, resource_provider,
- max_copy_texture_chromium_size, use_partial_raster,
- max_staging_buffer_usage_in_bytes, preferred_tile_format));
+ return base::WrapUnique<RasterBufferProvider>(new OneCopyRasterBufferProvider(
+ task_runner, resource_provider, max_copy_texture_chromium_size,
+ use_partial_raster, max_staging_buffer_usage_in_bytes,
+ preferred_tile_format));
}
-OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool(
+OneCopyRasterBufferProvider::OneCopyRasterBufferProvider(
base::SequencedTaskRunner* task_runner,
- TaskGraphRunner* task_graph_runner,
ResourceProvider* resource_provider,
int max_copy_texture_chromium_size,
bool use_partial_raster,
int max_staging_buffer_usage_in_bytes,
ResourceFormat preferred_tile_format)
- : task_graph_runner_(task_graph_runner),
- namespace_token_(task_graph_runner->GetNamespaceToken()),
- resource_provider_(resource_provider),
+ : resource_provider_(resource_provider),
max_bytes_per_copy_operation_(
max_copy_texture_chromium_size
? std::min(kMaxBytesPerCopyOperation,
@@ -107,51 +103,35 @@ OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool(
max_staging_buffer_usage_in_bytes);
}
-OneCopyTileTaskWorkerPool::~OneCopyTileTaskWorkerPool() {
-}
-
-void OneCopyTileTaskWorkerPool::Shutdown() {
- TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::Shutdown");
-
- TaskGraph empty;
- task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
- task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
+OneCopyRasterBufferProvider::~OneCopyRasterBufferProvider() {}
- staging_pool_->Shutdown();
+std::unique_ptr<RasterBuffer>
+OneCopyRasterBufferProvider::AcquireBufferForRaster(
+ const Resource* resource,
+ uint64_t resource_content_id,
+ uint64_t previous_content_id) {
+ // TODO(danakj): If resource_content_id != 0, we only need to copy/upload
+ // the dirty rect.
+ return base::WrapUnique<RasterBuffer>(
+ new RasterBufferImpl(this, resource_provider_, resource->format(),
+ resource, previous_content_id));
}
-void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
- TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks");
+void OneCopyRasterBufferProvider::ReleaseBufferForRaster(
+ std::unique_ptr<RasterBuffer> buffer) {
+ // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
+}
- ScheduleTasksOnOriginThread(this, graph);
+void OneCopyRasterBufferProvider::OrderingBarrier() {
+ TRACE_EVENT0("cc", "OneCopyRasterBufferProvider::OrderingBarrier");
- // Barrier to sync any new resources to the worker context.
resource_provider_->output_surface()
->context_provider()
->ContextGL()
->OrderingBarrierCHROMIUM();
-
- task_graph_runner_->ScheduleTasks(namespace_token_, graph);
}
-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) {
- TileTask* task = static_cast<TileTask*>(it->get());
-
- task->WillComplete();
- task->CompleteOnOriginThread(this);
- task->DidComplete();
- }
- completed_tasks_.clear();
-}
-
-ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat(
+ResourceFormat OneCopyRasterBufferProvider::GetResourceFormat(
bool must_support_alpha) const {
if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) &&
(DoesResourceFormatSupportAlpha(preferred_tile_format_) ||
@@ -162,32 +142,16 @@ ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat(
return resource_provider_->best_texture_format();
}
-bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
+bool OneCopyRasterBufferProvider::GetResourceRequiresSwizzle(
bool must_support_alpha) const {
return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
}
-RasterBufferProvider* OneCopyTileTaskWorkerPool::AsRasterBufferProvider() {
- return this;
-}
-
-std::unique_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster(
- const Resource* resource,
- uint64_t resource_content_id,
- uint64_t previous_content_id) {
- // TODO(danakj): If resource_content_id != 0, we only need to copy/upload
- // the dirty rect.
- return base::WrapUnique<RasterBuffer>(
- new RasterBufferImpl(this, resource_provider_, resource->format(),
- resource, previous_content_id));
-}
-
-void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster(
- std::unique_ptr<RasterBuffer> buffer) {
- // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
+void OneCopyRasterBufferProvider::Shutdown() {
+ staging_pool_->Shutdown();
}
-void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread(
+void OneCopyRasterBufferProvider::PlaybackAndCopyOnWorkerThread(
const Resource* resource,
ResourceProvider::ScopedWriteLockGL* resource_lock,
const RasterSource* raster_source,
@@ -211,7 +175,7 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread(
staging_pool_->ReleaseStagingBuffer(std::move(staging_buffer));
}
-void OneCopyTileTaskWorkerPool::PlaybackToStagingBuffer(
+void OneCopyRasterBufferProvider::PlaybackToStagingBuffer(
StagingBuffer* staging_buffer,
const Resource* resource,
const RasterSource* raster_source,
@@ -248,12 +212,12 @@ void OneCopyTileTaskWorkerPool::PlaybackToStagingBuffer(
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);
DCHECK(!playback_rect.IsEmpty())
<< "Why are we rastering a tile that's not dirty?";
- TileTaskWorkerPool::PlaybackToMemory(
+ RasterBufferProvider::PlaybackToMemory(
buffer->memory(0), resource->format(), staging_buffer->size,
buffer->stride(0), raster_source, raster_full_rect, playback_rect,
scale, playback_settings);
@@ -262,7 +226,7 @@ void OneCopyTileTaskWorkerPool::PlaybackToStagingBuffer(
}
}
-void OneCopyTileTaskWorkerPool::CopyOnWorkerThread(
+void OneCopyRasterBufferProvider::CopyOnWorkerThread(
StagingBuffer* staging_buffer,
const Resource* resource,
ResourceProvider::ScopedWriteLockGL* resource_lock,
« no previous file with comments | « cc/raster/one_copy_raster_buffer_provider.h ('k') | cc/raster/one_copy_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698