ipc_mojo_param_traits.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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
  3. // found in the LICENSE file.
  4. #ifndef IPC_IPC_MOJO_PARAM_TRAITS_H_
  5. #define IPC_IPC_MOJO_PARAM_TRAITS_H_
  6. #include <string>
  7. #include "base/component_export.h"
  8. #include "ipc/ipc_param_traits.h"
  9. #include "mojo/public/cpp/system/data_pipe.h"
  10. #include "mojo/public/cpp/system/message_pipe.h"
  11. namespace base {
  12. class Pickle;
  13. class PickleIterator;
  14. }
  15. namespace IPC {
  16. template <>
  17. struct COMPONENT_EXPORT(IPC) ParamTraits<mojo::MessagePipeHandle> {
  18. typedef mojo::MessagePipeHandle param_type;
  19. static void Write(base::Pickle* m, const param_type& p);
  20. static bool Read(const base::Pickle* m, base::PickleIterator* iter,
  21. param_type* r);
  22. static void Log(const param_type& p, std::string* l);
  23. };
  24. template <>
  25. struct COMPONENT_EXPORT(IPC) ParamTraits<mojo::DataPipeConsumerHandle> {
  26. typedef mojo::DataPipeConsumerHandle param_type;
  27. static void Write(base::Pickle* m, const param_type& p);
  28. static bool Read(const base::Pickle* m,
  29. base::PickleIterator* iter,
  30. param_type* r);
  31. static void Log(const param_type& p, std::string* l);
  32. };
  33. } // namespace IPC
  34. #endif // IPC_IPC_MOJO_PARAM_TRAITS_H_