OLD | NEW |
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 #include "media/renderers/mock_gpu_video_accelerator_factories.h" | 5 #include "media/renderers/mock_gpu_video_accelerator_factories.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ui/gfx/buffer_format_util.h" | 8 #include "ui/gfx/buffer_format_util.h" |
9 #include "ui/gfx/gpu_memory_buffer.h" | 9 #include "ui/gfx/gpu_memory_buffer.h" |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
92 std::unique_ptr<gfx::GpuMemoryBuffer> | 92 std::unique_ptr<gfx::GpuMemoryBuffer> |
93 MockGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer( | 93 MockGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer( |
94 const gfx::Size& size, | 94 const gfx::Size& size, |
95 gfx::BufferFormat format, | 95 gfx::BufferFormat format, |
96 gfx::BufferUsage /* usage */) { | 96 gfx::BufferUsage /* usage */) { |
97 if (fail_to_allocate_gpu_memory_buffer_) | 97 if (fail_to_allocate_gpu_memory_buffer_) |
98 return nullptr; | 98 return nullptr; |
99 return base::WrapUnique(new GpuMemoryBufferImpl(size, format)); | 99 return base::MakeUnique<GpuMemoryBufferImpl>(size, format); |
100 } | 100 } |
101 | 101 |
102 std::unique_ptr<base::SharedMemory> | 102 std::unique_ptr<base::SharedMemory> |
103 MockGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { | 103 MockGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { |
104 std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); | 104 std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); |
105 if (shared_memory->CreateAndMapAnonymous(size)) | 105 if (shared_memory->CreateAndMapAnonymous(size)) |
106 return shared_memory; | 106 return shared_memory; |
107 return nullptr; | 107 return nullptr; |
108 } | 108 } |
109 | 109 |
(...skipping 28 matching lines...) Expand all Loading... |
138 } | 138 } |
139 | 139 |
140 private: | 140 private: |
141 MockGpuVideoAcceleratorFactories* gpu_factories_; | 141 MockGpuVideoAcceleratorFactories* gpu_factories_; |
142 }; | 142 }; |
143 } // namespace | 143 } // namespace |
144 | 144 |
145 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> | 145 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> |
146 MockGpuVideoAcceleratorFactories::GetGLContextLock() { | 146 MockGpuVideoAcceleratorFactories::GetGLContextLock() { |
147 DCHECK(gles2_); | 147 DCHECK(gles2_); |
148 return base::WrapUnique(new ScopedGLContextLockImpl(this)); | 148 return base::MakeUnique<ScopedGLContextLockImpl>(this); |
149 } | 149 } |
150 | 150 |
151 } // namespace media | 151 } // namespace media |
OLD | NEW |