| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ALLOCATOR_H_ | 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 
| 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 
| 7 | 7 | 
|  | 8 #include <stddef.h> | 
|  | 9 | 
| 8 #include "base/base_export.h" | 10 #include "base/base_export.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 10 | 12 | 
| 11 namespace base { | 13 namespace base { | 
| 12 class DiscardableMemory; | 14 class DiscardableMemory; | 
| 13 | 15 | 
| 14 class BASE_EXPORT DiscardableMemoryAllocator { | 16 class BASE_EXPORT DiscardableMemoryAllocator { | 
| 15  public: | 17  public: | 
| 16   // Returns the allocator instance. | 18   // Returns the allocator instance. | 
| 17   static DiscardableMemoryAllocator* GetInstance(); | 19   static DiscardableMemoryAllocator* GetInstance(); | 
| 18 | 20 | 
| 19   // Sets the allocator instance. Can only be called once, e.g. on startup. | 21   // Sets the allocator instance. Can only be called once, e.g. on startup. | 
| 20   // Ownership of |instance| remains with the caller. | 22   // Ownership of |instance| remains with the caller. | 
| 21   static void SetInstance(DiscardableMemoryAllocator* allocator); | 23   static void SetInstance(DiscardableMemoryAllocator* allocator); | 
| 22 | 24 | 
| 23   virtual scoped_ptr<DiscardableMemory> AllocateLockedDiscardableMemory( | 25   virtual scoped_ptr<DiscardableMemory> AllocateLockedDiscardableMemory( | 
| 24       size_t size) = 0; | 26       size_t size) = 0; | 
| 25 | 27 | 
| 26  protected: | 28  protected: | 
| 27   virtual ~DiscardableMemoryAllocator() {} | 29   virtual ~DiscardableMemoryAllocator() {} | 
| 28 }; | 30 }; | 
| 29 | 31 | 
| 30 }  // namespace base | 32 }  // namespace base | 
| 31 | 33 | 
| 32 #endif  // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 34 #endif  // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ | 
| OLD | NEW | 
|---|