Index: base/memory/discardable_memory_allocator.cc |
diff --git a/base/memory/discardable_memory_allocator.cc b/base/memory/discardable_memory_allocator.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c75b3a2c1dd7c65a345398b029f2135791207085 |
--- /dev/null |
+++ b/base/memory/discardable_memory_allocator.cc |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/memory/discardable_memory_allocator.h" |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/discardable_memory.h" |
+#include "build/build_config.h" |
+ |
+namespace base { |
+ |
+#if !defined(OS_ANDROID) |
+ |
+namespace { |
+ |
+class DiscardableMemoryAllocatorImpl : public DiscardableMemoryAllocator { |
+ public: |
+ DiscardableMemoryAllocatorImpl() {} |
+ virtual ~DiscardableMemoryAllocatorImpl() {} |
+ |
+ // DiscardableMemoryAllocator: |
+ virtual scoped_ptr<DiscardableMemory> Allocate(size_t size) OVERRIDE { |
+ return DiscardableMemory::CreateLockedMemory(size); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocatorImpl); |
+}; |
+ |
+} // namespace |
+ |
+// static |
+scoped_ptr<DiscardableMemoryAllocator> DiscardableMemoryAllocator::Create( |
+ const std::string& name) { |
+ return scoped_ptr<DiscardableMemoryAllocator>( |
+ new DiscardableMemoryAllocatorImpl()); |
+} |
+ |
+#endif |
+ |
+} // namespace base |