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 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ | 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ |
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ | 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ |
7 | 7 |
8 #include "base/memory/discardable_memory.h" | 8 #include "base/memory/discardable_memory.h" |
9 | 9 |
10 #include "base/memory/discardable_memory_manager.h" | 10 #include "base/memory/discardable_memory_manager.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // TODO(reveman): Remove this as it is breaking the discardable memory design | 24 // TODO(reveman): Remove this as it is breaking the discardable memory design |
25 // principle that implementations should not rely on information this is | 25 // principle that implementations should not rely on information this is |
26 // unavailable in kernel space. crbug.com/400423 | 26 // unavailable in kernel space. crbug.com/400423 |
27 BASE_EXPORT static void ReduceMemoryUsageUntilWithinLimit(size_t bytes); | 27 BASE_EXPORT static void ReduceMemoryUsageUntilWithinLimit(size_t bytes); |
28 | 28 |
29 static void PurgeForTesting(); | 29 static void PurgeForTesting(); |
30 | 30 |
31 bool Initialize(); | 31 bool Initialize(); |
32 | 32 |
33 // Overridden from DiscardableMemory: | 33 // Overridden from DiscardableMemory: |
34 virtual DiscardableMemoryLockStatus Lock() OVERRIDE; | 34 DiscardableMemoryLockStatus Lock() override; |
35 virtual void Unlock() OVERRIDE; | 35 void Unlock() override; |
36 virtual void* Memory() const OVERRIDE; | 36 void* Memory() const override; |
37 | 37 |
38 // Overridden from internal::DiscardableMemoryManagerAllocation: | 38 // Overridden from internal::DiscardableMemoryManagerAllocation: |
39 virtual bool AllocateAndAcquireLock() OVERRIDE; | 39 bool AllocateAndAcquireLock() override; |
40 virtual void ReleaseLock() OVERRIDE {} | 40 void ReleaseLock() override {} |
41 virtual void Purge() OVERRIDE; | 41 void Purge() override; |
42 | 42 |
43 private: | 43 private: |
44 const size_t bytes_; | 44 const size_t bytes_; |
45 scoped_ptr<uint8[]> memory_; | 45 scoped_ptr<uint8[]> memory_; |
46 bool is_locked_; | 46 bool is_locked_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryEmulated); | 48 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryEmulated); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace internal | 51 } // namespace internal |
52 } // namespace base | 52 } // namespace base |
53 | 53 |
54 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ | 54 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_ |
OLD | NEW |