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

Side by Side Diff: cc/raster/one_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: nits 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/one_copy_tile_task_worker_pool.h" 5 #include "cc/raster/one_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 #include <limits> 10 #include <limits>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 TaskGraph empty; 121 TaskGraph empty;
122 task_graph_runner_->ScheduleTasks(namespace_token_, &empty); 122 task_graph_runner_->ScheduleTasks(namespace_token_, &empty);
123 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_); 123 task_graph_runner_->WaitForTasksToFinishRunning(namespace_token_);
124 124
125 staging_pool_->Shutdown(); 125 staging_pool_->Shutdown();
126 } 126 }
127 127
128 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) { 128 void OneCopyTileTaskWorkerPool::ScheduleTasks(TaskGraph* graph) {
129 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks"); 129 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::ScheduleTasks");
130 130
131 ScheduleTasksOnOriginThread(this, graph);
132
133 // Barrier to sync any new resources to the worker context. 131 // Barrier to sync any new resources to the worker context.
134 resource_provider_->output_surface() 132 resource_provider_->output_surface()
135 ->context_provider() 133 ->context_provider()
136 ->ContextGL() 134 ->ContextGL()
137 ->OrderingBarrierCHROMIUM(); 135 ->OrderingBarrierCHROMIUM();
138 136
139 task_graph_runner_->ScheduleTasks(namespace_token_, graph); 137 task_graph_runner_->ScheduleTasks(namespace_token_, graph);
140 } 138 }
141 139
142 void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { 140 void OneCopyTileTaskWorkerPool::CollectCompletedTasks(
143 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CheckForCompletedTasks"); 141 Task::Vector* completed_tasks) {
142 TRACE_EVENT0("cc", "OneCopyTileTaskWorkerPool::CollectCompletedTasks");
144 143
145 task_graph_runner_->CollectCompletedTasks(namespace_token_, 144 task_graph_runner_->CollectCompletedTasks(namespace_token_, completed_tasks);
146 &completed_tasks_);
147
148 for (Task::Vector::const_iterator it = completed_tasks_.begin();
149 it != completed_tasks_.end(); ++it) {
150 TileTask* task = static_cast<TileTask*>(it->get());
151
152 task->WillComplete();
153 task->CompleteOnOriginThread(this);
154 task->DidComplete();
155 }
156 completed_tasks_.clear();
157 } 145 }
158 146
159 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( 147 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat(
160 bool must_support_alpha) const { 148 bool must_support_alpha) const {
161 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && 149 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) &&
162 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || 150 (DoesResourceFormatSupportAlpha(preferred_tile_format_) ||
163 !must_support_alpha)) { 151 !must_support_alpha)) {
164 return preferred_tile_format_; 152 return preferred_tile_format_;
165 } 153 }
166 154
167 return resource_provider_->best_texture_format(); 155 return resource_provider_->best_texture_format();
168 } 156 }
169 157
170 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( 158 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
171 bool must_support_alpha) const { 159 bool must_support_alpha) const {
172 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); 160 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
173 } 161 }
174 162
163 TileTaskClient* OneCopyTileTaskWorkerPool::AsTileTaskClient() {
164 return this;
165 }
166
175 std::unique_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( 167 std::unique_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster(
176 const Resource* resource, 168 const Resource* resource,
177 uint64_t resource_content_id, 169 uint64_t resource_content_id,
178 uint64_t previous_content_id) { 170 uint64_t previous_content_id) {
179 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload 171 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload
180 // the dirty rect. 172 // the dirty rect.
181 return base::WrapUnique<RasterBuffer>( 173 return base::WrapUnique<RasterBuffer>(
182 new RasterBufferImpl(this, resource_provider_, resource->format(), 174 new RasterBufferImpl(this, resource_provider_, resource->format(),
183 resource, previous_content_id)); 175 resource, previous_content_id));
184 } 176 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 255 }
264 } 256 }
265 257
266 void OneCopyTileTaskWorkerPool::CopyOnWorkerThread( 258 void OneCopyTileTaskWorkerPool::CopyOnWorkerThread(
267 StagingBuffer* staging_buffer, 259 StagingBuffer* staging_buffer,
268 const Resource* resource, 260 const Resource* resource,
269 ResourceProvider::ScopedWriteLockGL* resource_lock, 261 ResourceProvider::ScopedWriteLockGL* resource_lock,
270 const RasterSource* raster_source, 262 const RasterSource* raster_source,
271 uint64_t previous_content_id, 263 uint64_t previous_content_id,
272 uint64_t new_content_id) { 264 uint64_t new_content_id) {
265 DCHECK(resource->size().width() && resource->size().height());
prashant.n 2016/04/12 15:57:45 With width = 0, it will cause divide by zero crash
266
273 ContextProvider* context_provider = 267 ContextProvider* context_provider =
274 resource_provider_->output_surface()->worker_context_provider(); 268 resource_provider_->output_surface()->worker_context_provider();
275 DCHECK(context_provider); 269 DCHECK(context_provider);
276 270
277 { 271 {
278 ContextProvider::ScopedContextLock scoped_context(context_provider); 272 ContextProvider::ScopedContextLock scoped_context(context_provider);
279 273
280 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); 274 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
281 DCHECK(gl); 275 DCHECK(gl);
282 276
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 gl->OrderingBarrierCHROMIUM(); 370 gl->OrderingBarrierCHROMIUM();
377 371
378 // Generate sync token after the barrier for cross context synchronization. 372 // Generate sync token after the barrier for cross context synchronization.
379 gpu::SyncToken sync_token; 373 gpu::SyncToken sync_token;
380 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 374 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
381 resource_lock->UpdateResourceSyncToken(sync_token); 375 resource_lock->UpdateResourceSyncToken(sync_token);
382 } 376 }
383 } 377 }
384 378
385 } // namespace cc 379 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698