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(Listener* listener) : listener_(listener) { | 10 ChannelReader::ChannelReader(Listener* listener) : listener_(listener) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Dispatch all complete messages in the data buffer. | 63 // Dispatch all complete messages in the data buffer. |
64 while (p < end) { | 64 while (p < end) { |
65 const char* message_tail = Message::FindNext(p, end); | 65 const char* message_tail = Message::FindNext(p, end); |
66 if (message_tail) { | 66 if (message_tail) { |
67 int len = static_cast<int>(message_tail - p); | 67 int len = static_cast<int>(message_tail - p); |
68 Message m(p, len); | 68 Message m(p, len); |
69 if (!WillDispatchInputMessage(&m)) | 69 if (!WillDispatchInputMessage(&m)) |
70 return false; | 70 return false; |
71 | 71 |
| 72 m.TraceMessageStep(); |
72 if (IsHelloMessage(m)) | 73 if (IsHelloMessage(m)) |
73 HandleHelloMessage(m); | 74 HandleHelloMessage(m); |
74 else | 75 else |
75 listener_->OnMessageReceived(m); | 76 listener_->OnMessageReceived(m); |
76 p = message_tail; | 77 p = message_tail; |
77 } else { | 78 } else { |
78 // Last message is partial. | 79 // Last message is partial. |
79 break; | 80 break; |
80 } | 81 } |
81 } | 82 } |
82 | 83 |
83 // Save any partial data in the overflow buffer. | 84 // Save any partial data in the overflow buffer. |
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 |