Move origin url validation check to PermissionContextBase class.
[chromium-blink-merge.git] / base / memory / discardable_memory_shmem.h
blobb04c9b1ea6ebe70fb79af1f4f01be675749cc6f7
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 #include "base/memory/discardable_memory_manager.h"
12 namespace base {
13 class DiscardableMemoryShmemChunk;
15 namespace internal {
17 class DiscardableMemoryShmem
18 : public DiscardableMemory,
19 public internal::DiscardableMemoryManagerAllocation {
20 public:
21 explicit DiscardableMemoryShmem(size_t bytes);
22 ~DiscardableMemoryShmem() override;
24 static void ReleaseFreeMemory();
26 static void PurgeForTesting();
28 bool Initialize();
30 // Overridden from DiscardableMemory:
31 DiscardableMemoryLockStatus Lock() override;
32 void Unlock() override;
33 void* Memory() const override;
35 // Overridden from internal::DiscardableMemoryManagerAllocation:
36 bool AllocateAndAcquireLock() override;
37 void ReleaseLock() override;
38 void Purge() override;
39 bool IsMemoryResident() const override;
41 private:
42 const size_t bytes_;
43 scoped_ptr<DiscardableMemoryShmemChunk> chunk_;
44 bool is_locked_;
46 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryShmem);
49 } // namespace internal
50 } // namespace base
52 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_