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

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

Issue 655003004: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // static 60 // static
61 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( 61 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
62 DiscardableMemoryType type, size_t size) { 62 DiscardableMemoryType type, size_t size) {
63 switch (type) { 63 switch (type) {
64 case DISCARDABLE_MEMORY_TYPE_ASHMEM: { 64 case DISCARDABLE_MEMORY_TYPE_ASHMEM: {
65 SharedState* const shared_state = g_shared_state.Pointer(); 65 SharedState* const shared_state = g_shared_state.Pointer();
66 scoped_ptr<internal::DiscardableMemoryAshmem> memory( 66 scoped_ptr<internal::DiscardableMemoryAshmem> memory(
67 new internal::DiscardableMemoryAshmem( 67 new internal::DiscardableMemoryAshmem(
68 size, &shared_state->allocator, &shared_state->manager)); 68 size, &shared_state->allocator, &shared_state->manager));
69 if (!memory->Initialize()) 69 if (!memory->Initialize())
70 return scoped_ptr<DiscardableMemory>(); 70 return nullptr;
71 71
72 return memory.PassAs<DiscardableMemory>(); 72 return memory.Pass();
73 } 73 }
74 case DISCARDABLE_MEMORY_TYPE_EMULATED: { 74 case DISCARDABLE_MEMORY_TYPE_EMULATED: {
75 scoped_ptr<internal::DiscardableMemoryEmulated> memory( 75 scoped_ptr<internal::DiscardableMemoryEmulated> memory(
76 new internal::DiscardableMemoryEmulated(size)); 76 new internal::DiscardableMemoryEmulated(size));
77 if (!memory->Initialize()) 77 if (!memory->Initialize())
78 return scoped_ptr<DiscardableMemory>(); 78 return nullptr;
79 79
80 return memory.PassAs<DiscardableMemory>(); 80 return memory.Pass();
81 } 81 }
82 case DISCARDABLE_MEMORY_TYPE_NONE: 82 case DISCARDABLE_MEMORY_TYPE_NONE:
83 case DISCARDABLE_MEMORY_TYPE_MAC: 83 case DISCARDABLE_MEMORY_TYPE_MAC:
84 NOTREACHED(); 84 NOTREACHED();
85 return scoped_ptr<DiscardableMemory>(); 85 return nullptr;
86 } 86 }
87 87
88 NOTREACHED(); 88 NOTREACHED();
89 return scoped_ptr<DiscardableMemory>(); 89 return nullptr;
90 } 90 }
91 91
92 // static 92 // static
93 void DiscardableMemory::PurgeForTesting() { 93 void DiscardableMemory::PurgeForTesting() {
94 g_shared_state.Pointer()->manager.PurgeAll(); 94 g_shared_state.Pointer()->manager.PurgeAll();
95 internal::DiscardableMemoryEmulated::PurgeForTesting(); 95 internal::DiscardableMemoryEmulated::PurgeForTesting();
96 } 96 }
97 97
98 } // namespace base 98 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698