Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / cc / resources / raster_worker_pool_delegate.h
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 #ifndef CC_RESOURCES_RASTER_WORKER_POOL_DELEGATE_H_
6 #define CC_RESOURCES_RASTER_WORKER_POOL_DELEGATE_H_
7
8 #include <vector>
9
10 #include "cc/resources/raster_worker_pool.h"
11
12 namespace cc {
13
14 class RasterWorkerPoolDelegate : public RasterWorkerPoolClient {
15  public:
16   virtual ~RasterWorkerPoolDelegate();
17
18   static scoped_ptr<RasterWorkerPoolDelegate> Create(
19       RasterWorkerPoolClient* client,
20       RasterWorkerPool** raster_worker_pools,
21       size_t num_raster_worker_pools);
22
23   void SetClient(RasterWorkerPoolClient* client);
24   void Shutdown();
25   void ScheduleTasks(RasterWorkerPool::RasterTask::Queue* raster_queue);
26   void CheckForCompletedTasks();
27
28   // Overriden from RasterWorkerPoolClient:
29   virtual bool ShouldForceTasksRequiredForActivationToComplete() const OVERRIDE;
30   virtual void DidFinishRunningTasks() OVERRIDE;
31   virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE;
32
33  private:
34   RasterWorkerPoolDelegate(RasterWorkerPoolClient* client,
35                            RasterWorkerPool** raster_worker_pools,
36                            size_t num_raster_worker_pools);
37
38   RasterWorkerPoolClient* client_;
39   typedef std::vector<RasterWorkerPool*> RasterWorkerPoolVector;
40   RasterWorkerPoolVector raster_worker_pools_;
41   size_t did_finish_running_tasks_pending_count_;
42   size_t did_finish_running_tasks_required_for_activation_pending_count_;
43 };
44
45 }  // namespace cc
46
47 #endif  // CC_RESOURCES_RASTER_WORKER_POOL_DELEGATE_H_