rAc - revert invalid suggestions to edit mode
[chromium-blink-merge.git] / base / memory / discardable_memory_emulated.h
blob20144ff25f016a50c5810892f3be265b542fc165
1 // Copyright 2013 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_EMULATED_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_
8 #include "base/memory/discardable_memory.h"
10 namespace base {
11 namespace internal {
13 class DiscardableMemoryEmulated : public DiscardableMemory {
14 public:
15 explicit DiscardableMemoryEmulated(size_t size);
16 virtual ~DiscardableMemoryEmulated();
18 static void RegisterMemoryPressureListeners();
19 static void UnregisterMemoryPressureListeners();
21 static void PurgeForTesting();
23 bool Initialize();
25 // Overridden from DiscardableMemory:
26 virtual DiscardableMemoryLockStatus Lock() OVERRIDE;
27 virtual void Unlock() OVERRIDE;
28 virtual void* Memory() const OVERRIDE;
30 private:
31 scoped_ptr<uint8, FreeDeleter> memory_;
32 bool is_locked_;
34 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryEmulated);
37 } // namespace internal
38 } // namespace base
40 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_EMULATED_H_