| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void MojoClientBootstrap::OnChannelConnected(int32_t peer_pid) { | 141 void MojoClientBootstrap::OnChannelConnected(int32_t peer_pid) { |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 // MojoBootstrap | 146 // MojoBootstrap |
| 147 | 147 |
| 148 // static | 148 // static |
| 149 scoped_ptr<MojoBootstrap> MojoBootstrap::Create(ChannelHandle handle, | 149 scoped_ptr<MojoBootstrap> MojoBootstrap::Create(ChannelHandle handle, |
| 150 Channel::Mode mode, | 150 Channel::Mode mode, |
| 151 Delegate* delegate, | 151 Delegate* delegate) { |
| 152 AttachmentBroker* broker) { | |
| 153 CHECK(mode == Channel::MODE_CLIENT || mode == Channel::MODE_SERVER); | 152 CHECK(mode == Channel::MODE_CLIENT || mode == Channel::MODE_SERVER); |
| 154 scoped_ptr<MojoBootstrap> self = | 153 scoped_ptr<MojoBootstrap> self = |
| 155 mode == Channel::MODE_CLIENT | 154 mode == Channel::MODE_CLIENT |
| 156 ? scoped_ptr<MojoBootstrap>(new MojoClientBootstrap()) | 155 ? scoped_ptr<MojoBootstrap>(new MojoClientBootstrap()) |
| 157 : scoped_ptr<MojoBootstrap>(new MojoServerBootstrap()); | 156 : scoped_ptr<MojoBootstrap>(new MojoServerBootstrap()); |
| 158 | 157 |
| 159 scoped_ptr<Channel> bootstrap_channel = | 158 scoped_ptr<Channel> bootstrap_channel = |
| 160 Channel::Create(handle, mode, self.get(), broker); | 159 Channel::Create(handle, mode, self.get()); |
| 161 self->Init(bootstrap_channel.Pass(), delegate); | 160 self->Init(bootstrap_channel.Pass(), delegate); |
| 162 return self.Pass(); | 161 return self.Pass(); |
| 163 } | 162 } |
| 164 | 163 |
| 165 MojoBootstrap::MojoBootstrap() : delegate_(NULL), state_(STATE_INITIALIZED) { | 164 MojoBootstrap::MojoBootstrap() : delegate_(NULL), state_(STATE_INITIALIZED) { |
| 166 } | 165 } |
| 167 | 166 |
| 168 MojoBootstrap::~MojoBootstrap() { | 167 MojoBootstrap::~MojoBootstrap() { |
| 169 } | 168 } |
| 170 | 169 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 int MojoBootstrap::GetClientFileDescriptor() const { | 208 int MojoBootstrap::GetClientFileDescriptor() const { |
| 210 return channel_->GetClientFileDescriptor(); | 209 return channel_->GetClientFileDescriptor(); |
| 211 } | 210 } |
| 212 | 211 |
| 213 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { | 212 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { |
| 214 return channel_->TakeClientFileDescriptor(); | 213 return channel_->TakeClientFileDescriptor(); |
| 215 } | 214 } |
| 216 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 215 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
| 217 | 216 |
| 218 } // namespace IPC | 217 } // namespace IPC |
| OLD | NEW |