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

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

Issue 1374213002: [tracing] Display the locked size of discardable memory segment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_SHARED_MEMORY_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 bool Map(size_t size); 49 bool Map(size_t size);
50 50
51 // Unmaps the discardable shared memory from the caller's address space. 51 // Unmaps the discardable shared memory from the caller's address space.
52 // Returns true if successful; returns false on error or if the memory is 52 // Returns true if successful; returns false on error or if the memory is
53 // not mapped. 53 // not mapped.
54 bool Unmap(); 54 bool Unmap();
55 55
56 // The actual size of the mapped memory (may be larger than requested). 56 // The actual size of the mapped memory (may be larger than requested).
57 size_t mapped_size() const { return mapped_size_; } 57 size_t mapped_size() const { return mapped_size_; }
58 58
59 // The total size of locked segments by this instance of
60 // DiscardableSharedMemory. If the memory is shared with other process,
61 // then returns the total size of the segment if locked.
62 size_t LockedSize() const;
reveman 2015/09/29 12:29:10 I assume you're interested in being able to call t
ssid 2015/09/29 16:03:55 Maybe I should just rename it? instead of calculat
63
59 // Returns a shared memory handle for this DiscardableSharedMemory object. 64 // Returns a shared memory handle for this DiscardableSharedMemory object.
60 SharedMemoryHandle handle() const { return shared_memory_.handle(); } 65 SharedMemoryHandle handle() const { return shared_memory_.handle(); }
61 66
62 // Locks a range of memory so that it will not be purged by the system. 67 // Locks a range of memory so that it will not be purged by the system.
63 // The range of memory must be unlocked. The result of trying to lock an 68 // The range of memory must be unlocked. The result of trying to lock an
64 // already locked range is undefined. |offset| and |length| must both be 69 // already locked range is undefined. |offset| and |length| must both be
65 // a multiple of the page size as returned by GetPageSize(). 70 // a multiple of the page size as returned by GetPageSize().
66 // Passing 0 for |length| means "everything onward". 71 // Passing 0 for |length| means "everything onward".
67 // Returns SUCCESS if range was successfully locked and the memory is still 72 // Returns SUCCESS if range was successfully locked and the memory is still
68 // resident, PURGED if range was successfully locked but has been purged 73 // resident, PURGED if range was successfully locked but has been purged
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // synchronized somehow. Use a collision warner to detect incorrect usage. 146 // synchronized somehow. Use a collision warner to detect incorrect usage.
142 DFAKE_MUTEX(thread_collision_warner_); 147 DFAKE_MUTEX(thread_collision_warner_);
143 Time last_known_usage_; 148 Time last_known_usage_;
144 149
145 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); 150 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory);
146 }; 151 };
147 152
148 } // namespace base 153 } // namespace base
149 154
150 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ 155 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/discardable_shared_memory.cc » ('j') | content/common/discardable_shared_memory_heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698