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_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 5 #ifndef CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
6 #define CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 6 #define CC_RASTER_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 // Overridden from TileTaskClient: | 55 // Overridden from TileTaskClient: |
56 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 56 scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
57 const Resource* resource, | 57 const Resource* resource, |
58 uint64_t resource_content_id, | 58 uint64_t resource_content_id, |
59 uint64_t previous_content_id) override; | 59 uint64_t previous_content_id) override; |
60 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; | 60 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; |
61 | 61 |
62 // Playback raster source and schedule copy of |raster_resource| resource to | 62 // Playback raster source and schedule copy of |raster_resource| resource to |
63 // |output_resource|. Returns a non-zero sequence number for this copy | 63 // |output_resource|. Returns a non-zero sequence number for this copy |
64 // operation. | 64 // operation. |
65 CopySequenceNumber PlaybackAndScheduleCopyOnWorkerThread( | 65 void PlaybackAndCopyOnWorkerThread( |
reveman
2015/06/09 13:30:55
Is this function needed? Can't RasterBuffer::Playb
sohanjg
2015/06/09 15:59:24
Hmm..except for max_bytes_per_copy_operation_ we c
reveman
2015/06/09 18:00:30
Let's keep PlaybackAndCopyOnWorkerThread until the
sohanjg
2015/06/11 13:32:26
Acknowledged.
| |
66 bool reusing_raster_resource, | 66 bool reusing_raster_resource, |
67 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> | 67 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> |
68 raster_resource_write_lock, | 68 raster_resource_write_lock, |
69 const Resource* raster_resource, | 69 const Resource* raster_resource, |
70 const Resource* output_resource, | 70 const Resource* output_resource, |
71 const RasterSource* raster_source, | 71 const RasterSource* raster_source, |
72 const gfx::Rect& raster_full_rect, | 72 const gfx::Rect& raster_full_rect, |
73 const gfx::Rect& raster_dirty_rect, | 73 const gfx::Rect& raster_dirty_rect, |
74 float scale); | 74 float scale); |
75 | 75 |
(...skipping 25 matching lines...) Expand all Loading... | |
101 const gfx::Rect& rect); | 101 const gfx::Rect& rect); |
102 ~CopyOperation(); | 102 ~CopyOperation(); |
103 | 103 |
104 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock; | 104 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock; |
105 const Resource* src; | 105 const Resource* src; |
106 const Resource* dst; | 106 const Resource* dst; |
107 const gfx::Rect rect; | 107 const gfx::Rect rect; |
108 }; | 108 }; |
109 | 109 |
110 void OnTaskSetFinished(TaskSet task_set); | 110 void OnTaskSetFinished(TaskSet task_set); |
111 void AdvanceLastFlushedCopyTo(CopySequenceNumber sequence); | 111 void AdvanceLastFlushedCopyTo(CopySequenceNumber sequence); |
reveman
2015/06/09 13:30:56
is this used?
sohanjg
2015/06/09 15:59:24
Done.
| |
112 void IssueCopyOperations(int64 count); | 112 void IssueCopyOperations(CopyOperation* op); |
113 void ScheduleCheckForCompletedCopyOperationsWithLockAcquired( | 113 void ScheduleCheckForCompletedCopyOperationsWithLockAcquired( |
reveman
2015/06/09 13:30:55
used?
sohanjg
2015/06/09 15:59:24
Done.
| |
114 bool wait_if_needed); | 114 bool wait_if_needed); |
115 void CheckForCompletedCopyOperations(bool wait_if_needed); | 115 void CheckForCompletedCopyOperations(bool wait_if_needed); |
reveman
2015/06/09 13:30:55
used?
sohanjg
2015/06/09 15:59:24
Done.
| |
116 scoped_refptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() | 116 scoped_refptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() |
117 const; | 117 const; |
118 void StagingStateAsValueInto( | 118 void StagingStateAsValueInto( |
119 base::trace_event::TracedValue* staging_state) const; | 119 base::trace_event::TracedValue* staging_state) const; |
120 | 120 |
121 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 121 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
122 TaskGraphRunner* task_graph_runner_; | 122 TaskGraphRunner* task_graph_runner_; |
123 const NamespaceToken namespace_token_; | 123 const NamespaceToken namespace_token_; |
124 TileTaskRunnerClient* client_; | 124 TileTaskRunnerClient* client_; |
125 ContextProvider* context_provider_; | 125 ContextProvider* context_provider_; |
126 ResourceProvider* resource_provider_; | 126 ResourceProvider* resource_provider_; |
127 ResourcePool* resource_pool_; | 127 ResourcePool* resource_pool_; |
128 const int max_bytes_per_copy_operation_; | 128 const int max_bytes_per_copy_operation_; |
129 const bool have_persistent_gpu_memory_buffers_; | 129 const bool have_persistent_gpu_memory_buffers_; |
130 TaskSetCollection tasks_pending_; | 130 TaskSetCollection tasks_pending_; |
131 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets]; | 131 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets]; |
132 CopySequenceNumber last_issued_copy_operation_; | |
133 CopySequenceNumber last_flushed_copy_operation_; | |
134 | 132 |
135 // Task graph used when scheduling tasks and vector used to gather | 133 // Task graph used when scheduling tasks and vector used to gather |
136 // completed tasks. | 134 // completed tasks. |
137 TaskGraph graph_; | 135 TaskGraph graph_; |
138 Task::Vector completed_tasks_; | 136 Task::Vector completed_tasks_; |
139 | 137 |
140 base::Lock lock_; | 138 base::Lock lock_; |
reveman
2015/06/09 13:30:56
why do we still need this?
sohanjg
2015/06/09 15:59:24
we will need it, to get GpuMemoryBuffer right ? in
reveman
2015/06/09 18:00:30
GpuMemoryBuffer allocation is thread safe so you d
| |
141 // |lock_| must be acquired when accessing the following members. | 139 // |lock_| must be acquired when accessing the following members. |
142 base::ConditionVariable copy_operation_count_cv_; | |
143 int bytes_scheduled_since_last_flush_; | |
144 size_t issued_copy_operation_count_; | |
145 CopyOperation::Deque pending_copy_operations_; | 140 CopyOperation::Deque pending_copy_operations_; |
reveman
2015/06/09 13:30:56
used?
sohanjg
2015/06/09 15:59:24
Done.
| |
146 CopySequenceNumber next_copy_operation_sequence_; | |
147 bool check_for_completed_copy_operations_pending_; | |
148 base::TimeTicks last_check_for_completed_copy_operations_time_; | 141 base::TimeTicks last_check_for_completed_copy_operations_time_; |
reveman
2015/06/09 13:30:56
used?
sohanjg
2015/06/09 15:59:24
Done.
| |
149 bool shutdown_; | 142 bool shutdown_; |
150 | 143 |
151 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; | 144 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; |
152 // "raster finished" tasks need their own factory as they need to be | 145 // "raster finished" tasks need their own factory as they need to be |
153 // canceled when ScheduleTasks() is called. | 146 // canceled when ScheduleTasks() is called. |
154 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> | 147 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> |
155 task_set_finished_weak_ptr_factory_; | 148 task_set_finished_weak_ptr_factory_; |
156 | 149 |
157 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 150 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
158 }; | 151 }; |
159 | 152 |
160 } // namespace cc | 153 } // namespace cc |
161 | 154 |
162 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 155 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |