Chromium Code Reviews| Index: base/memory/discardable_memory_allocation.h |
| diff --git a/base/memory/discardable_memory_allocation.h b/base/memory/discardable_memory_allocation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..98e8b98bbd86ff6c7f5cbee311a4a392a9b4dc3b |
| --- /dev/null |
| +++ b/base/memory/discardable_memory_allocation.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATION_H_ |
| +#define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATION_H_ |
| + |
| +#include "base/base_export.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +namespace base { |
| +namespace internal { |
| + |
| +class BASE_EXPORT_PRIVATE DiscardableMemoryAllocation { |
|
willchan no longer on Chromium
2014/04/01 01:11:08
Can you comment this class so it's obvious how thi
reveman
2014/04/03 17:02:12
Added a comment here and improved the comments in
|
| + public: |
| + class BASE_EXPORT_PRIVATE Factory { |
| + public: |
| + virtual scoped_ptr<DiscardableMemoryAllocation> CreateLockedAllocation( |
| + size_t bytes) = 0; |
| + |
| + protected: |
| + virtual ~Factory() {} |
| + }; |
| + |
| + virtual ~DiscardableMemoryAllocation() {} |
| + |
| + // Locks the allocation so that it will not be purged by the system. Returns |
| + // true if memory is still resident. |
| + virtual bool Lock() = 0; |
| + |
| + // Unlocks the allocation so that it can be purged by the system. |
| + virtual void Unlock() = 0; |
| + |
| + // Returns the memory address for this allocation. |
| + virtual void* Memory() = 0; |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace base |
| + |
| +#endif // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATION_H_ |