OLD | NEW |
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/resources/pixel_buffer_raster_worker_pool.h" | 5 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
6 | 6 |
7 #include "base/containers/stack_container.h" | 7 #include "base/containers/stack_container.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // All unscheduled tasks need to be canceled. | 82 // All unscheduled tasks need to be canceled. |
83 if (it->second == UNSCHEDULED) { | 83 if (it->second == UNSCHEDULED) { |
84 completed_raster_tasks_.push_back(task); | 84 completed_raster_tasks_.push_back(task); |
85 it->second = COMPLETED; | 85 it->second = COMPLETED; |
86 } | 86 } |
87 } | 87 } |
88 DCHECK_EQ(completed_raster_tasks_.size(), raster_task_states_.size()); | 88 DCHECK_EQ(completed_raster_tasks_.size(), raster_task_states_.size()); |
89 } | 89 } |
90 | 90 |
91 void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) { | 91 void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTaskQueue* queue) { |
92 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleTasks"); | 92 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::ScheduleTasks"); |
93 | 93 |
| 94 DCHECK_EQ(queue->required_for_activation_count, |
| 95 static_cast<size_t>( |
| 96 std::count_if(queue->items.begin(), |
| 97 queue->items.end(), |
| 98 RasterTaskQueue::Item::IsRequiredForActivation))); |
| 99 |
94 if (!should_notify_client_if_no_tasks_are_pending_) | 100 if (!should_notify_client_if_no_tasks_are_pending_) |
95 TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this); | 101 TRACE_EVENT_ASYNC_BEGIN0("cc", "ScheduledTasks", this); |
96 | 102 |
97 should_notify_client_if_no_tasks_are_pending_ = true; | 103 should_notify_client_if_no_tasks_are_pending_ = true; |
98 should_notify_client_if_no_tasks_required_for_activation_are_pending_ = true; | 104 should_notify_client_if_no_tasks_required_for_activation_are_pending_ = true; |
99 | 105 |
100 raster_tasks_required_for_activation_.clear(); | 106 raster_tasks_required_for_activation_.clear(); |
101 | 107 |
102 // Build new raster task state map. | 108 // Build new raster task state map. |
103 RasterTaskStateMap new_raster_task_states; | 109 RasterTaskStateMap new_raster_task_states; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 684 |
679 throttle_state->SetInteger("bytes_available_for_upload", | 685 throttle_state->SetInteger("bytes_available_for_upload", |
680 max_bytes_pending_upload_ - bytes_pending_upload_); | 686 max_bytes_pending_upload_ - bytes_pending_upload_); |
681 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 687 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
682 throttle_state->SetInteger("scheduled_raster_task_count", | 688 throttle_state->SetInteger("scheduled_raster_task_count", |
683 scheduled_raster_task_count_); | 689 scheduled_raster_task_count_); |
684 return throttle_state.PassAs<base::Value>(); | 690 return throttle_state.PassAs<base::Value>(); |
685 } | 691 } |
686 | 692 |
687 } // namespace cc | 693 } // namespace cc |
OLD | NEW |