Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: cc/raster/one_copy_tile_task_worker_pool.h

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 27 matching lines...) Expand all
38 class ResourcePool; 38 class ResourcePool;
39 39
40 class CC_EXPORT OneCopyTileTaskWorkerPool 40 class CC_EXPORT OneCopyTileTaskWorkerPool
41 : public TileTaskWorkerPool, 41 : public TileTaskWorkerPool,
42 public TileTaskRunner, 42 public TileTaskRunner,
43 public TileTaskClient, 43 public TileTaskClient,
44 public base::trace_event::MemoryDumpProvider { 44 public base::trace_event::MemoryDumpProvider {
45 public: 45 public:
46 ~OneCopyTileTaskWorkerPool() override; 46 ~OneCopyTileTaskWorkerPool() override;
47 47
48 static scoped_ptr<TileTaskWorkerPool> Create( 48 static std::unique_ptr<TileTaskWorkerPool> Create(
49 base::SequencedTaskRunner* task_runner, 49 base::SequencedTaskRunner* task_runner,
50 TaskGraphRunner* task_graph_runner, 50 TaskGraphRunner* task_graph_runner,
51 ContextProvider* context_provider, 51 ContextProvider* context_provider,
52 ResourceProvider* resource_provider, 52 ResourceProvider* resource_provider,
53 int max_copy_texture_chromium_size, 53 int max_copy_texture_chromium_size,
54 bool use_partial_raster, 54 bool use_partial_raster,
55 int max_staging_buffer_usage_in_bytes, 55 int max_staging_buffer_usage_in_bytes,
56 ResourceFormat preferred_tile_format); 56 ResourceFormat preferred_tile_format);
57 57
58 // Overridden from TileTaskWorkerPool: 58 // Overridden from TileTaskWorkerPool:
59 TileTaskRunner* AsTileTaskRunner() override; 59 TileTaskRunner* AsTileTaskRunner() override;
60 60
61 // Overridden from TileTaskRunner: 61 // Overridden from TileTaskRunner:
62 void Shutdown() override; 62 void Shutdown() override;
63 void ScheduleTasks(TaskGraph* graph) override; 63 void ScheduleTasks(TaskGraph* graph) override;
64 void CheckForCompletedTasks() override; 64 void CheckForCompletedTasks() override;
65 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; 65 ResourceFormat GetResourceFormat(bool must_support_alpha) const override;
66 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; 66 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override;
67 67
68 // Overridden from TileTaskClient: 68 // Overridden from TileTaskClient:
69 scoped_ptr<RasterBuffer> AcquireBufferForRaster( 69 std::unique_ptr<RasterBuffer> AcquireBufferForRaster(
70 const Resource* resource, 70 const Resource* resource,
71 uint64_t resource_content_id, 71 uint64_t resource_content_id,
72 uint64_t previous_content_id) override; 72 uint64_t previous_content_id) override;
73 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; 73 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override;
74 74
75 // Overridden from base::trace_event::MemoryDumpProvider: 75 // Overridden from base::trace_event::MemoryDumpProvider:
76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
77 base::trace_event::ProcessMemoryDump* pmd) override; 77 base::trace_event::ProcessMemoryDump* pmd) override;
78 78
79 // Playback raster source and copy result into |resource|. 79 // Playback raster source and copy result into |resource|.
80 void PlaybackAndCopyOnWorkerThread( 80 void PlaybackAndCopyOnWorkerThread(
81 const Resource* resource, 81 const Resource* resource,
82 ResourceProvider::ScopedWriteLockGL* resource_lock, 82 ResourceProvider::ScopedWriteLockGL* resource_lock,
83 const RasterSource* raster_source, 83 const RasterSource* raster_source,
(...skipping 18 matching lines...) Expand all
102 StagingBuffer(const gfx::Size& size, ResourceFormat format); 102 StagingBuffer(const gfx::Size& size, ResourceFormat format);
103 ~StagingBuffer(); 103 ~StagingBuffer();
104 104
105 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); 105 void DestroyGLResources(gpu::gles2::GLES2Interface* gl);
106 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, 106 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
107 ResourceFormat format, 107 ResourceFormat format,
108 bool is_free) const; 108 bool is_free) const;
109 109
110 const gfx::Size size; 110 const gfx::Size size;
111 const ResourceFormat format; 111 const ResourceFormat format;
112 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; 112 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer;
113 base::TimeTicks last_usage; 113 base::TimeTicks last_usage;
114 unsigned texture_id; 114 unsigned texture_id;
115 unsigned image_id; 115 unsigned image_id;
116 unsigned query_id; 116 unsigned query_id;
117 uint64_t content_id; 117 uint64_t content_id;
118 }; 118 };
119 119
120 void AddStagingBuffer(const StagingBuffer* staging_buffer, 120 void AddStagingBuffer(const StagingBuffer* staging_buffer,
121 ResourceFormat format); 121 ResourceFormat format);
122 void RemoveStagingBuffer(const StagingBuffer* staging_buffer); 122 void RemoveStagingBuffer(const StagingBuffer* staging_buffer);
123 void MarkStagingBufferAsFree(const StagingBuffer* staging_buffer); 123 void MarkStagingBufferAsFree(const StagingBuffer* staging_buffer);
124 void MarkStagingBufferAsBusy(const StagingBuffer* staging_buffer); 124 void MarkStagingBufferAsBusy(const StagingBuffer* staging_buffer);
125 scoped_ptr<StagingBuffer> AcquireStagingBuffer(const Resource* resource, 125 std::unique_ptr<StagingBuffer> AcquireStagingBuffer(
126 uint64_t previous_content_id); 126 const Resource* resource,
127 uint64_t previous_content_id);
127 base::TimeTicks GetUsageTimeForLRUBuffer(); 128 base::TimeTicks GetUsageTimeForLRUBuffer();
128 void ScheduleReduceMemoryUsage(); 129 void ScheduleReduceMemoryUsage();
129 void ReduceMemoryUsage(); 130 void ReduceMemoryUsage();
130 void ReleaseBuffersNotUsedSince(base::TimeTicks time); 131 void ReleaseBuffersNotUsedSince(base::TimeTicks time);
131 132
132 scoped_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() const; 133 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue()
134 const;
133 void StagingStateAsValueInto( 135 void StagingStateAsValueInto(
134 base::trace_event::TracedValue* staging_state) const; 136 base::trace_event::TracedValue* staging_state) const;
135 137
136 scoped_refptr<base::SequencedTaskRunner> task_runner_; 138 scoped_refptr<base::SequencedTaskRunner> task_runner_;
137 TaskGraphRunner* task_graph_runner_; 139 TaskGraphRunner* task_graph_runner_;
138 const NamespaceToken namespace_token_; 140 const NamespaceToken namespace_token_;
139 ResourceProvider* const resource_provider_; 141 ResourceProvider* const resource_provider_;
140 const int max_bytes_per_copy_operation_; 142 const int max_bytes_per_copy_operation_;
141 const bool use_partial_raster_; 143 const bool use_partial_raster_;
142 144
143 Task::Vector completed_tasks_; 145 Task::Vector completed_tasks_;
144 146
145 mutable base::Lock lock_; 147 mutable base::Lock lock_;
146 // |lock_| must be acquired when accessing the following members. 148 // |lock_| must be acquired when accessing the following members.
147 using StagingBufferSet = std::set<const StagingBuffer*>; 149 using StagingBufferSet = std::set<const StagingBuffer*>;
148 StagingBufferSet buffers_; 150 StagingBufferSet buffers_;
149 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; 151 using StagingBufferDeque = std::deque<std::unique_ptr<StagingBuffer>>;
150 StagingBufferDeque free_buffers_; 152 StagingBufferDeque free_buffers_;
151 StagingBufferDeque busy_buffers_; 153 StagingBufferDeque busy_buffers_;
152 int bytes_scheduled_since_last_flush_; 154 int bytes_scheduled_since_last_flush_;
153 const int max_staging_buffer_usage_in_bytes_; 155 const int max_staging_buffer_usage_in_bytes_;
154 ResourceFormat preferred_tile_format_; 156 ResourceFormat preferred_tile_format_;
155 int staging_buffer_usage_in_bytes_; 157 int staging_buffer_usage_in_bytes_;
156 int free_staging_buffer_usage_in_bytes_; 158 int free_staging_buffer_usage_in_bytes_;
157 const base::TimeDelta staging_buffer_expiration_delay_; 159 const base::TimeDelta staging_buffer_expiration_delay_;
158 bool reduce_memory_usage_pending_; 160 bool reduce_memory_usage_pending_;
159 base::Closure reduce_memory_usage_callback_; 161 base::Closure reduce_memory_usage_callback_;
160 162
161 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; 163 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_;
162 164
163 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); 165 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool);
164 }; 166 };
165 167
166 } // namespace cc 168 } // namespace cc
167 169
168 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ 170 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698