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

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

Issue 136723005: Align ashmem region sizes to page size after ashmem creation failed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test Created 6 years, 11 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_ALLOCATOR_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 26 matching lines...) Expand all
37 // ashmem regions and is expected to be greater or equal than 32 MBytes. 37 // ashmem regions and is expected to be greater or equal than 32 MBytes.
38 DiscardableMemoryAllocator(const std::string& name, 38 DiscardableMemoryAllocator(const std::string& name,
39 size_t ashmem_region_size); 39 size_t ashmem_region_size);
40 40
41 ~DiscardableMemoryAllocator(); 41 ~DiscardableMemoryAllocator();
42 42
43 // Note that the allocator must outlive the returned DiscardableMemory 43 // Note that the allocator must outlive the returned DiscardableMemory
44 // instance. 44 // instance.
45 scoped_ptr<DiscardableMemory> Allocate(size_t size); 45 scoped_ptr<DiscardableMemory> Allocate(size_t size);
46 46
47 // Returns the size that is used to create ashmem regions.
48 size_t ashmem_region_size();
willchan no longer on Chromium 2014/01/15 00:37:49 Should be const, and then you'd need to made the L
Philippe 2014/01/15 09:18:12 Yeah, I thought it would have been slightly unfort
willchan no longer on Chromium 2014/01/16 01:52:37 If there is any context on this "infinite" case th
Philippe 2014/01/16 09:24:21 I'm not aware of bugs/docs for this new infinite c
49
47 private: 50 private:
48 class AshmemRegion; 51 class AshmemRegion;
49 class DiscardableAshmemChunk; 52 class DiscardableAshmemChunk;
50 53
51 void DeleteAshmemRegion_Locked(AshmemRegion* region); 54 void DeleteAshmemRegion_Locked(AshmemRegion* region);
52 55
53 base::ThreadChecker thread_checker_; 56 base::ThreadChecker thread_checker_;
54 const std::string name_; 57 const std::string name_;
55 const size_t ashmem_region_size_;
56 base::Lock lock_; 58 base::Lock lock_;
willchan no longer on Chromium 2014/01/15 00:37:49 Shouldn't need base:: here.
Philippe 2014/01/15 09:18:12 Done.
59 size_t ashmem_region_size_;
57 ScopedVector<AshmemRegion> ashmem_regions_; 60 ScopedVector<AshmemRegion> ashmem_regions_;
58 61
59 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocator); 62 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAllocator);
60 }; 63 };
61 64
62 } // namespace internal 65 } // namespace internal
63 } // namespace base 66 } // namespace base
64 67
65 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_ 68 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698