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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EMIT_TRACE_EVENT(*translated_message); | 185 EMIT_TRACE_EVENT(*translated_message); |
186 HandleInternalMessage(*translated_message); | 186 HandleInternalMessage(*translated_message); |
187 HandleDispatchError(*translated_message); | 187 HandleDispatchError(*translated_message); |
188 return true; | 188 return true; |
189 } | 189 } |
190 | 190 |
191 return HandleExternalMessage(translated_message); | 191 return HandleExternalMessage(translated_message); |
192 } | 192 } |
193 | 193 |
194 bool ChannelReader::HandleExternalMessage(Message* external_message) { | 194 bool ChannelReader::HandleExternalMessage(Message* external_message) { |
195 if (!GetNonBrokeredAttachments(external_message)) | 195 if (!GetAttachments(external_message)) |
196 return false; | 196 return false; |
197 | 197 |
198 DispatchMessage(external_message); | 198 DispatchMessage(external_message); |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 void ChannelReader::HandleDispatchError(const Message& message) { | 202 void ChannelReader::HandleDispatchError(const Message& message) { |
203 if (message.dispatch_error()) | 203 if (message.dispatch_error()) |
204 listener_->OnBadMessageReceived(message); | 204 listener_->OnBadMessageReceived(message); |
205 } | 205 } |
206 | 206 |
207 bool ChannelReader::CheckMessageSize(size_t size) { | 207 bool ChannelReader::CheckMessageSize(size_t size) { |
208 if (size <= Channel::kMaximumMessageSize) { | 208 if (size <= Channel::kMaximumMessageSize) { |
209 return true; | 209 return true; |
210 } | 210 } |
211 input_overflow_buf_.clear(); | 211 input_overflow_buf_.clear(); |
212 LOG(ERROR) << "IPC message is too big: " << size; | 212 LOG(ERROR) << "IPC message is too big: " << size; |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 } // namespace internal | 216 } // namespace internal |
217 } // namespace IPC | 217 } // namespace IPC |
OLD | NEW |