| 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/base/worker_pool.h" | 5 #include "cc/base/worker_pool.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/synchronization/condition_variable.h" | 10 #include "base/synchronization/condition_variable.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 while (true) { | 542 while (true) { |
| 543 base::TimeTicks time_limit = run_cheap_tasks_time_limit_; | 543 base::TimeTicks time_limit = run_cheap_tasks_time_limit_; |
| 544 | 544 |
| 545 if (!check_for_completed_tasks_time_.is_null()) | 545 if (!check_for_completed_tasks_time_.is_null()) |
| 546 time_limit = std::min(time_limit, check_for_completed_tasks_time_); | 546 time_limit = std::min(time_limit, check_for_completed_tasks_time_); |
| 547 | 547 |
| 548 bool is_idle = inner_->RunCheapTasksUntilTimeLimit(time_limit); | 548 bool is_idle = inner_->RunCheapTasksUntilTimeLimit(time_limit); |
| 549 | 549 |
| 550 base::TimeTicks now = base::TimeTicks::Now(); | 550 base::TimeTicks now = base::TimeTicks::Now(); |
| 551 if (now >= run_cheap_tasks_time_limit_) { | 551 if (now >= run_cheap_tasks_time_limit_) { |
| 552 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks out of time"); | 552 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks out of time", |
| 553 TRACE_EVENT_SCOPE_THREAD); |
| 553 break; | 554 break; |
| 554 } | 555 } |
| 555 | 556 |
| 556 // We must be out of cheap tasks if this happens. | 557 // We must be out of cheap tasks if this happens. |
| 557 if (check_for_completed_tasks_time_.is_null() || | 558 if (check_for_completed_tasks_time_.is_null() || |
| 558 now < check_for_completed_tasks_time_) | 559 now < check_for_completed_tasks_time_) |
| 559 break; | 560 break; |
| 560 | 561 |
| 561 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time"); | 562 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time", |
| 563 TRACE_EVENT_SCOPE_THREAD); |
| 562 CancelCheckForCompletedTasks(); | 564 CancelCheckForCompletedTasks(); |
| 563 DispatchCompletionCallbacks(); | 565 DispatchCompletionCallbacks(); |
| 564 // Schedule another check for completed tasks if not idle. | 566 // Schedule another check for completed tasks if not idle. |
| 565 if (!is_idle) | 567 if (!is_idle) |
| 566 ScheduleCheckForCompletedTasks(); | 568 ScheduleCheckForCompletedTasks(); |
| 567 } | 569 } |
| 568 } | 570 } |
| 569 | 571 |
| 570 } // namespace cc | 572 } // namespace cc |
| OLD | NEW |