OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "ipc/ipc_channel.h" | 6 #include "ipc/ipc_channel.h" |
7 #include "ipc/ipc_channel_mojo.h" | 7 #include "ipc/ipc_channel_mojo.h" |
8 #include "mojo/public/cpp/system/message_pipe.h" | 8 #include "mojo/public/cpp/system/message_pipe.h" |
9 | 9 |
10 namespace IPC { | 10 namespace IPC { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener); | 49 return Channel::Create(channel_handle, Channel::MODE_SERVER, listener); |
50 } | 50 } |
51 | 51 |
52 // static | 52 // static |
53 void Channel::GenerateMojoChannelHandlePair( | 53 void Channel::GenerateMojoChannelHandlePair( |
54 const std::string& name_postfix, | 54 const std::string& name_postfix, |
55 IPC::ChannelHandle* handle0, | 55 IPC::ChannelHandle* handle0, |
56 IPC::ChannelHandle* handle1) { | 56 IPC::ChannelHandle* handle1) { |
57 DCHECK_NE(handle0, handle1); | 57 DCHECK_NE(handle0, handle1); |
58 // |name| is only used for logging and to aid developers in debugging. It | |
59 // doesn't _need_ to be unique, but this string is probably more useful than a | |
60 // generic "ChannelMojo". | |
61 #if !defined(OS_NACL_SFI) | |
62 std::string name = "ChannelMojo-" + GenerateUniqueRandomChannelID(); | |
63 #else | |
64 std::string name = "ChannelMojo"; | |
65 #endif | |
66 if (!name_postfix.empty()) { | |
67 name += "-" + name_postfix; | |
68 } | |
69 mojo::MessagePipe message_pipe; | 58 mojo::MessagePipe message_pipe; |
70 *handle0 = ChannelHandle(name); | 59 *handle0 = ChannelHandle(message_pipe.handle0.release()); |
71 handle0->mojo_handle = message_pipe.handle0.release(); | 60 *handle1 = ChannelHandle(message_pipe.handle1.release()); |
72 *handle1 = ChannelHandle(name); | |
73 handle1->mojo_handle = message_pipe.handle1.release(); | |
74 } | 61 } |
75 | 62 |
76 Channel::~Channel() { | 63 Channel::~Channel() { |
77 } | 64 } |
78 | 65 |
79 Channel::AssociatedInterfaceSupport* Channel::GetAssociatedInterfaceSupport() { | 66 Channel::AssociatedInterfaceSupport* Channel::GetAssociatedInterfaceSupport() { |
80 return nullptr; | 67 return nullptr; |
81 } | 68 } |
82 | 69 |
83 void Channel::Pause() { NOTREACHED(); } | 70 void Channel::Pause() { NOTREACHED(); } |
84 | 71 |
85 void Channel::Unpause(bool flush) { NOTREACHED(); } | 72 void Channel::Unpause(bool flush) { NOTREACHED(); } |
86 | 73 |
87 void Channel::Flush() { NOTREACHED(); } | 74 void Channel::Flush() { NOTREACHED(); } |
88 | 75 |
89 void Channel::OnSetAttachmentBrokerEndpoint() { | 76 void Channel::OnSetAttachmentBrokerEndpoint() { |
90 CHECK(!did_start_connect_); | 77 CHECK(!did_start_connect_); |
91 } | 78 } |
92 | 79 |
93 void Channel::WillConnect() { | 80 void Channel::WillConnect() { |
94 did_start_connect_ = true; | 81 did_start_connect_ = true; |
95 } | 82 } |
96 | 83 |
97 } // namespace IPC | 84 } // namespace IPC |
98 | 85 |
OLD | NEW |