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 namespace IPC { | 7 namespace IPC { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 ChannelReader::ChannelReader(Channel::Listener* listener) | 10 ChannelReader::ChannelReader(Channel::Listener* listener) |
11 : listener_(listener) { | 11 : listener_(listener) { |
| 12 memset(input_buf_, 0, sizeof(input_buf_)); |
12 } | 13 } |
13 | 14 |
14 ChannelReader::~ChannelReader() { | 15 ChannelReader::~ChannelReader() { |
15 } | 16 } |
16 | 17 |
17 bool ChannelReader::ProcessIncomingMessages() { | 18 bool ChannelReader::ProcessIncomingMessages() { |
18 while (true) { | 19 while (true) { |
19 int bytes_read = 0; | 20 int bytes_read = 0; |
20 ReadState read_state = ReadData(input_buf_, Channel::kReadBufferSize, | 21 ReadState read_state = ReadData(input_buf_, Channel::kReadBufferSize, |
21 &bytes_read); | 22 &bytes_read); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 input_overflow_buf_.assign(p, end - p); | 85 input_overflow_buf_.assign(p, end - p); |
85 | 86 |
86 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) | 87 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) |
87 return false; | 88 return false; |
88 return true; | 89 return true; |
89 } | 90 } |
90 | 91 |
91 | 92 |
92 } // namespace internal | 93 } // namespace internal |
93 } // namespace IPC | 94 } // namespace IPC |
OLD | NEW |