| 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 UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ | 5 #ifndef UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ |
| 6 #define UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ | 6 #define UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool operator<(const GenericSharedMemoryId& other) const { | 36 bool operator<(const GenericSharedMemoryId& other) const { |
| 37 return id < other.id; | 37 return id < other.id; |
| 38 } | 38 } |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Generates GUID which can be used to trace shared memory using its | 41 // Generates GUID which can be used to trace shared memory using its |
| 42 // GenericSharedMemoryId. | 42 // GenericSharedMemoryId. |
| 43 GFX_EXPORT base::trace_event::MemoryAllocatorDumpGuid | 43 GFX_EXPORT base::trace_event::MemoryAllocatorDumpGuid |
| 44 GetGenericSharedMemoryGUIDForTracing( | 44 GetGenericSharedGpuMemoryGUIDForTracing( |
| 45 uint64_t tracing_process_id, | 45 uint64_t tracing_process_id, |
| 46 GenericSharedMemoryId generic_shared_memory_id); | 46 GenericSharedMemoryId generic_shared_memory_id); |
| 47 | 47 |
| 48 } // namespace gfx | 48 } // namespace gfx |
| 49 | 49 |
| 50 namespace BASE_HASH_NAMESPACE { | 50 namespace BASE_HASH_NAMESPACE { |
| 51 | 51 |
| 52 template <> | 52 template <> |
| 53 struct hash<gfx::GenericSharedMemoryId> { | 53 struct hash<gfx::GenericSharedMemoryId> { |
| 54 size_t operator()(gfx::GenericSharedMemoryId key) const { | 54 size_t operator()(gfx::GenericSharedMemoryId key) const { |
| 55 return BASE_HASH_NAMESPACE::hash<int>()(key.id); | 55 return BASE_HASH_NAMESPACE::hash<int>()(key.id); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 template <typename Second> | 59 template <typename Second> |
| 60 struct hash<std::pair<gfx::GenericSharedMemoryId, Second>> { | 60 struct hash<std::pair<gfx::GenericSharedMemoryId, Second>> { |
| 61 size_t operator()( | 61 size_t operator()( |
| 62 const std::pair<gfx::GenericSharedMemoryId, Second>& pair) const { | 62 const std::pair<gfx::GenericSharedMemoryId, Second>& pair) const { |
| 63 return base::HashInts(pair.first.id, pair.second); | 63 return base::HashInts(pair.first.id, pair.second); |
| 64 } | 64 } |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace BASE_HASH_NAMESPACE | 67 } // namespace BASE_HASH_NAMESPACE |
| 68 | 68 |
| 69 #endif // UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ | 69 #endif // UI_GFX_GENERIC_SHARED_MEMORY_ID_H_ |
| OLD | NEW |