OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/child/child_discardable_shared_memory_manager.h" | 10 #include "content/child/child_discardable_shared_memory_manager.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DISABLED_Map) { | 150 DISABLED_Map) { |
151 gfx::BufferFormat format = ::testing::get<1>(GetParam()); | 151 gfx::BufferFormat format = ::testing::get<1>(GetParam()); |
152 gfx::Size buffer_size(4, 4); | 152 gfx::Size buffer_size(4, 4); |
153 | 153 |
154 scoped_ptr<gfx::GpuMemoryBuffer> buffer = | 154 scoped_ptr<gfx::GpuMemoryBuffer> buffer = |
155 child_gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( | 155 child_gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( |
156 buffer_size, format, gfx::BufferUsage::MAP); | 156 buffer_size, format, gfx::BufferUsage::MAP); |
157 ASSERT_TRUE(buffer); | 157 ASSERT_TRUE(buffer); |
158 EXPECT_EQ(format, buffer->GetFormat()); | 158 EXPECT_EQ(format, buffer->GetFormat()); |
159 | 159 |
160 size_t num_planes = | 160 size_t num_planes = gfx::GpuMemoryBuffer::NumberOfPlanes(format); |
161 GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(format); | |
162 | 161 |
163 // Map buffer planes. | 162 // Map buffer planes. |
164 scoped_ptr<void* []> planes(new void* [num_planes]); | 163 scoped_ptr<void* []> planes(new void* [num_planes]); |
165 bool rv = buffer->Map(planes.get()); | 164 bool rv = buffer->Map(planes.get()); |
166 ASSERT_TRUE(rv); | 165 ASSERT_TRUE(rv); |
167 EXPECT_TRUE(buffer->IsMapped()); | 166 EXPECT_TRUE(buffer->IsMapped()); |
168 | 167 |
169 // Get strides. | 168 // Get strides. |
170 scoped_ptr<int[]> strides(new int[num_planes]); | 169 scoped_ptr<int[]> strides(new int[num_planes]); |
171 buffer->GetStride(strides.get()); | 170 buffer->GetStride(strides.get()); |
(...skipping 29 matching lines...) Expand all Loading... |
201 kEnableNativeBuffers), | 200 kEnableNativeBuffers), |
202 // These formats are guaranteed to work on all platforms. | 201 // These formats are guaranteed to work on all platforms. |
203 ::testing::Values(gfx::BufferFormat::R_8, | 202 ::testing::Values(gfx::BufferFormat::R_8, |
204 gfx::BufferFormat::RGBA_4444, | 203 gfx::BufferFormat::RGBA_4444, |
205 gfx::BufferFormat::RGBA_8888, | 204 gfx::BufferFormat::RGBA_8888, |
206 gfx::BufferFormat::BGRA_8888, | 205 gfx::BufferFormat::BGRA_8888, |
207 gfx::BufferFormat::YUV_420))); | 206 gfx::BufferFormat::YUV_420))); |
208 | 207 |
209 } // namespace | 208 } // namespace |
210 } // namespace content | 209 } // namespace content |
OLD | NEW |