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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // read or write without blocking. | 33 // read or write without blocking. |
34 class Channel::ChannelImpl : public internal::ChannelReader { | 34 class Channel::ChannelImpl : public internal::ChannelReader { |
35 public: | 35 public: |
36 // Mirror methods of Channel, see ipc_channel.h for description. | 36 // Mirror methods of Channel, see ipc_channel.h for description. |
37 ChannelImpl(const IPC::ChannelHandle& channel_handle, | 37 ChannelImpl(const IPC::ChannelHandle& channel_handle, |
38 Mode mode, | 38 Mode mode, |
39 Listener* listener); | 39 Listener* listener); |
40 virtual ~ChannelImpl(); | 40 virtual ~ChannelImpl(); |
41 | 41 |
42 // Channel implementation. | 42 // Channel implementation. |
| 43 base::ProcessId peer_pid() const; |
43 bool Connect(); | 44 bool Connect(); |
44 void Close(); | 45 void Close(); |
45 bool Send(Message* message); | 46 bool Send(Message* message); |
46 | 47 |
47 // Posted to the main thread by ReaderThreadRunner. | 48 // Posted to the main thread by ReaderThreadRunner. |
48 void DidRecvMsg(scoped_ptr<MessageContents> contents); | 49 void DidRecvMsg(scoped_ptr<MessageContents> contents); |
49 void ReadDidFail(); | 50 void ReadDidFail(); |
50 | 51 |
51 private: | 52 private: |
52 class ReaderThreadRunner; | 53 class ReaderThreadRunner; |
53 | 54 |
54 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 55 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
55 bool ProcessOutgoingMessages(); | 56 bool ProcessOutgoingMessages(); |
| 57 void CallOnChannelConnected(); |
56 | 58 |
57 // ChannelReader implementation. | 59 // ChannelReader implementation. |
58 virtual ReadState ReadData(char* buffer, | 60 virtual ReadState ReadData(char* buffer, |
59 int buffer_len, | 61 int buffer_len, |
60 int* bytes_read) OVERRIDE; | 62 int* bytes_read) OVERRIDE; |
61 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; | 63 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; |
62 virtual bool DidEmptyInputBuffers() OVERRIDE; | 64 virtual bool DidEmptyInputBuffers() OVERRIDE; |
63 virtual void HandleInternalMessage(const Message& msg) OVERRIDE; | 65 virtual void HandleInternalMessage(const Message& msg) OVERRIDE; |
64 | 66 |
65 Mode mode_; | 67 Mode mode_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 std::deque<linked_ptr<Message> > output_queue_; | 111 std::deque<linked_ptr<Message> > output_queue_; |
110 | 112 |
111 base::WeakPtrFactory<ChannelImpl> weak_ptr_factory_; | 113 base::WeakPtrFactory<ChannelImpl> weak_ptr_factory_; |
112 | 114 |
113 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); | 115 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); |
114 }; | 116 }; |
115 | 117 |
116 } // namespace IPC | 118 } // namespace IPC |
117 | 119 |
118 #endif // IPC_IPC_CHANNEL_NACL_H_ | 120 #endif // IPC_IPC_CHANNEL_NACL_H_ |
OLD | NEW |