| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool MojoClientBootstrap::OnMessageReceived(const Message& message) { | 136 bool MojoClientBootstrap::OnMessageReceived(const Message& message) { |
| 137 if (state() != STATE_INITIALIZED) { | 137 if (state() != STATE_INITIALIZED) { |
| 138 set_state(STATE_ERROR); | 138 set_state(STATE_ERROR); |
| 139 LOG(ERROR) << "Got inconsistent message from server."; | 139 LOG(ERROR) << "Got inconsistent message from server."; |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 | 142 |
| 143 PlatformFileForTransit pipe; | 143 PlatformFileForTransit pipe; |
| 144 PickleIterator iter(message); | 144 base::PickleIterator iter(message); |
| 145 if (!ParamTraits<PlatformFileForTransit>::Read(&message, &iter, &pipe)) { | 145 if (!ParamTraits<PlatformFileForTransit>::Read(&message, &iter, &pipe)) { |
| 146 LOG(WARNING) << "Failed to read a file handle from bootstrap channel."; | 146 LOG(WARNING) << "Failed to read a file handle from bootstrap channel."; |
| 147 message.set_dispatch_error(); | 147 message.set_dispatch_error(); |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Sends ACK back. | 151 // Sends ACK back. |
| 152 Send(new Message()); | 152 Send(new Message()); |
| 153 set_state(STATE_READY); | 153 set_state(STATE_READY); |
| 154 delegate()->OnPipeAvailable( | 154 delegate()->OnPipeAvailable( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 int MojoBootstrap::GetClientFileDescriptor() const { | 232 int MojoBootstrap::GetClientFileDescriptor() const { |
| 233 return channel_->GetClientFileDescriptor(); | 233 return channel_->GetClientFileDescriptor(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { | 236 base::ScopedFD MojoBootstrap::TakeClientFileDescriptor() { |
| 237 return channel_->TakeClientFileDescriptor(); | 237 return channel_->TakeClientFileDescriptor(); |
| 238 } | 238 } |
| 239 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 239 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
| 240 | 240 |
| 241 } // namespace IPC | 241 } // namespace IPC |
| OLD | NEW |