1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "mojo/public/cpp/base/memory_allocator_dump_cross_process_uid_mojom_traits.h"
6 
7 namespace mojo {
8 
9 // static
10 bool StructTraits<mojo_base::mojom::MemoryAllocatorDumpCrossProcessUidDataView,
11                   base::trace_event::MemoryAllocatorDumpGuid>::
Read(mojo_base::mojom::MemoryAllocatorDumpCrossProcessUidDataView data,base::trace_event::MemoryAllocatorDumpGuid * out)12     Read(mojo_base::mojom::MemoryAllocatorDumpCrossProcessUidDataView data,
13          base::trace_event::MemoryAllocatorDumpGuid* out) {
14   // Receiving a zeroed MemoryAllocatorDumpCrossProcessUid is a bug.
15   if (data.value() == 0)
16     return false;
17 
18   *out = base::trace_event::MemoryAllocatorDumpGuid(data.value());
19   return true;
20 }
21 
22 }  // namespace mojo