| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/client_test_helper.h" | 7 #include "gpu/command_buffer/client/client_test_helper.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <memory> |
| 13 |
| 12 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 14 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 13 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 17 |
| 16 using ::testing::_; | 18 using ::testing::_; |
| 17 using ::testing::Invoke; | 19 using ::testing::Invoke; |
| 18 | 20 |
| 19 namespace gpu { | 21 namespace gpu { |
| 20 | 22 |
| 21 MockCommandBufferBase::MockCommandBufferBase() : put_offset_(0) { | 23 MockCommandBufferBase::MockCommandBufferBase() : put_offset_(0) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 67 } |
| 66 return -1; | 68 return -1; |
| 67 } | 69 } |
| 68 | 70 |
| 69 scoped_refptr<gpu::Buffer> MockCommandBufferBase::CreateTransferBuffer( | 71 scoped_refptr<gpu::Buffer> MockCommandBufferBase::CreateTransferBuffer( |
| 70 size_t size, | 72 size_t size, |
| 71 int32_t* id) { | 73 int32_t* id) { |
| 72 *id = GetNextFreeTransferBufferId(); | 74 *id = GetNextFreeTransferBufferId(); |
| 73 if (*id >= 0) { | 75 if (*id >= 0) { |
| 74 int32_t ndx = *id - kTransferBufferBaseId; | 76 int32_t ndx = *id - kTransferBufferBaseId; |
| 75 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 77 std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
| 76 shared_memory->CreateAndMapAnonymous(size); | 78 shared_memory->CreateAndMapAnonymous(size); |
| 77 transfer_buffer_buffers_[ndx] = | 79 transfer_buffer_buffers_[ndx] = |
| 78 MakeBufferFromSharedMemory(std::move(shared_memory), size); | 80 MakeBufferFromSharedMemory(std::move(shared_memory), size); |
| 79 } | 81 } |
| 80 return GetTransferBuffer(*id); | 82 return GetTransferBuffer(*id); |
| 81 } | 83 } |
| 82 | 84 |
| 83 void MockCommandBufferBase::DestroyTransferBufferHelper(int32_t id) { | 85 void MockCommandBufferBase::DestroyTransferBufferHelper(int32_t id) { |
| 84 DCHECK_GE(id, kTransferBufferBaseId); | 86 DCHECK_GE(id, kTransferBufferBaseId); |
| 85 DCHECK_LT(id, kTransferBufferBaseId + kMaxTransferBuffers); | 87 DCHECK_LT(id, kTransferBufferBaseId + kMaxTransferBuffers); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 162 |
| 161 MockClientGpuControl::MockClientGpuControl() { | 163 MockClientGpuControl::MockClientGpuControl() { |
| 162 } | 164 } |
| 163 | 165 |
| 164 MockClientGpuControl::~MockClientGpuControl() { | 166 MockClientGpuControl::~MockClientGpuControl() { |
| 165 } | 167 } |
| 166 | 168 |
| 167 } // namespace gpu | 169 } // namespace gpu |
| 168 | 170 |
| 169 | 171 |
| OLD | NEW |