| 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 #ifndef IPC_IPC_CHANNEL_NACL_H_ | 5 #ifndef IPC_IPC_CHANNEL_NACL_H_ |
| 6 #define IPC_IPC_CHANNEL_NACL_H_ | 6 #define IPC_IPC_CHANNEL_NACL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 56 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
| 57 bool ProcessOutgoingMessages(); | 57 bool ProcessOutgoingMessages(); |
| 58 void CallOnChannelConnected(); | 58 void CallOnChannelConnected(); |
| 59 | 59 |
| 60 // ChannelReader implementation. | 60 // ChannelReader implementation. |
| 61 ReadState ReadData(char* buffer, | 61 ReadState ReadData(char* buffer, |
| 62 int buffer_len, | 62 int buffer_len, |
| 63 int* bytes_read) override; | 63 int* bytes_read) override; |
| 64 bool ShouldDispatchInputMessage(Message* msg) override; | 64 bool ShouldDispatchInputMessage(Message* msg) override; |
| 65 bool GetAttachments(Message* msg) override; | 65 bool GetNonBrokeredAttachments(Message* msg) override; |
| 66 bool DidEmptyInputBuffers() override; | 66 bool DidEmptyInputBuffers() override; |
| 67 void HandleInternalMessage(const Message& msg) override; | 67 void HandleInternalMessage(const Message& msg) override; |
| 68 | 68 |
| 69 Mode mode_; | 69 Mode mode_; |
| 70 bool waiting_connect_; | 70 bool waiting_connect_; |
| 71 | 71 |
| 72 // The pipe used for communication. | 72 // The pipe used for communication. |
| 73 int pipe_; | 73 int pipe_; |
| 74 | 74 |
| 75 // The "name" of our pipe. On Windows this is the global identifier for | 75 // The "name" of our pipe. On Windows this is the global identifier for |
| (...skipping 19 matching lines...) Expand all Loading... |
| 95 // MessageContents object is the result of one call to "imc_recvmsg". | 95 // MessageContents object is the result of one call to "imc_recvmsg". |
| 96 // DidRecvMsg breaks the MessageContents out in to the data and the file | 96 // DidRecvMsg breaks the MessageContents out in to the data and the file |
| 97 // descriptors, and puts them on these two queues. | 97 // descriptors, and puts them on these two queues. |
| 98 // TODO(dmichael): There's probably a more efficient way to emulate this with | 98 // TODO(dmichael): There's probably a more efficient way to emulate this with |
| 99 // a circular buffer or something, so we don't have to do so | 99 // a circular buffer or something, so we don't have to do so |
| 100 // many heap allocations. But it maybe isn't worth | 100 // many heap allocations. But it maybe isn't worth |
| 101 // the trouble given that we probably want to implement 1 and | 101 // the trouble given that we probably want to implement 1 and |
| 102 // 2 above in NaCl eventually. | 102 // 2 above in NaCl eventually. |
| 103 // When ReadData is called, it pulls the bytes out of this queue in order. | 103 // When ReadData is called, it pulls the bytes out of this queue in order. |
| 104 std::deque<linked_ptr<std::vector<char> > > read_queue_; | 104 std::deque<linked_ptr<std::vector<char> > > read_queue_; |
| 105 // Queue of file descriptor attachments extracted from imc_recvmsg messages. | 105 // Queue of file descriptors extracted from imc_recvmsg messages. |
| 106 std::vector<scoped_refptr<MessageAttachment>> input_attachments_; | 106 // NOTE: The implementation assumes underlying storage here is contiguous, so |
| 107 // don't change to something like std::deque<> without changing the |
| 108 // implementation! |
| 109 std::vector<int> input_fds_; |
| 107 | 110 |
| 108 // This queue is used when a message is sent prior to Connect having been | 111 // This queue is used when a message is sent prior to Connect having been |
| 109 // called. Normally after we're connected, the queue is empty. | 112 // called. Normally after we're connected, the queue is empty. |
| 110 std::deque<linked_ptr<Message> > output_queue_; | 113 std::deque<linked_ptr<Message> > output_queue_; |
| 111 | 114 |
| 112 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; | 115 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; |
| 113 | 116 |
| 114 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); | 117 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace IPC | 120 } // namespace IPC |
| 118 | 121 |
| 119 #endif // IPC_IPC_CHANNEL_NACL_H_ | 122 #endif // IPC_IPC_CHANNEL_NACL_H_ |
| OLD | NEW |