Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / cc / resources / zero_copy_tile_task_worker_pool.h
blob9cc5ee993fb142a016f3541f4c1a28faa83accdb
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
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_
6 #define CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_
8 #include "base/memory/weak_ptr.h"
9 #include "base/values.h"
10 #include "cc/resources/tile_task_runner.h"
11 #include "cc/resources/tile_task_worker_pool.h"
13 namespace base {
14 namespace debug {
15 class ConvertableToTraceFormat;
19 namespace cc {
20 class ResourceProvider;
22 class CC_EXPORT ZeroCopyTileTaskWorkerPool : public TileTaskWorkerPool,
23 public TileTaskRunner,
24 public TileTaskClient {
25 public:
26 ~ZeroCopyTileTaskWorkerPool() override;
28 static scoped_ptr<TileTaskWorkerPool> Create(
29 base::SequencedTaskRunner* task_runner,
30 TaskGraphRunner* task_graph_runner,
31 ResourceProvider* resource_provider);
33 // Overridden from TileTaskWorkerPool:
34 TileTaskRunner* AsTileTaskRunner() override;
36 // Overridden from TileTaskRunner:
37 void SetClient(TileTaskRunnerClient* client) override;
38 void Shutdown() override;
39 void ScheduleTasks(TileTaskQueue* queue) override;
40 void CheckForCompletedTasks() override;
42 // Overridden from TileTaskClient:
43 scoped_ptr<RasterBuffer> AcquireBufferForRaster(
44 const Resource* resource) override;
45 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
47 protected:
48 ZeroCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
49 TaskGraphRunner* task_graph_runner,
50 ResourceProvider* resource_provider);
52 private:
53 void OnTaskSetFinished(TaskSet task_set);
54 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const;
56 scoped_refptr<base::SequencedTaskRunner> task_runner_;
57 TaskGraphRunner* task_graph_runner_;
58 const NamespaceToken namespace_token_;
59 TileTaskRunnerClient* client_;
60 ResourceProvider* resource_provider_;
62 TaskSetCollection tasks_pending_;
64 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
66 // Task graph used when scheduling tasks and vector used to gather
67 // completed tasks.
68 TaskGraph graph_;
69 Task::Vector completed_tasks_;
71 base::WeakPtrFactory<ZeroCopyTileTaskWorkerPool>
72 task_set_finished_weak_ptr_factory_;
74 DISALLOW_COPY_AND_ASSIGN(ZeroCopyTileTaskWorkerPool);
77 } // namespace cc
79 #endif // CC_RESOURCES_ZERO_COPY_TILE_TASK_WORKER_POOL_H_