Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/resources/rasterizer_delegate.h" | |
| 6 | |
| 7 namespace cc { | |
| 8 | |
| 9 RasterizerDelegate::RasterizerDelegate(RasterizerClient* client, | |
| 10 Rasterizer** rasterizers, | |
| 11 size_t num_rasterizers) | |
| 12 : client_(client), | |
| 13 rasterizers_(rasterizers, rasterizers + num_rasterizers), | |
| 14 did_finish_running_tasks_pending_count_(0u), | |
| 15 did_finish_running_tasks_required_for_activation_pending_count_(0u) { | |
| 16 DCHECK(client_); | |
| 17 for (RasterizerVector::iterator it = rasterizers_.begin(); | |
| 18 it != rasterizers_.end(); | |
| 19 ++it) | |
| 20 (*it)->SetClient(this); | |
| 21 } | |
| 22 | |
| 23 RasterizerDelegate::~RasterizerDelegate() {} | |
| 24 | |
| 25 // static | |
| 26 scoped_ptr<RasterizerDelegate> RasterizerDelegate::Create( | |
| 27 RasterizerClient* client, | |
| 28 Rasterizer** rasterizers, | |
| 29 size_t num_rasterizers) { | |
| 30 return make_scoped_ptr( | |
| 31 new RasterizerDelegate(client, rasterizers, num_rasterizers)); | |
| 32 } | |
| 33 | |
| 34 void RasterizerDelegate::Shutdown() { | |
| 35 for (RasterizerVector::iterator it = rasterizers_.begin(); | |
| 36 it != rasterizers_.end(); | |
| 37 ++it) | |
| 38 (*it)->Shutdown(); | |
| 39 } | |
| 40 | |
| 41 void RasterizerDelegate::ScheduleTasks(RasterTaskQueue* raster_queue) { | |
| 42 for (size_t i = 0; i < rasterizers_.size(); ++i) | |
| 43 rasterizers_[i]->ScheduleTasks(&raster_queue[i]); | |
| 44 | |
| 45 did_finish_running_tasks_pending_count_ = rasterizers_.size(); | |
| 46 did_finish_running_tasks_required_for_activation_pending_count_ = | |
| 47 rasterizers_.size(); | |
| 48 } | |
| 49 | |
| 50 void RasterizerDelegate::CheckForCompletedTasks() { | |
| 51 for (RasterizerVector::iterator it = rasterizers_.begin(); | |
| 52 it != rasterizers_.end(); | |
| 53 ++it) | |
| 54 (*it)->CheckForCompletedTasks(); | |
| 55 } | |
| 56 | |
| 57 bool RasterizerDelegate::ShouldForceTasksRequiredForActivationToComplete() | |
| 58 const { | |
| 59 return client_->ShouldForceTasksRequiredForActivationToComplete(); | |
| 60 } | |
| 61 | |
| 62 void RasterizerDelegate::DidFinishRunningTasks() { | |
| 63 DCHECK_LT(0u, did_finish_running_tasks_pending_count_); | |
|
vmpstr
2014/04/10 18:21:18
While here, could you TRACE_EVENT this one and the
reveman
2014/04/10 19:38:15
Done.
| |
| 64 if (--did_finish_running_tasks_pending_count_) | |
| 65 return; | |
| 66 client_->DidFinishRunningTasks(); | |
| 67 } | |
| 68 | |
| 69 void RasterizerDelegate::DidFinishRunningTasksRequiredForActivation() { | |
| 70 DCHECK_LT(0u, | |
| 71 did_finish_running_tasks_required_for_activation_pending_count_); | |
| 72 if (--did_finish_running_tasks_required_for_activation_pending_count_) | |
| 73 return; | |
| 74 client_->DidFinishRunningTasksRequiredForActivation(); | |
| 75 } | |
| 76 | |
| 77 } // namespace cc | |
| OLD | NEW |