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 "ipc/mojo/ipc_mojo_bootstrap.h" | 5 #include "ipc/mojo/ipc_mojo_bootstrap.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/process/process_handle.h" | 8 #include "base/process/process_handle.h" |
9 #include "ipc/ipc_message_utils.h" | 9 #include "ipc/ipc_message_utils.h" |
10 #include "ipc/ipc_platform_file.h" | 10 #include "ipc/ipc_platform_file.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void MojoClientBootstrap::OnChannelConnected(int32 peer_pid) { | 166 void MojoClientBootstrap::OnChannelConnected(int32 peer_pid) { |
167 } | 167 } |
168 | 168 |
169 } // namespace | 169 } // namespace |
170 | 170 |
171 // MojoBootstrap | 171 // MojoBootstrap |
172 | 172 |
173 // static | 173 // static |
174 scoped_ptr<MojoBootstrap> MojoBootstrap::Create(ChannelHandle handle, | 174 scoped_ptr<MojoBootstrap> MojoBootstrap::Create(ChannelHandle handle, |
175 Channel::Mode mode, | 175 Channel::Mode mode, |
176 Delegate* delegate) { | 176 Delegate* delegate, |
| 177 AttachmentBroker* broker) { |
177 CHECK(mode == Channel::MODE_CLIENT || mode == Channel::MODE_SERVER); | 178 CHECK(mode == Channel::MODE_CLIENT || mode == Channel::MODE_SERVER); |
178 scoped_ptr<MojoBootstrap> self = | 179 scoped_ptr<MojoBootstrap> self = |
179 mode == Channel::MODE_CLIENT | 180 mode == Channel::MODE_CLIENT |
180 ? scoped_ptr<MojoBootstrap>(new MojoClientBootstrap()) | 181 ? scoped_ptr<MojoBootstrap>(new MojoClientBootstrap()) |
181 : scoped_ptr<MojoBootstrap>(new MojoServerBootstrap()); | 182 : scoped_ptr<MojoBootstrap>(new MojoServerBootstrap()); |
| 183 |
182 scoped_ptr<Channel> bootstrap_channel = | 184 scoped_ptr<Channel> bootstrap_channel = |
183 Channel::Create(handle, mode, self.get()); | 185 Channel::Create(handle, mode, self.get(), broker); |
184 self->Init(bootstrap_channel.Pass(), delegate); | 186 self->Init(bootstrap_channel.Pass(), delegate); |
185 return self.Pass(); | 187 return self.Pass(); |
186 } | 188 } |
187 | 189 |
188 MojoBootstrap::MojoBootstrap() : delegate_(NULL), state_(STATE_INITIALIZED) { | 190 MojoBootstrap::MojoBootstrap() : delegate_(NULL), state_(STATE_INITIALIZED) { |
189 } | 191 } |
190 | 192 |
191 MojoBootstrap::~MojoBootstrap() { | 193 MojoBootstrap::~MojoBootstrap() { |
192 } | 194 } |
193 | 195 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 int MojoBootstrap::GetClientFileDescriptor() const { | 234 int MojoBootstrap::GetClientFileDescriptor() const { |
233 return channel_->GetClientFileDescriptor(); | 235 return channel_->GetClientFileDescriptor(); |
234 } | 236 } |
235 | 237 |
236 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { | 238 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { |
237 return channel_->TakeClientFileDescriptor(); | 239 return channel_->TakeClientFileDescriptor(); |
238 } | 240 } |
239 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 241 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
240 | 242 |
241 } // namespace IPC | 243 } // namespace IPC |
OLD | NEW |