OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace trace_event { | 15 namespace trace_event { |
16 | 16 |
17 class BASE_EXPORT MemoryAllocatorDumpGuid { | 17 class BASE_EXPORT MemoryAllocatorDumpGuid { |
18 public: | 18 public: |
| 19 // If the clients of base::SharedMemory should use the global dump guid(s) |
| 20 // created by SharedMemoryTracker. |
| 21 static bool UseSharedMemoryBasedGUIDs(); |
| 22 static void SetUseSharedMemoryBasedGUIDsForTesting(); |
| 23 |
19 MemoryAllocatorDumpGuid(); | 24 MemoryAllocatorDumpGuid(); |
20 explicit MemoryAllocatorDumpGuid(uint64_t guid); | 25 explicit MemoryAllocatorDumpGuid(uint64_t guid); |
21 | 26 |
22 // Utility ctor to hash a GUID if the caller prefers a string. The caller | 27 // Utility ctor to hash a GUID if the caller prefers a string. The caller |
23 // still has to ensure that |guid_str| is unique, per snapshot, within the | 28 // still has to ensure that |guid_str| is unique, per snapshot, within the |
24 // global scope of all the traced processes. | 29 // global scope of all the traced processes. |
25 explicit MemoryAllocatorDumpGuid(const std::string& guid_str); | 30 explicit MemoryAllocatorDumpGuid(const std::string& guid_str); |
26 | 31 |
27 uint64_t ToUint64() const { return guid_; } | 32 uint64_t ToUint64() const { return guid_; } |
28 | 33 |
(...skipping 17 matching lines...) Expand all Loading... |
46 private: | 51 private: |
47 uint64_t guid_; | 52 uint64_t guid_; |
48 | 53 |
49 // Deliberately copy-able. | 54 // Deliberately copy-able. |
50 }; | 55 }; |
51 | 56 |
52 } // namespace trace_event | 57 } // namespace trace_event |
53 } // namespace base | 58 } // namespace base |
54 | 59 |
55 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ | 60 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ |
OLD | NEW |