OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/memory/discardable_memory_allocator.h" |
| 6 |
| 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/discardable_memory.h" |
| 10 #include "build/build_config.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 #if !defined(OS_ANDROID) |
| 15 |
| 16 namespace { |
| 17 |
| 18 class DiscardableMemoryAllocatorImpl : public DiscardableMemoryAllocator { |
| 19 public: |
| 20 DiscardableMemoryAllocatorImpl() {} |
| 21 virtual ~DiscardableMemoryAllocatorImpl() {} |
| 22 |
| 23 // DiscardableMemoryAllocator: |
| 24 virtual scoped_ptr<DiscardableMemory> Allocate(size_t size) OVERRIDE { |
| 25 return DiscardableMemory::CreateLockedMemory(size); |
| 26 } |
| 27 |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocatorImpl); |
| 30 }; |
| 31 |
| 32 } // namespace |
| 33 |
| 34 // static |
| 35 scoped_ptr<DiscardableMemoryAllocator> DiscardableMemoryAllocator::Create( |
| 36 const std::string& name) { |
| 37 return scoped_ptr<DiscardableMemoryAllocator>( |
| 38 new DiscardableMemoryAllocatorImpl()); |
| 39 } |
| 40 |
| 41 #endif |
| 42 |
| 43 } // namespace base |
OLD | NEW |