OLD | NEW |
---|---|
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 11 matching lines...) Expand all Loading... | |
22 #endif | 22 #endif |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 | 25 |
26 // Platform abstraction for discardable shared memory. | 26 // Platform abstraction for discardable shared memory. |
27 // | 27 // |
28 // This class is not thread-safe. Clients are responsible for synchronizing | 28 // This class is not thread-safe. Clients are responsible for synchronizing |
29 // access to an instance of this class. | 29 // access to an instance of this class. |
30 class BASE_EXPORT DiscardableSharedMemory { | 30 class BASE_EXPORT DiscardableSharedMemory { |
31 public: | 31 public: |
32 // Used by other allocators to expess sub-allocation from discardable memory | |
33 // heap for tracing. To expess any suballocation, the dump providers need to | |
34 // create a sub-allocation edge from this node. | |
35 // E.g.: ProcessMemoryDump::AddSuballocation(skia_dump_guid, | |
36 // kAllocatedObjectsDumpName); | |
37 static const char kAllocatedObjectsDumpName[]; | |
reveman
2015/07/29 18:32:11
I don't think we want this here. We shouldn't assu
ssid
2015/07/29 19:36:22
Do you think DiscardableMemoryAllocator is a bette
reveman
2015/07/30 16:00:59
Yes, DiscardableMemoryAllocator is better. That na
ssid
2015/07/30 20:05:15
Thanks I din't know this existed.
| |
38 | |
32 enum LockResult { SUCCESS, PURGED, FAILED }; | 39 enum LockResult { SUCCESS, PURGED, FAILED }; |
33 | 40 |
34 DiscardableSharedMemory(); | 41 DiscardableSharedMemory(); |
35 | 42 |
36 // Create a new DiscardableSharedMemory object from an existing, open shared | 43 // Create a new DiscardableSharedMemory object from an existing, open shared |
37 // memory file. Memory must be locked. | 44 // memory file. Memory must be locked. |
38 explicit DiscardableSharedMemory(SharedMemoryHandle handle); | 45 explicit DiscardableSharedMemory(SharedMemoryHandle handle); |
39 | 46 |
40 // Closes any open files. | 47 // Closes any open files. |
41 virtual ~DiscardableSharedMemory(); | 48 virtual ~DiscardableSharedMemory(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // synchronized somehow. Use a collision warner to detect incorrect usage. | 148 // synchronized somehow. Use a collision warner to detect incorrect usage. |
142 DFAKE_MUTEX(thread_collision_warner_); | 149 DFAKE_MUTEX(thread_collision_warner_); |
143 Time last_known_usage_; | 150 Time last_known_usage_; |
144 | 151 |
145 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); | 152 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); |
146 }; | 153 }; |
147 | 154 |
148 } // namespace base | 155 } // namespace base |
149 | 156 |
150 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ | 157 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ |
OLD | NEW |