Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: base/memory/discardable_memory_mach.h

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_ 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_
7 7
8 #include "base/memory/discardable_memory.h" 8 #include "base/memory/discardable_memory.h"
9 9
10 #include "base/mac/scoped_mach_vm.h" 10 #include "base/mac/scoped_mach_vm.h"
11 #include "base/memory/discardable_memory_manager.h" 11 #include "base/memory/discardable_memory_manager.h"
12 12
13 namespace base { 13 namespace base {
14 namespace internal { 14 namespace internal {
15 15
16 class DiscardableMemoryMach 16 class DiscardableMemoryMach
17 : public DiscardableMemory, 17 : public DiscardableMemory,
18 public internal::DiscardableMemoryManagerAllocation { 18 public internal::DiscardableMemoryManagerAllocation {
19 public: 19 public:
20 explicit DiscardableMemoryMach(size_t bytes); 20 explicit DiscardableMemoryMach(size_t bytes);
21 virtual ~DiscardableMemoryMach(); 21 ~DiscardableMemoryMach() override;
22 22
23 static void PurgeForTesting(); 23 static void PurgeForTesting();
24 24
25 bool Initialize(); 25 bool Initialize();
26 26
27 // Overridden from DiscardableMemory: 27 // Overridden from DiscardableMemory:
28 virtual DiscardableMemoryLockStatus Lock() override; 28 DiscardableMemoryLockStatus Lock() override;
29 virtual void Unlock() override; 29 void Unlock() override;
30 virtual void* Memory() const override; 30 void* Memory() const override;
31 31
32 // Overridden from internal::DiscardableMemoryManagerAllocation: 32 // Overridden from internal::DiscardableMemoryManagerAllocation:
33 virtual bool AllocateAndAcquireLock() override; 33 bool AllocateAndAcquireLock() override;
34 virtual void ReleaseLock() override; 34 void ReleaseLock() override;
35 virtual void Purge() override; 35 void Purge() override;
36 36
37 private: 37 private:
38 mac::ScopedMachVM memory_; 38 mac::ScopedMachVM memory_;
39 const size_t bytes_; 39 const size_t bytes_;
40 bool is_locked_; 40 bool is_locked_;
41 41
42 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMach); 42 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMach);
43 }; 43 };
44 44
45 } // namespace internal 45 } // namespace internal
46 } // namespace base 46 } // namespace base
47 47
48 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_ 48 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_MACH_H_
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_emulated.h ('k') | base/memory/discardable_memory_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698