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_READER_H_ | 5 #ifndef IPC_IPC_CHANNEL_READER_H_ |
6 #define IPC_IPC_CHANNEL_READER_H_ | 6 #define IPC_IPC_CHANNEL_READER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "ipc/brokerable_attachment.h" | |
16 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
17 #include "ipc/ipc_export.h" | 16 #include "ipc/ipc_export.h" |
18 | 17 |
19 namespace IPC { | 18 namespace IPC { |
20 namespace internal { | 19 namespace internal { |
21 | 20 |
22 // This class provides common pipe reading functionality for the | 21 // This class provides common pipe reading functionality for the |
23 // platform-specific IPC channel implementations. | 22 // platform-specific IPC channel implementations. |
24 // | 23 // |
25 // It does the common input buffer management and message dispatch, while the | 24 // It does the common input buffer management and message dispatch, while the |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) = 0; | 93 virtual ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) = 0; |
95 | 94 |
96 // Loads the required file desciptors into the given message. Returns true | 95 // Loads the required file desciptors into the given message. Returns true |
97 // on success. False means a fatal channel error. | 96 // on success. False means a fatal channel error. |
98 // | 97 // |
99 // This will read from the input_fds_ and read more handles from the FD | 98 // This will read from the input_fds_ and read more handles from the FD |
100 // pipe if necessary. | 99 // pipe if necessary. |
101 virtual bool ShouldDispatchInputMessage(Message* msg) = 0; | 100 virtual bool ShouldDispatchInputMessage(Message* msg) = 0; |
102 | 101 |
103 // Overridden by subclasses to get attachments that are sent alongside the IPC | 102 // Overridden by subclasses to get attachments that are sent alongside the IPC |
104 // channel (as opposed to through a broker). | 103 // channel. |
105 // Returns true on success. False means a fatal channel error. | 104 // Returns true on success. False means a fatal channel error. |
106 virtual bool GetNonBrokeredAttachments(Message* msg) = 0; | 105 virtual bool GetAttachments(Message* msg) = 0; |
107 | 106 |
108 // Performs post-dispatch checks. Called when all input buffers are empty, | 107 // Performs post-dispatch checks. Called when all input buffers are empty, |
109 // though there could be more data ready to be read from the OS. | 108 // though there could be more data ready to be read from the OS. |
110 virtual bool DidEmptyInputBuffers() = 0; | 109 virtual bool DidEmptyInputBuffers() = 0; |
111 | 110 |
112 // Handles internal messages, like the hello message sent on channel startup. | 111 // Handles internal messages, like the hello message sent on channel startup. |
113 virtual void HandleInternalMessage(const Message& msg) = 0; | 112 virtual void HandleInternalMessage(const Message& msg) = 0; |
114 | 113 |
115 // Exposed for testing purposes only. | 114 // Exposed for testing purposes only. |
116 virtual void DispatchMessage(Message* m); | 115 virtual void DispatchMessage(Message* m); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // of std::string::reserve() implementation. | 159 // of std::string::reserve() implementation. |
161 size_t max_input_buffer_size_; | 160 size_t max_input_buffer_size_; |
162 | 161 |
163 DISALLOW_COPY_AND_ASSIGN(ChannelReader); | 162 DISALLOW_COPY_AND_ASSIGN(ChannelReader); |
164 }; | 163 }; |
165 | 164 |
166 } // namespace internal | 165 } // namespace internal |
167 } // namespace IPC | 166 } // namespace IPC |
168 | 167 |
169 #endif // IPC_IPC_CHANNEL_READER_H_ | 168 #endif // IPC_IPC_CHANNEL_READER_H_ |
OLD | NEW |