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

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

Issue 195863005: Use DiscardableMemoryManager on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix base.gypi Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
7
8 #include "base/memory/discardable_memory.h"
9
10 #include "base/macros.h"
11 #include "base/memory/discardable_memory_manager.h"
12
13 namespace base {
14 namespace internal {
15
16 class DiscardableAshmemChunk;
17 class DiscardableMemoryAllocator;
18 class DiscardableMemoryManager;
19
20 class DiscardableMemoryAshmem
21 : public DiscardableMemory,
22 public internal::DiscardableMemoryManagerAllocation {
23 public:
24 explicit DiscardableMemoryAshmem(size_t size,
25 DiscardableMemoryAllocator* allocator,
26 DiscardableMemoryManager* manager);
27
28 virtual ~DiscardableMemoryAshmem();
29
30 bool Initialize();
31
32 // Overridden from DiscardableMemory:
33 virtual DiscardableMemoryLockStatus Lock() OVERRIDE;
34 virtual void Unlock() OVERRIDE;
35 virtual void* Memory() const OVERRIDE;
36
37 // Overridden from internal::DiscardableMemoryManagerAllocation:
38 virtual bool AllocateAndAcquireLock(size_t bytes) OVERRIDE;
39 virtual void ReleaseLock() OVERRIDE;
40 virtual void Purge() OVERRIDE;
41
42 private:
43 DiscardableMemoryAllocator* const allocator_;
44 DiscardableMemoryManager* const manager_;
reveman 2014/04/26 00:13:37 nit: I don't think we typically use "const" for po
Philippe 2014/04/28 12:23:14 Unfortunately, yes. I saw that const is underused
reveman 2014/04/28 15:39:16 I agree that it's valuable and would prefer that i
Philippe 2014/04/28 15:53:45 I see, thanks. I went over all our discardable mem
willchan no longer on Chromium 2014/04/30 06:38:21 FWIW, I am positive on const pointers as well, but
45 scoped_ptr<DiscardableAshmemChunk> ashmem_chunk_;
46
47 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAshmem);
48 };
49
50 } // namespace internal
51 } // namespace base
52
53 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698