| 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 #include "ipc/ipc_channel_reader.h" | 5 #include "ipc/ipc_channel_reader.h" |
| 6 | 6 |
| 7 #include "ipc/ipc_listener.h" | 7 #include "ipc/ipc_listener.h" |
| 8 #include "ipc/ipc_logging.h" | 8 #include "ipc/ipc_logging.h" |
| 9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 DCHECK(bytes_read > 0); | 31 DCHECK(bytes_read > 0); |
| 32 if (!DispatchInputData(input_buf_, bytes_read)) | 32 if (!DispatchInputData(input_buf_, bytes_read)) |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool ChannelReader::AsyncReadComplete(int bytes_read) { | 37 bool ChannelReader::AsyncReadComplete(int bytes_read) { |
| 38 return DispatchInputData(input_buf_, bytes_read); | 38 return DispatchInputData(input_buf_, bytes_read); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool ChannelReader::IsInternalMessage(const Message& m) const { | 41 bool ChannelReader::IsInternalMessage(const Message& m) { |
| 42 return m.routing_id() == MSG_ROUTING_NONE && | 42 return m.routing_id() == MSG_ROUTING_NONE && |
| 43 m.type() >= Channel::CLOSE_FD_MESSAGE_TYPE && | 43 m.type() >= Channel::CLOSE_FD_MESSAGE_TYPE && |
| 44 m.type() <= Channel::HELLO_MESSAGE_TYPE; | 44 m.type() <= Channel::HELLO_MESSAGE_TYPE; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool ChannelReader::IsHelloMessage(const Message& m) const { | 47 bool ChannelReader::IsHelloMessage(const Message& m) { |
| 48 return m.routing_id() == MSG_ROUTING_NONE && | 48 return m.routing_id() == MSG_ROUTING_NONE && |
| 49 m.type() == Channel::HELLO_MESSAGE_TYPE; | 49 m.type() == Channel::HELLO_MESSAGE_TYPE; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool ChannelReader::DispatchInputData(const char* input_data, | 52 bool ChannelReader::DispatchInputData(const char* input_data, |
| 53 int input_data_len) { | 53 int input_data_len) { |
| 54 const char* p; | 54 const char* p; |
| 55 const char* end; | 55 const char* end; |
| 56 | 56 |
| 57 // Possibly combine with the overflow buffer to make a larger buffer. | 57 // Possibly combine with the overflow buffer to make a larger buffer. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 input_overflow_buf_.assign(p, end - p); | 108 input_overflow_buf_.assign(p, end - p); |
| 109 | 109 |
| 110 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) | 110 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) |
| 111 return false; | 111 return false; |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 } // namespace internal | 116 } // namespace internal |
| 117 } // namespace IPC | 117 } // namespace IPC |
| OLD | NEW |