| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "base/memory/shared_memory_handle.h" | 5 #include "base/memory/shared_memory_handle.h" |
| 6 | 6 |
| 7 namespace base { | 7 namespace base { |
| 8 | 8 |
| 9 SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle) = | 9 SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle) = |
| 10 default; | 10 default; |
| 11 | 11 |
| 12 SharedMemoryHandle& SharedMemoryHandle::operator=( | 12 SharedMemoryHandle& SharedMemoryHandle::operator=( |
| 13 const SharedMemoryHandle& handle) = default; | 13 const SharedMemoryHandle& handle) = default; |
| 14 | 14 |
| 15 base::UnguessableToken SharedMemoryHandle::GetGUID() const { | 15 base::UnguessableToken SharedMemoryHandle::GetGUID() const { |
| 16 return guid_; | 16 return guid_; |
| 17 } | 17 } |
| 18 | 18 |
| 19 size_t SharedMemoryHandle::GetSize() const { | 19 size_t SharedMemoryHandle::GetSize() const { |
| 20 return size_; | 20 return size_; |
| 21 } | 21 } |
| 22 | 22 |
| 23 std::string SharedMemoryHandle::GetGUIDNameForTracing() const { |
| 24 return "shared_memory/" + GetGUID().ToString(); |
| 25 } |
| 26 |
| 27 trace_event::MemoryAllocatorDumpGuid SharedMemoryHandle::GetGUIDForTracing() |
| 28 const { |
| 29 auto name = GetGUIDNameForTracing(); |
| 30 if (name.empty()) |
| 31 return base::trace_event::MemoryAllocatorDumpGuid(); |
| 32 return base::trace_event::MemoryAllocatorDumpGuid(name); |
| 33 } |
| 34 |
| 23 } // namespace base | 35 } // namespace base |
| OLD | NEW |