| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 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.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/memory/discardable_memory_shmem.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | |
| 11 namespace base { | |
| 12 | |
| 13 // static | |
| 14 void DiscardableMemory::GetSupportedTypes( | |
| 15 std::vector<DiscardableMemoryType>* types) { | |
| 16 const DiscardableMemoryType supported_types[] = { | |
| 17 DISCARDABLE_MEMORY_TYPE_SHMEM | |
| 18 }; | |
| 19 types->assign(supported_types, supported_types + arraysize(supported_types)); | |
| 20 } | |
| 21 | |
| 22 // static | |
| 23 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( | |
| 24 DiscardableMemoryType type, size_t size) { | |
| 25 switch (type) { | |
| 26 case DISCARDABLE_MEMORY_TYPE_SHMEM: | |
| 27 return make_scoped_ptr(new internal::DiscardableMemoryShmem(size)); | |
| 28 case DISCARDABLE_MEMORY_TYPE_NONE: | |
| 29 NOTREACHED(); | |
| 30 return nullptr; | |
| 31 } | |
| 32 | |
| 33 NOTREACHED(); | |
| 34 return nullptr; | |
| 35 } | |
| 36 | |
| 37 } // namespace base | |
| OLD | NEW |