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

Side by Side Diff: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.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 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 GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ 5 #ifndef GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_
6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ 6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "gpu/gpu_export.h" 13 #include "gpu/gpu_export.h"
12 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" 14 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
13 15
14 namespace gpu { 16 namespace gpu {
15 17
16 // Implementation of GPU memory buffer based on shared memory. 18 // Implementation of GPU memory buffer based on shared memory.
17 class GPU_EXPORT GpuMemoryBufferImplSharedMemory : public GpuMemoryBufferImpl { 19 class GPU_EXPORT GpuMemoryBufferImplSharedMemory : public GpuMemoryBufferImpl {
18 public: 20 public:
19 ~GpuMemoryBufferImplSharedMemory() override; 21 ~GpuMemoryBufferImplSharedMemory() override;
20 22
21 static scoped_ptr<GpuMemoryBufferImplSharedMemory> Create( 23 static std::unique_ptr<GpuMemoryBufferImplSharedMemory> Create(
22 gfx::GpuMemoryBufferId id, 24 gfx::GpuMemoryBufferId id,
23 const gfx::Size& size, 25 const gfx::Size& size,
24 gfx::BufferFormat format, 26 gfx::BufferFormat format,
25 const DestructionCallback& callback); 27 const DestructionCallback& callback);
26 28
27 static gfx::GpuMemoryBufferHandle AllocateForChildProcess( 29 static gfx::GpuMemoryBufferHandle AllocateForChildProcess(
28 gfx::GpuMemoryBufferId id, 30 gfx::GpuMemoryBufferId id,
29 const gfx::Size& size, 31 const gfx::Size& size,
30 gfx::BufferFormat format, 32 gfx::BufferFormat format,
31 base::ProcessHandle child_process); 33 base::ProcessHandle child_process);
32 34
33 static scoped_ptr<GpuMemoryBufferImplSharedMemory> CreateFromHandle( 35 static std::unique_ptr<GpuMemoryBufferImplSharedMemory> CreateFromHandle(
34 const gfx::GpuMemoryBufferHandle& handle, 36 const gfx::GpuMemoryBufferHandle& handle,
35 const gfx::Size& size, 37 const gfx::Size& size,
36 gfx::BufferFormat format, 38 gfx::BufferFormat format,
37 gfx::BufferUsage usage, 39 gfx::BufferUsage usage,
38 const DestructionCallback& callback); 40 const DestructionCallback& callback);
39 41
40 static bool IsUsageSupported(gfx::BufferUsage usage); 42 static bool IsUsageSupported(gfx::BufferUsage usage);
41 static bool IsConfigurationSupported(gfx::BufferFormat format, 43 static bool IsConfigurationSupported(gfx::BufferFormat format,
42 gfx::BufferUsage usage); 44 gfx::BufferUsage usage);
43 static bool IsSizeValidForFormat(const gfx::Size& size, 45 static bool IsSizeValidForFormat(const gfx::Size& size,
44 gfx::BufferFormat format); 46 gfx::BufferFormat format);
45 47
46 static base::Closure AllocateForTesting(const gfx::Size& size, 48 static base::Closure AllocateForTesting(const gfx::Size& size,
47 gfx::BufferFormat format, 49 gfx::BufferFormat format,
48 gfx::BufferUsage usage, 50 gfx::BufferUsage usage,
49 gfx::GpuMemoryBufferHandle* handle); 51 gfx::GpuMemoryBufferHandle* handle);
50 52
51 // Overridden from gfx::GpuMemoryBuffer: 53 // Overridden from gfx::GpuMemoryBuffer:
52 bool Map() override; 54 bool Map() override;
53 void* memory(size_t plane) override; 55 void* memory(size_t plane) override;
54 void Unmap() override; 56 void Unmap() override;
55 int stride(size_t plane) const override; 57 int stride(size_t plane) const override;
56 gfx::GpuMemoryBufferHandle GetHandle() const override; 58 gfx::GpuMemoryBufferHandle GetHandle() const override;
57 59
58 private: 60 private:
59 GpuMemoryBufferImplSharedMemory(gfx::GpuMemoryBufferId id, 61 GpuMemoryBufferImplSharedMemory(
60 const gfx::Size& size, 62 gfx::GpuMemoryBufferId id,
61 gfx::BufferFormat format, 63 const gfx::Size& size,
62 const DestructionCallback& callback, 64 gfx::BufferFormat format,
63 scoped_ptr<base::SharedMemory> shared_memory, 65 const DestructionCallback& callback,
64 size_t offset, 66 std::unique_ptr<base::SharedMemory> shared_memory,
65 int stride); 67 size_t offset,
68 int stride);
66 69
67 scoped_ptr<base::SharedMemory> shared_memory_; 70 std::unique_ptr<base::SharedMemory> shared_memory_;
68 size_t offset_; 71 size_t offset_;
69 int stride_; 72 int stride_;
70 73
71 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSharedMemory); 74 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSharedMemory);
72 }; 75 };
73 76
74 } // namespace gpu 77 } // namespace gpu
75 78
76 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ 79 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc ('k') | gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698