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 24 matching lines...) Expand all Loading... |
35 class ChannelNacl : public Channel, | 35 class ChannelNacl : public Channel, |
36 public internal::ChannelReader { | 36 public internal::ChannelReader { |
37 public: | 37 public: |
38 // Mirror methods of Channel, see ipc_channel.h for description. | 38 // Mirror methods of Channel, see ipc_channel.h for description. |
39 ChannelNacl(const IPC::ChannelHandle& channel_handle, | 39 ChannelNacl(const IPC::ChannelHandle& channel_handle, |
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; | |
46 bool Connect() override; | 45 bool Connect() override; |
47 void Close() override; | 46 void Close() override; |
48 bool Send(Message* message) override; | 47 bool Send(Message* message) override; |
49 | 48 |
50 // Posted to the main thread by ReaderThreadRunner. | 49 // Posted to the main thread by ReaderThreadRunner. |
51 void DidRecvMsg(std::unique_ptr<MessageContents> contents); | 50 void DidRecvMsg(std::unique_ptr<MessageContents> contents); |
52 void ReadDidFail(); | 51 void ReadDidFail(); |
53 | 52 |
54 private: | 53 private: |
55 class ReaderThreadRunner; | 54 class ReaderThreadRunner; |
56 | 55 |
57 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 56 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
58 bool ProcessOutgoingMessages(); | 57 bool ProcessOutgoingMessages(); |
59 void CallOnChannelConnected(); | 58 void CallOnChannelConnected(); |
60 | 59 |
61 // ChannelReader implementation. | 60 // ChannelReader implementation. |
62 ReadState ReadData(char* buffer, | 61 ReadState ReadData(char* buffer, |
63 int buffer_len, | 62 int buffer_len, |
64 int* bytes_read) override; | 63 int* bytes_read) override; |
65 bool ShouldDispatchInputMessage(Message* msg) override; | 64 bool ShouldDispatchInputMessage(Message* msg) override; |
66 bool GetNonBrokeredAttachments(Message* msg) override; | 65 bool GetNonBrokeredAttachments(Message* msg) override; |
67 bool DidEmptyInputBuffers() override; | 66 bool DidEmptyInputBuffers() override; |
68 void HandleInternalMessage(const Message& msg) override; | 67 void HandleInternalMessage(const Message& msg) override; |
69 base::ProcessId GetSenderPID() override; | |
70 | 68 |
71 Mode mode_; | 69 Mode mode_; |
72 bool waiting_connect_; | 70 bool waiting_connect_; |
73 | 71 |
74 // The pipe used for communication. | 72 // The pipe used for communication. |
75 int pipe_; | 73 int pipe_; |
76 | 74 |
77 // 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 |
78 // the pipe. On POSIX it's used as a key in a local map of file descriptors. | 76 // the pipe. On POSIX it's used as a key in a local map of file descriptors. |
79 // For NaCl, we don't actually support looking up file descriptors by name, | 77 // 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... |
115 std::deque<linked_ptr<Message> > output_queue_; | 113 std::deque<linked_ptr<Message> > output_queue_; |
116 | 114 |
117 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; | 115 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; |
118 | 116 |
119 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); | 117 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); |
120 }; | 118 }; |
121 | 119 |
122 } // namespace IPC | 120 } // namespace IPC |
123 | 121 |
124 #endif // IPC_IPC_CHANNEL_NACL_H_ | 122 #endif // IPC_IPC_CHANNEL_NACL_H_ |
OLD | NEW |