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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 2013 The Chromium Authors. All rights reserved. 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 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 GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/atomic_sequence_num.h" 15 #include "base/atomic_sequence_num.h"
15 #include "base/callback.h" 16 #include "base/callback.h"
16 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
17 #include "base/containers/scoped_ptr_hash_map.h" 18 #include "base/containers/scoped_ptr_hash_map.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/single_thread_task_runner.h" 22 #include "base/single_thread_task_runner.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/synchronization/waitable_event.h" 24 #include "base/synchronization/waitable_event.h"
25 #include "base/threading/thread.h" 25 #include "base/threading/thread.h"
26 #include "gpu/command_buffer/client/gpu_control.h" 26 #include "gpu/command_buffer/client/gpu_control.h"
27 #include "gpu/command_buffer/common/command_buffer.h" 27 #include "gpu/command_buffer/common/command_buffer.h"
28 #include "gpu/command_buffer/service/gpu_preferences.h" 28 #include "gpu/command_buffer/service/gpu_preferences.h"
29 #include "gpu/config/gpu_driver_bug_workarounds.h" 29 #include "gpu/config/gpu_driver_bug_workarounds.h"
30 #include "gpu/gpu_export.h" 30 #include "gpu/gpu_export.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); 162 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state();
163 gpu::gles2::ProgramCache* program_cache(); 163 gpu::gles2::ProgramCache* program_cache();
164 164
165 private: 165 private:
166 const GpuPreferences gpu_preferences_; 166 const GpuPreferences gpu_preferences_;
167 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; 167 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
168 scoped_refptr<gfx::GLShareGroup> share_group_; 168 scoped_refptr<gfx::GLShareGroup> share_group_;
169 scoped_refptr<gles2::MailboxManager> mailbox_manager_; 169 scoped_refptr<gles2::MailboxManager> mailbox_manager_;
170 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; 170 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_;
171 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 171 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_;
172 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 172 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_;
173 }; 173 };
174 174
175 private: 175 private:
176 struct InitializeOnGpuThreadParams { 176 struct InitializeOnGpuThreadParams {
177 bool is_offscreen; 177 bool is_offscreen;
178 gfx::AcceleratedWidget window; 178 gfx::AcceleratedWidget window;
179 const gfx::Size& size; 179 const gfx::Size& size;
180 const std::vector<int32_t>& attribs; 180 const std::vector<int32_t>& attribs;
181 gfx::GpuPreference gpu_preference; 181 gfx::GpuPreference gpu_preference;
182 gpu::Capabilities* capabilities; // Ouptut. 182 gpu::Capabilities* capabilities; // Ouptut.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void PerformDelayedWorkOnGpuThread(); 235 void PerformDelayedWorkOnGpuThread();
236 // Callback implementations on the client thread. 236 // Callback implementations on the client thread.
237 void OnContextLost(); 237 void OnContextLost();
238 238
239 const CommandBufferId command_buffer_id_; 239 const CommandBufferId command_buffer_id_;
240 240
241 // Members accessed on the gpu thread (possibly with the exception of 241 // Members accessed on the gpu thread (possibly with the exception of
242 // creation): 242 // creation):
243 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; 243 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
244 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; 244 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_;
245 scoped_ptr<CommandExecutor> executor_; 245 std::unique_ptr<CommandExecutor> executor_;
246 scoped_ptr<gles2::GLES2Decoder> decoder_; 246 std::unique_ptr<gles2::GLES2Decoder> decoder_;
247 scoped_refptr<gfx::GLContext> context_; 247 scoped_refptr<gfx::GLContext> context_;
248 scoped_refptr<gfx::GLSurface> surface_; 248 scoped_refptr<gfx::GLSurface> surface_;
249 scoped_refptr<SyncPointOrderData> sync_point_order_data_; 249 scoped_refptr<SyncPointOrderData> sync_point_order_data_;
250 scoped_ptr<SyncPointClient> sync_point_client_; 250 std::unique_ptr<SyncPointClient> sync_point_client_;
251 base::Closure context_lost_callback_; 251 base::Closure context_lost_callback_;
252 // Used to throttle PerformDelayedWorkOnGpuThread. 252 // Used to throttle PerformDelayedWorkOnGpuThread.
253 bool delayed_work_pending_; 253 bool delayed_work_pending_;
254 ImageFactory* image_factory_; 254 ImageFactory* image_factory_;
255 255
256 // Members accessed on the client thread: 256 // Members accessed on the client thread:
257 GpuControlClient* gpu_control_client_; 257 GpuControlClient* gpu_control_client_;
258 #if DCHECK_IS_ON() 258 #if DCHECK_IS_ON()
259 bool context_lost_; 259 bool context_lost_;
260 #endif 260 #endif
261 State last_state_; 261 State last_state_;
262 int32_t last_put_offset_; 262 int32_t last_put_offset_;
263 gpu::Capabilities capabilities_; 263 gpu::Capabilities capabilities_;
264 GpuMemoryBufferManager* gpu_memory_buffer_manager_; 264 GpuMemoryBufferManager* gpu_memory_buffer_manager_;
265 base::AtomicSequenceNumber next_image_id_; 265 base::AtomicSequenceNumber next_image_id_;
266 uint64_t next_fence_sync_release_; 266 uint64_t next_fence_sync_release_;
267 uint64_t flushed_fence_sync_release_; 267 uint64_t flushed_fence_sync_release_;
268 268
269 // Accessed on both threads: 269 // Accessed on both threads:
270 scoped_ptr<CommandBufferServiceBase> command_buffer_; 270 std::unique_ptr<CommandBufferServiceBase> command_buffer_;
271 base::Lock command_buffer_lock_; 271 base::Lock command_buffer_lock_;
272 base::WaitableEvent flush_event_; 272 base::WaitableEvent flush_event_;
273 scoped_refptr<Service> service_; 273 scoped_refptr<Service> service_;
274 State state_after_last_flush_; 274 State state_after_last_flush_;
275 base::Lock state_after_last_flush_lock_; 275 base::Lock state_after_last_flush_lock_;
276 scoped_refptr<gfx::GLShareGroup> gl_share_group_; 276 scoped_refptr<gfx::GLShareGroup> gl_share_group_;
277 base::WaitableEvent fence_sync_wait_event_; 277 base::WaitableEvent fence_sync_wait_event_;
278 278
279 // Only used with explicit scheduling and the gpu thread is the same as 279 // Only used with explicit scheduling and the gpu thread is the same as
280 // the client thread. 280 // the client thread.
281 scoped_ptr<base::SequenceChecker> sequence_checker_; 281 std::unique_ptr<base::SequenceChecker> sequence_checker_;
282 282
283 base::WeakPtr<InProcessCommandBuffer> client_thread_weak_ptr_; 283 base::WeakPtr<InProcessCommandBuffer> client_thread_weak_ptr_;
284 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; 284 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_;
285 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; 285 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_;
286 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; 286 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_;
287 287
288 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); 288 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer);
289 }; 289 };
290 290
291 // Default Service class when a null service is used. 291 // Default Service class when a null service is used.
(...skipping 22 matching lines...) Expand all
314 SyncPointManager* sync_point_manager_; // Non-owning. 314 SyncPointManager* sync_point_manager_; // Non-owning.
315 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 315 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
316 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> 316 scoped_refptr<gpu::gles2::FramebufferCompletenessCache>
317 framebuffer_completeness_cache_; 317 framebuffer_completeness_cache_;
318 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); 318 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread);
319 }; 319 };
320 320
321 } // namespace gpu 321 } // namespace gpu
322 322
323 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 323 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer_unittest.cc ('k') | gpu/command_buffer/service/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698