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

Side by Side Diff: cc/raster/zero_copy_tile_task_worker_pool.cc

Issue 1866043006: cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip - fixed few unit tests 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/raster/zero_copy_tile_task_worker_pool.h" 5 #include "cc/raster/zero_copy_tile_task_worker_pool.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::Shutdown"); 98 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::Shutdown");
99 99
100 TaskGraph empty; 100 TaskGraph empty;
101 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); 101 task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
102 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); 102 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
103 } 103 }
104 104
105 void ZeroCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { 105 void ZeroCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
106 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::ScheduleTasks"); 106 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::ScheduleTasks");
107 107
108 ScheduleTasksOnOriginThread(this, graph);
109 task_graph_runner_->ScheduleTasks(namespace_token_, graph); 108 task_graph_runner_->ScheduleTasks(namespace_token_, graph);
110 } 109 }
111 110
112 void ZeroCopyTileTaskWorkerPool::CheckForCompletedTasks() { 111 void ZeroCopyTileTaskWorkerPool::CollectCompletedTasks(
112 Task::Vector* completed_tasks) {
113 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::CheckForCompletedTasks"); 113 TRACE_EVENT0("cc", "ZeroCopyTileTaskWorkerPool::CheckForCompletedTasks");
114 114
115 task_graph_runner_->CollectCompletedTasks(namespace_token_, 115 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks);
116 &completed_tasks_);
117 for (Task::Vector::const_iterator it = completed_tasks_.begin();
118 it != completed_tasks_.end(); ++it) {
119 TileTask* task = static_cast<TileTask*>(it->get());
120
121 task->WillComplete();
122 task->CompleteOnOriginThread(this);
123 task->DidComplete();
124 }
125 completed_tasks_.clear();
126 } 116 }
127 117
128 ResourceFormat ZeroCopyTileTaskWorkerPool::GetResourceFormat( 118 ResourceFormat ZeroCopyTileTaskWorkerPool::GetResourceFormat(
129 bool must_support_alpha) const { 119 bool must_support_alpha) const {
130 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && 120 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) &&
131 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || 121 (DoesResourceFormatSupportAlpha(preferred_tile_format_) ||
132 !must_support_alpha)) { 122 !must_support_alpha)) {
133 return preferred_tile_format_; 123 return preferred_tile_format_;
134 } 124 }
135 125
136 return resource_provider_->best_texture_format(); 126 return resource_provider_->best_texture_format();
137 } 127 }
138 128
139 bool ZeroCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( 129 bool ZeroCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
140 bool must_support_alpha) const { 130 bool must_support_alpha) const {
141 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); 131 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
142 } 132 }
143 133
134 TileTaskClient* ZeroCopyTileTaskWorkerPool::AsTileTaskClient() {
135 return this;
136 }
137
144 std::unique_ptr<RasterBuffer> 138 std::unique_ptr<RasterBuffer>
145 ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster( 139 ZeroCopyTileTaskWorkerPool::AcquireBufferForRaster(
146 const Resource* resource, 140 const Resource* resource,
147 uint64_t resource_content_id, 141 uint64_t resource_content_id,
148 uint64_t previous_content_id) { 142 uint64_t previous_content_id) {
149 return base::WrapUnique<RasterBuffer>( 143 return base::WrapUnique<RasterBuffer>(
150 new RasterBufferImpl(resource_provider_, resource)); 144 new RasterBufferImpl(resource_provider_, resource));
151 } 145 }
152 146
153 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster( 147 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster(
154 std::unique_ptr<RasterBuffer> buffer) { 148 std::unique_ptr<RasterBuffer> buffer) {
155 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. 149 // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
156 } 150 }
157 151
158 } // namespace cc 152 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698