| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ipc_channel_nacl.h" | 5 #include "ipc/ipc_channel_nacl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 "ChannelNacl::Send", | 218 "ChannelNacl::Send", |
| 219 message->header()->flags, | 219 message->header()->flags, |
| 220 TRACE_EVENT_FLAG_FLOW_OUT); | 220 TRACE_EVENT_FLAG_FLOW_OUT); |
| 221 output_queue_.push_back(linked_ptr<Message>(message_ptr.release())); | 221 output_queue_.push_back(linked_ptr<Message>(message_ptr.release())); |
| 222 if (!waiting_connect_) | 222 if (!waiting_connect_) |
| 223 return ProcessOutgoingMessages(); | 223 return ProcessOutgoingMessages(); |
| 224 | 224 |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 | 227 |
| 228 AttachmentBroker* ChannelNacl::GetAttachmentBroker() { | |
| 229 return nullptr; | |
| 230 } | |
| 231 | |
| 232 void ChannelNacl::DidRecvMsg(std::unique_ptr<MessageContents> contents) { | 228 void ChannelNacl::DidRecvMsg(std::unique_ptr<MessageContents> contents) { |
| 233 // Close sets the pipe to -1. It's possible we'll get a buffer sent to us from | 229 // Close sets the pipe to -1. It's possible we'll get a buffer sent to us from |
| 234 // the reader thread after Close is called. If so, we ignore it. | 230 // the reader thread after Close is called. If so, we ignore it. |
| 235 if (pipe_ == -1) | 231 if (pipe_ == -1) |
| 236 return; | 232 return; |
| 237 | 233 |
| 238 linked_ptr<std::vector<char> > data(new std::vector<char>); | 234 linked_ptr<std::vector<char> > data(new std::vector<char>); |
| 239 data->swap(contents->data); | 235 data->swap(contents->data); |
| 240 read_queue_.push_back(data); | 236 read_queue_.push_back(data); |
| 241 | 237 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // should not receive the "Hello" message. | 381 // should not receive the "Hello" message. |
| 386 NOTREACHED(); | 382 NOTREACHED(); |
| 387 } | 383 } |
| 388 | 384 |
| 389 base::ProcessId ChannelNacl::GetSenderPID() { | 385 base::ProcessId ChannelNacl::GetSenderPID() { |
| 390 // The untrusted side of the IPC::Channel should never have to worry about | 386 // The untrusted side of the IPC::Channel should never have to worry about |
| 391 // sender's process id. | 387 // sender's process id. |
| 392 return base::kNullProcessId; | 388 return base::kNullProcessId; |
| 393 } | 389 } |
| 394 | 390 |
| 395 bool ChannelNacl::IsAttachmentBrokerEndpoint() { | |
| 396 return is_attachment_broker_endpoint(); | |
| 397 } | |
| 398 | |
| 399 // Channel's methods | 391 // Channel's methods |
| 400 | 392 |
| 401 // static | 393 // static |
| 402 std::unique_ptr<Channel> Channel::Create( | 394 std::unique_ptr<Channel> Channel::Create( |
| 403 const IPC::ChannelHandle& channel_handle, | 395 const IPC::ChannelHandle& channel_handle, |
| 404 Mode mode, | 396 Mode mode, |
| 405 Listener* listener) { | 397 Listener* listener) { |
| 406 return base::WrapUnique(new ChannelNacl(channel_handle, mode, listener)); | 398 return base::WrapUnique(new ChannelNacl(channel_handle, mode, listener)); |
| 407 } | 399 } |
| 408 | 400 |
| 409 } // namespace IPC | 401 } // namespace IPC |
| OLD | NEW |