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 29 matching lines...) Expand all Loading... |
40 Mode mode, | 40 Mode mode, |
41 Listener* listener); | 41 Listener* listener); |
42 ~ChannelNacl() override; | 42 ~ChannelNacl() override; |
43 | 43 |
44 // Channel implementation. | 44 // Channel implementation. |
45 base::ProcessId GetPeerPID() const override; | 45 base::ProcessId GetPeerPID() const override; |
46 base::ProcessId GetSelfPID() const override; | 46 base::ProcessId GetSelfPID() const override; |
47 bool Connect() override; | 47 bool Connect() override; |
48 void Close() override; | 48 void Close() override; |
49 bool Send(Message* message) override; | 49 bool Send(Message* message) override; |
50 AttachmentBroker* GetAttachmentBroker() override; | |
51 | 50 |
52 // Posted to the main thread by ReaderThreadRunner. | 51 // Posted to the main thread by ReaderThreadRunner. |
53 void DidRecvMsg(std::unique_ptr<MessageContents> contents); | 52 void DidRecvMsg(std::unique_ptr<MessageContents> contents); |
54 void ReadDidFail(); | 53 void ReadDidFail(); |
55 | 54 |
56 private: | 55 private: |
57 class ReaderThreadRunner; | 56 class ReaderThreadRunner; |
58 | 57 |
59 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 58 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
60 bool ProcessOutgoingMessages(); | 59 bool ProcessOutgoingMessages(); |
61 void CallOnChannelConnected(); | 60 void CallOnChannelConnected(); |
62 | 61 |
63 // ChannelReader implementation. | 62 // ChannelReader implementation. |
64 ReadState ReadData(char* buffer, | 63 ReadState ReadData(char* buffer, |
65 int buffer_len, | 64 int buffer_len, |
66 int* bytes_read) override; | 65 int* bytes_read) override; |
67 bool ShouldDispatchInputMessage(Message* msg) override; | 66 bool ShouldDispatchInputMessage(Message* msg) override; |
68 bool GetNonBrokeredAttachments(Message* msg) override; | 67 bool GetNonBrokeredAttachments(Message* msg) override; |
69 bool DidEmptyInputBuffers() override; | 68 bool DidEmptyInputBuffers() override; |
70 void HandleInternalMessage(const Message& msg) override; | 69 void HandleInternalMessage(const Message& msg) override; |
71 base::ProcessId GetSenderPID() override; | 70 base::ProcessId GetSenderPID() override; |
72 bool IsAttachmentBrokerEndpoint() override; | |
73 | 71 |
74 Mode mode_; | 72 Mode mode_; |
75 bool waiting_connect_; | 73 bool waiting_connect_; |
76 | 74 |
77 // The pipe used for communication. | 75 // The pipe used for communication. |
78 int pipe_; | 76 int pipe_; |
79 | 77 |
80 // The "name" of our pipe. On Windows this is the global identifier for | 78 // The "name" of our pipe. On Windows this is the global identifier for |
81 // the pipe. On POSIX it's used as a key in a local map of file descriptors. | 79 // the pipe. On POSIX it's used as a key in a local map of file descriptors. |
82 // For NaCl, we don't actually support looking up file descriptors by name, | 80 // For NaCl, we don't actually support looking up file descriptors by name, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::deque<linked_ptr<Message> > output_queue_; | 116 std::deque<linked_ptr<Message> > output_queue_; |
119 | 117 |
120 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; | 118 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; |
121 | 119 |
122 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); |
123 }; | 121 }; |
124 | 122 |
125 } // namespace IPC | 123 } // namespace IPC |
126 | 124 |
127 #endif // IPC_IPC_CHANNEL_NACL_H_ | 125 #endif // IPC_IPC_CHANNEL_NACL_H_ |
OLD | NEW |