Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: base/memory/discardable_memory_mac.cc

Issue 963233003: base: Remove DiscardableMemoryMach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/memory/discardable_memory_linux.cc ('k') | base/memory/discardable_memory_mach.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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_mach.h"
9 #include "base/memory/discardable_memory_manager.h"
10 #include "base/memory/discardable_memory_shmem.h" 8 #include "base/memory/discardable_memory_shmem.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 10
13 namespace base { 11 namespace base {
14 12
15 // static 13 // static
16 void DiscardableMemory::GetSupportedTypes( 14 void DiscardableMemory::GetSupportedTypes(
17 std::vector<DiscardableMemoryType>* types) { 15 std::vector<DiscardableMemoryType>* types) {
18 const DiscardableMemoryType supported_types[] = { 16 const DiscardableMemoryType supported_types[] = {
19 DISCARDABLE_MEMORY_TYPE_SHMEM, 17 DISCARDABLE_MEMORY_TYPE_SHMEM
20 DISCARDABLE_MEMORY_TYPE_MACH
21 }; 18 };
22 types->assign(supported_types, supported_types + arraysize(supported_types)); 19 types->assign(supported_types, supported_types + arraysize(supported_types));
23 } 20 }
24 21
25 // static 22 // static
26 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( 23 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
27 DiscardableMemoryType type, size_t size) { 24 DiscardableMemoryType type, size_t size) {
28 switch (type) { 25 switch (type) {
29 case DISCARDABLE_MEMORY_TYPE_MACH: {
30 scoped_ptr<internal::DiscardableMemoryMach> memory(
31 new internal::DiscardableMemoryMach(size));
32 if (!memory->Initialize())
33 return nullptr;
34
35 return memory.Pass();
36 }
37 case DISCARDABLE_MEMORY_TYPE_SHMEM: { 26 case DISCARDABLE_MEMORY_TYPE_SHMEM: {
38 scoped_ptr<internal::DiscardableMemoryShmem> memory( 27 scoped_ptr<internal::DiscardableMemoryShmem> memory(
39 new internal::DiscardableMemoryShmem(size)); 28 new internal::DiscardableMemoryShmem(size));
40 if (!memory->Initialize()) 29 if (!memory->Initialize())
41 return nullptr; 30 return nullptr;
42 31
43 return memory.Pass(); 32 return memory.Pass();
44 } 33 }
45 case DISCARDABLE_MEMORY_TYPE_NONE: 34 case DISCARDABLE_MEMORY_TYPE_NONE:
46 NOTREACHED(); 35 NOTREACHED();
47 return nullptr; 36 return nullptr;
48 } 37 }
49 38
50 NOTREACHED(); 39 NOTREACHED();
51 return nullptr; 40 return nullptr;
52 } 41 }
53 42
54 } // namespace base 43 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_linux.cc ('k') | base/memory/discardable_memory_mach.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698