OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/test/test_discardable_memory_shmem_allocator.h" |
| 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 namespace base { |
| 10 namespace { |
| 11 |
| 12 class DiscardableMemoryShmemChunkImpl : public DiscardableMemoryShmemChunk { |
| 13 public: |
| 14 explicit DiscardableMemoryShmemChunkImpl(size_t size) |
| 15 : memory_(new uint8_t[size]) {} |
| 16 |
| 17 // Overridden from DiscardableMemoryShmemChunk: |
| 18 bool Lock() override { return false; } |
| 19 void Unlock() override {} |
| 20 void* Memory() const override { return memory_.get(); } |
| 21 |
| 22 private: |
| 23 scoped_ptr<uint8_t[]> memory_; |
| 24 }; |
| 25 |
| 26 } // namespace |
| 27 |
| 28 TestDiscardableMemoryShmemAllocator::TestDiscardableMemoryShmemAllocator() { |
| 29 } |
| 30 |
| 31 TestDiscardableMemoryShmemAllocator::~TestDiscardableMemoryShmemAllocator() { |
| 32 } |
| 33 |
| 34 scoped_ptr<DiscardableMemoryShmemChunk> |
| 35 TestDiscardableMemoryShmemAllocator::AllocateLockedDiscardableMemory( |
| 36 size_t size) { |
| 37 return make_scoped_ptr(new DiscardableMemoryShmemChunkImpl(size)); |
| 38 } |
| 39 |
| 40 } // namespace base |
OLD | NEW |