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 #ifndef MOJO_PUBLIC_CPP_BASE_PROCESS_ID_MOJOM_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BASE_PROCESS_ID_MOJOM_TRAITS_H_ 7 8 #include "base/component_export.h" 9 #include "base/process/process_handle.h" 10 #include "mojo/public/mojom/base/process_id.mojom-shared.h" 11 12 namespace mojo { 13 14 template <> COMPONENT_EXPORT(MOJO_BASE_MOJOM)15struct COMPONENT_EXPORT(MOJO_BASE_MOJOM) 16 StructTraits<mojo_base::mojom::ProcessIdDataView, base::ProcessId> { 17 static uint32_t pid(const base::ProcessId& process_id) { 18 return static_cast<uint32_t>(process_id); 19 } 20 21 static bool Read(mojo_base::mojom::ProcessIdDataView data, 22 base::ProcessId* process_id); 23 }; 24 25 } // namespace mojo 26 27 #endif // MOJO_PUBLIC_CPP_BASE_PROCESS_ID_MOJOM_TRAITS_H_