| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 5 #ifndef CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
| 6 #define CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 6 #define CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public TileTaskRunner, | 31 public TileTaskRunner, |
| 32 public TileTaskClient { | 32 public TileTaskClient { |
| 33 public: | 33 public: |
| 34 ~OneCopyTileTaskWorkerPool() override; | 34 ~OneCopyTileTaskWorkerPool() override; |
| 35 | 35 |
| 36 static scoped_ptr<TileTaskWorkerPool> Create( | 36 static scoped_ptr<TileTaskWorkerPool> Create( |
| 37 base::SequencedTaskRunner* task_runner, | 37 base::SequencedTaskRunner* task_runner, |
| 38 TaskGraphRunner* task_graph_runner, | 38 TaskGraphRunner* task_graph_runner, |
| 39 ContextProvider* context_provider, | 39 ContextProvider* context_provider, |
| 40 ResourceProvider* resource_provider, | 40 ResourceProvider* resource_provider, |
| 41 ResourcePool* resource_pool); | 41 ResourcePool* resource_pool, |
| 42 ResourceFormat resource_format); |
| 42 | 43 |
| 43 // Overridden from TileTaskWorkerPool: | 44 // Overridden from TileTaskWorkerPool: |
| 44 TileTaskRunner* AsTileTaskRunner() override; | 45 TileTaskRunner* AsTileTaskRunner() override; |
| 45 | 46 |
| 46 // Overridden from TileTaskRunner: | 47 // Overridden from TileTaskRunner: |
| 47 void SetClient(TileTaskRunnerClient* client) override; | 48 void SetClient(TileTaskRunnerClient* client) override; |
| 48 void Shutdown() override; | 49 void Shutdown() override; |
| 49 void ScheduleTasks(TileTaskQueue* queue) override; | 50 void ScheduleTasks(TileTaskQueue* queue) override; |
| 50 void CheckForCompletedTasks() override; | 51 void CheckForCompletedTasks() override; |
| 51 | 52 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 // Issues copy operations until |sequence| has been processed. This will | 68 // Issues copy operations until |sequence| has been processed. This will |
| 68 // return immediately if |sequence| has already been processed. | 69 // return immediately if |sequence| has already been processed. |
| 69 void AdvanceLastIssuedCopyTo(CopySequenceNumber sequence); | 70 void AdvanceLastIssuedCopyTo(CopySequenceNumber sequence); |
| 70 | 71 |
| 71 protected: | 72 protected: |
| 72 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | 73 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, |
| 73 TaskGraphRunner* task_graph_runner, | 74 TaskGraphRunner* task_graph_runner, |
| 74 ContextProvider* context_provider, | 75 ContextProvider* context_provider, |
| 75 ResourceProvider* resource_provider, | 76 ResourceProvider* resource_provider, |
| 76 ResourcePool* resource_pool); | 77 ResourcePool* resource_pool, |
| 78 ResourceFormat resource_format); |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 struct CopyOperation { | 81 struct CopyOperation { |
| 80 typedef ScopedPtrDeque<CopyOperation> Deque; | 82 typedef ScopedPtrDeque<CopyOperation> Deque; |
| 81 | 83 |
| 82 CopyOperation( | 84 CopyOperation( |
| 83 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock, | 85 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> write_lock, |
| 84 scoped_ptr<ScopedResource> src, | 86 scoped_ptr<ScopedResource> src, |
| 85 const Resource* dst); | 87 const Resource* dst); |
| 86 ~CopyOperation(); | 88 ~CopyOperation(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; | 101 scoped_refptr<base::debug::ConvertableToTraceFormat> StateAsValue() const; |
| 100 void StagingStateAsValueInto(base::debug::TracedValue* staging_state) const; | 102 void StagingStateAsValueInto(base::debug::TracedValue* staging_state) const; |
| 101 | 103 |
| 102 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 104 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 103 TaskGraphRunner* task_graph_runner_; | 105 TaskGraphRunner* task_graph_runner_; |
| 104 const NamespaceToken namespace_token_; | 106 const NamespaceToken namespace_token_; |
| 105 TileTaskRunnerClient* client_; | 107 TileTaskRunnerClient* client_; |
| 106 ContextProvider* context_provider_; | 108 ContextProvider* context_provider_; |
| 107 ResourceProvider* resource_provider_; | 109 ResourceProvider* resource_provider_; |
| 108 ResourcePool* resource_pool_; | 110 ResourcePool* resource_pool_; |
| 111 ResourceFormat resource_format_; |
| 109 TaskSetCollection tasks_pending_; | 112 TaskSetCollection tasks_pending_; |
| 110 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets]; | 113 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets]; |
| 111 CopySequenceNumber last_issued_copy_operation_; | 114 CopySequenceNumber last_issued_copy_operation_; |
| 112 CopySequenceNumber last_flushed_copy_operation_; | 115 CopySequenceNumber last_flushed_copy_operation_; |
| 113 | 116 |
| 114 // Task graph used when scheduling tasks and vector used to gather | 117 // Task graph used when scheduling tasks and vector used to gather |
| 115 // completed tasks. | 118 // completed tasks. |
| 116 TaskGraph graph_; | 119 TaskGraph graph_; |
| 117 Task::Vector completed_tasks_; | 120 Task::Vector completed_tasks_; |
| 118 | 121 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 // canceled when ScheduleTasks() is called. | 135 // canceled when ScheduleTasks() is called. |
| 133 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> | 136 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> |
| 134 task_set_finished_weak_ptr_factory_; | 137 task_set_finished_weak_ptr_factory_; |
| 135 | 138 |
| 136 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 139 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
| 137 }; | 140 }; |
| 138 | 141 |
| 139 } // namespace cc | 142 } // namespace cc |
| 140 | 143 |
| 141 #endif // CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 144 #endif // CC_RESOURCES_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
| OLD | NEW |