Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / ipc / mojo / ipc_mojo_param_traits.cc
blob1bb5256a742e0fe8b84e82d82d3ce6aa39eac240
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.
5 #include "ipc/mojo/ipc_mojo_param_traits.h"
7 #include "ipc/ipc_message_utils.h"
8 #include "ipc/mojo/ipc_mojo_message_helper.h"
10 namespace IPC {
12 void ParamTraits<mojo::MessagePipeHandle>::Write(Message* m,
13 const param_type& p) {
14 WriteParam(m, p.is_valid());
15 if (p.is_valid())
16 MojoMessageHelper::WriteMessagePipeTo(m, mojo::ScopedMessagePipeHandle(p));
19 bool ParamTraits<mojo::MessagePipeHandle>::Read(const Message* m,
20 base::PickleIterator* iter,
21 param_type* r) {
22 bool is_valid;
23 if (!ReadParam(m, iter, &is_valid))
24 return false;
25 if (!is_valid)
26 return true;
28 mojo::ScopedMessagePipeHandle handle;
29 if (!MojoMessageHelper::ReadMessagePipeFrom(m, iter, &handle))
30 return false;
31 DCHECK(handle.is_valid());
32 *r = handle.release();
33 return true;
36 void ParamTraits<mojo::MessagePipeHandle>::Log(const param_type& p,
37 std::string* l) {
38 l->append("mojo::MessagePipeHandle(");
39 LogParam(p.value(), l);
40 l->append(")");
43 } // namespace IPC