[CleanUp] Move PowerApiManager to power_api and Rename
[chromium-blink-merge.git] / base / memory / discardable_memory_shmem.h
blob98d3b97a204a4fe11ec0933aee7e5e877c1de2a9
1 // Copyright 2014 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_SHMEM_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_
8 #include "base/memory/discardable_memory.h"
10 namespace base {
11 class DiscardableMemoryShmemChunk;
13 namespace internal {
15 class DiscardableMemoryShmem : public DiscardableMemory {
16 public:
17 explicit DiscardableMemoryShmem(size_t bytes);
18 ~DiscardableMemoryShmem() override;
20 bool Initialize();
22 // Overridden from DiscardableMemory:
23 DiscardableMemoryLockStatus Lock() override;
24 void Unlock() override;
25 void* Memory() const override;
27 private:
28 const size_t bytes_;
29 scoped_ptr<DiscardableMemoryShmemChunk> chunk_;
30 bool is_locked_;
32 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryShmem);
35 } // namespace internal
36 } // namespace base
38 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_