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