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; | |
44 bool Connect(); | 43 bool Connect(); |
45 void Close(); | 44 void Close(); |
46 bool Send(Message* message); | 45 bool Send(Message* message); |
47 | 46 |
48 // Posted to the main thread by ReaderThreadRunner. | 47 // Posted to the main thread by ReaderThreadRunner. |
49 void DidRecvMsg(scoped_ptr<MessageContents> contents); | 48 void DidRecvMsg(scoped_ptr<MessageContents> contents); |
50 void ReadDidFail(); | 49 void ReadDidFail(); |
51 | 50 |
52 private: | 51 private: |
53 class ReaderThreadRunner; | 52 class ReaderThreadRunner; |
54 | 53 |
55 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 54 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
56 bool ProcessOutgoingMessages(); | 55 bool ProcessOutgoingMessages(); |
57 void CallOnChannelConnected(); | |
58 | 56 |
59 // ChannelReader implementation. | 57 // ChannelReader implementation. |
60 virtual ReadState ReadData(char* buffer, | 58 virtual ReadState ReadData(char* buffer, |
61 int buffer_len, | 59 int buffer_len, |
62 int* bytes_read) OVERRIDE; | 60 int* bytes_read) OVERRIDE; |
63 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; | 61 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; |
64 virtual bool DidEmptyInputBuffers() OVERRIDE; | 62 virtual bool DidEmptyInputBuffers() OVERRIDE; |
65 virtual void HandleInternalMessage(const Message& msg) OVERRIDE; | 63 virtual void HandleInternalMessage(const Message& msg) OVERRIDE; |
66 | 64 |
67 Mode mode_; | 65 Mode mode_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::deque<linked_ptr<Message> > output_queue_; | 109 std::deque<linked_ptr<Message> > output_queue_; |
112 | 110 |
113 base::WeakPtrFactory<ChannelImpl> weak_ptr_factory_; | 111 base::WeakPtrFactory<ChannelImpl> weak_ptr_factory_; |
114 | 112 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); |
116 }; | 114 }; |
117 | 115 |
118 } // namespace IPC | 116 } // namespace IPC |
119 | 117 |
120 #endif // IPC_IPC_CHANNEL_NACL_H_ | 118 #endif // IPC_IPC_CHANNEL_NACL_H_ |
OLD | NEW |