OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/memory/discardable_memory.h" | 5 #include "base/memory/discardable_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/discardable_memory_emulated.h" | 8 #include "base/memory/discardable_memory_emulated.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( | 27 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( |
28 DiscardableMemoryType type, size_t size) { | 28 DiscardableMemoryType type, size_t size) { |
29 switch (type) { | 29 switch (type) { |
30 case DISCARDABLE_MEMORY_TYPE_EMULATED: { | 30 case DISCARDABLE_MEMORY_TYPE_EMULATED: { |
31 scoped_ptr<internal::DiscardableMemoryEmulated> memory( | 31 scoped_ptr<internal::DiscardableMemoryEmulated> memory( |
32 new internal::DiscardableMemoryEmulated(size)); | 32 new internal::DiscardableMemoryEmulated(size)); |
33 if (!memory->Initialize()) | 33 if (!memory->Initialize()) |
34 return scoped_ptr<DiscardableMemory>(); | 34 return nullptr; |
35 | 35 |
36 return memory.PassAs<DiscardableMemory>(); | 36 return memory.Pass(); |
37 } | 37 } |
38 case DISCARDABLE_MEMORY_TYPE_NONE: | 38 case DISCARDABLE_MEMORY_TYPE_NONE: |
39 case DISCARDABLE_MEMORY_TYPE_ASHMEM: | 39 case DISCARDABLE_MEMORY_TYPE_ASHMEM: |
40 case DISCARDABLE_MEMORY_TYPE_MAC: | 40 case DISCARDABLE_MEMORY_TYPE_MAC: |
41 NOTREACHED(); | 41 NOTREACHED(); |
42 return scoped_ptr<DiscardableMemory>(); | 42 return nullptr; |
43 } | 43 } |
44 | 44 |
45 NOTREACHED(); | 45 NOTREACHED(); |
46 return scoped_ptr<DiscardableMemory>(); | 46 return nullptr; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 void DiscardableMemory::PurgeForTesting() { | 50 void DiscardableMemory::PurgeForTesting() { |
51 internal::DiscardableMemoryEmulated::PurgeForTesting(); | 51 internal::DiscardableMemoryEmulated::PurgeForTesting(); |
52 } | 52 } |
53 | 53 |
54 } // namespace base | 54 } // namespace base |
OLD | NEW |