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
3 // found in the LICENSE file.
5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_
8 #include "base/base_export.h"
9 #include "base/memory/scoped_ptr.h"
12 class DiscardableMemory
;
14 class BASE_EXPORT DiscardableMemoryAllocator
{
16 // Returns the allocator instance.
17 static DiscardableMemoryAllocator
* GetInstance();
19 // Sets the allocator instance. Can only be called once, e.g. on startup.
20 // Ownership of |instance| remains with the caller.
21 static void SetInstance(DiscardableMemoryAllocator
* allocator
);
23 virtual scoped_ptr
<DiscardableMemory
> AllocateLockedDiscardableMemory(
27 virtual ~DiscardableMemoryAllocator() {}
32 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_