| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "cc/debug/traced_value.h" | 11 #include "base/debug/traced_value.h" |
| 12 #include "cc/resources/resource.h" | 12 #include "cc/resources/resource.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const int kCheckForCompletedRasterTasksDelayMs = 6; | 17 const int kCheckForCompletedRasterTasksDelayMs = 6; |
| 18 | 18 |
| 19 const size_t kMaxScheduledRasterTasks = 48; | 19 const size_t kMaxScheduledRasterTasks = 48; |
| 20 | 20 |
| 21 typedef base::StackVector<RasterTask*, kMaxScheduledRasterTasks> | 21 typedef base::StackVector<RasterTask*, kMaxScheduledRasterTasks> |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // another check. | 212 // another check. |
| 213 check_for_completed_raster_tasks_time_ = base::TimeTicks(); | 213 check_for_completed_raster_tasks_time_ = base::TimeTicks(); |
| 214 ScheduleCheckForCompletedRasterTasks(); | 214 ScheduleCheckForCompletedRasterTasks(); |
| 215 | 215 |
| 216 TRACE_EVENT_ASYNC_STEP_INTO1( | 216 TRACE_EVENT_ASYNC_STEP_INTO1( |
| 217 "cc", | 217 "cc", |
| 218 "ScheduledTasks", | 218 "ScheduledTasks", |
| 219 this, | 219 this, |
| 220 StateName(), | 220 StateName(), |
| 221 "state", | 221 "state", |
| 222 TracedValue::FromValue(StateAsValue().release())); | 222 base::debug::TracedValue::FromValue(StateAsValue().release())); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() { | 225 void PixelBufferRasterWorkerPool::CheckForCompletedTasks() { |
| 226 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks"); | 226 TRACE_EVENT0("cc", "PixelBufferRasterWorkerPool::CheckForCompletedTasks"); |
| 227 | 227 |
| 228 CheckForCompletedRasterizerTasks(); | 228 CheckForCompletedRasterizerTasks(); |
| 229 CheckForCompletedUploads(); | 229 CheckForCompletedUploads(); |
| 230 FlushUploads(); | 230 FlushUploads(); |
| 231 | 231 |
| 232 for (RasterizerTask::Vector::const_iterator it = | 232 for (RasterizerTask::Vector::const_iterator it = |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 scheduled_raster_task_count_ = 0; | 489 scheduled_raster_task_count_ = 0; |
| 490 if (PendingRasterTaskCount()) | 490 if (PendingRasterTaskCount()) |
| 491 ScheduleMoreTasks(); | 491 ScheduleMoreTasks(); |
| 492 | 492 |
| 493 TRACE_EVENT_ASYNC_STEP_INTO1( | 493 TRACE_EVENT_ASYNC_STEP_INTO1( |
| 494 "cc", | 494 "cc", |
| 495 "ScheduledTasks", | 495 "ScheduledTasks", |
| 496 this, | 496 this, |
| 497 StateName(), | 497 StateName(), |
| 498 "state", | 498 "state", |
| 499 TracedValue::FromValue(StateAsValue().release())); | 499 base::debug::TracedValue::FromValue(StateAsValue().release())); |
| 500 | 500 |
| 501 // Schedule another check for completed raster tasks while there are | 501 // Schedule another check for completed raster tasks while there are |
| 502 // pending raster tasks or pending uploads. | 502 // pending raster tasks or pending uploads. |
| 503 if (HasPendingTasks()) | 503 if (HasPendingTasks()) |
| 504 ScheduleCheckForCompletedRasterTasks(); | 504 ScheduleCheckForCompletedRasterTasks(); |
| 505 | 505 |
| 506 // Generate client notifications. | 506 // Generate client notifications. |
| 507 if (will_notify_client_that_no_tasks_required_for_activation_are_pending) { | 507 if (will_notify_client_that_no_tasks_required_for_activation_are_pending) { |
| 508 DCHECK(!HasPendingTasksRequiredForActivation()); | 508 DCHECK(!HasPendingTasksRequiredForActivation()); |
| 509 client_->DidFinishRunningTasksRequiredForActivation(); | 509 client_->DidFinishRunningTasksRequiredForActivation(); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 792 |
| 793 throttle_state->SetInteger("bytes_available_for_upload", | 793 throttle_state->SetInteger("bytes_available_for_upload", |
| 794 max_bytes_pending_upload_ - bytes_pending_upload_); | 794 max_bytes_pending_upload_ - bytes_pending_upload_); |
| 795 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); | 795 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); |
| 796 throttle_state->SetInteger("scheduled_raster_task_count", | 796 throttle_state->SetInteger("scheduled_raster_task_count", |
| 797 scheduled_raster_task_count_); | 797 scheduled_raster_task_count_); |
| 798 return throttle_state.PassAs<base::Value>(); | 798 return throttle_state.PassAs<base::Value>(); |
| 799 } | 799 } |
| 800 | 800 |
| 801 } // namespace cc | 801 } // namespace cc |
| OLD | NEW |