Chromium Code Reviews| 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 // Eg. : ProcessMemoryDump::AddSuballocation(skia_dump_guid, | |
|
petrcermak
2015/07/29 16:38:59
nit: There should be a dot after "E" and no space
ssid
2015/07/29 16:57:37
Done.
| |
| 36 // kDiscardableSegmentsDumpName); | |
|
petrcermak
2015/07/29 16:38:59
How is this related to the constant??? Shouldn't i
ssid
2015/07/29 16:57:37
Done.
| |
| 37 static const char kAllocatedObjectsDumpName[]; | |
| 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 |