Index: cc/worker_pool.h |
diff --git a/cc/worker_pool.h b/cc/worker_pool.h |
index f47dd70b9981b23af18184c6c3f0ea911b051c12..86ea529cf3ff7553e29d44c74657ca8a82aa5f8f 100644 |
--- a/cc/worker_pool.h |
+++ b/cc/worker_pool.h |
@@ -10,7 +10,6 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "base/memory/scoped_ptr.h" |
-#include "base/memory/weak_ptr.h" |
#include "base/threading/thread.h" |
#include "cc/rendering_stats.h" |
#include "cc/scoped_ptr_deque.h" |
@@ -24,12 +23,16 @@ class WorkerPoolTask { |
virtual void Run(RenderingStats* rendering_stats) = 0; |
+ bool IsPending(); |
void Completed(); |
protected: |
WorkerPoolTask(const base::Closure& reply); |
base::Closure reply_; |
+ |
+ // Accessed from multiple threads. Set to 1 when task has completed. |
+ base::subtle::Atomic32 completed_; |
}; |
} // namespace internal |
@@ -54,9 +57,8 @@ class WorkerPool { |
// is posted to the thread that called PostTaskAndReply(). |
void PostTaskAndReply(const Callback& task, const base::Closure& reply); |
- // Returns true when worker pool has reached its internal limit for number |
- // of pending tasks. |
- bool IsBusy(); |
+ // Check for completed tasks and run reply callbacks. |
+ void CheckForCompletedTasks(); |
// Toggle rendering stats collection. |
void SetRecordRenderingStats(bool record_rendering_stats); |
@@ -76,6 +78,9 @@ class WorkerPool { |
// Posts a task to the worker thread. |
void PostTask(scoped_ptr<internal::WorkerPoolTask> task); |
+ // Check for completed tasks and run reply callbacks. |
+ void CheckForCompletedTasks(); |
+ |
int num_pending_tasks() const { return pending_tasks_.size(); } |
void set_record_rendering_stats(bool record_rendering_stats) { |
record_rendering_stats_ = record_rendering_stats; |
@@ -94,7 +99,6 @@ class WorkerPool { |
void OnTaskCompleted(); |
WorkerPool* worker_pool_; |
- base::WeakPtrFactory<Worker> weak_ptr_factory_; |
ScopedPtrDeque<internal::WorkerPoolTask> pending_tasks_; |
scoped_ptr<RenderingStats> rendering_stats_; |
bool record_rendering_stats_; |