Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: ipc/ipc_channel_reader.cc

Issue 2493623002: Remove IPC::Endpoint. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_reader.h ('k') | ipc/ipc_channel_reader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 bool ChannelReader::HandleTranslatedMessage(Message* translated_message) { 182 bool ChannelReader::HandleTranslatedMessage(Message* translated_message) {
183 // Immediately handle internal messages. 183 // Immediately handle internal messages.
184 if (IsInternalMessage(*translated_message)) { 184 if (IsInternalMessage(*translated_message)) {
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 translated_message->set_sender_pid(GetSenderPID());
192
193 return HandleExternalMessage(translated_message); 191 return HandleExternalMessage(translated_message);
194 } 192 }
195 193
196 bool ChannelReader::HandleExternalMessage(Message* external_message) { 194 bool ChannelReader::HandleExternalMessage(Message* external_message) {
197 if (!GetNonBrokeredAttachments(external_message)) 195 if (!GetNonBrokeredAttachments(external_message))
198 return false; 196 return false;
199 197
200 DispatchMessage(external_message); 198 DispatchMessage(external_message);
201 return true; 199 return true;
202 } 200 }
203 201
204 void ChannelReader::HandleDispatchError(const Message& message) { 202 void ChannelReader::HandleDispatchError(const Message& message) {
205 if (message.dispatch_error()) 203 if (message.dispatch_error())
206 listener_->OnBadMessageReceived(message); 204 listener_->OnBadMessageReceived(message);
207 } 205 }
208 206
209 bool ChannelReader::CheckMessageSize(size_t size) { 207 bool ChannelReader::CheckMessageSize(size_t size) {
210 if (size <= Channel::kMaximumMessageSize) { 208 if (size <= Channel::kMaximumMessageSize) {
211 return true; 209 return true;
212 } 210 }
213 input_overflow_buf_.clear(); 211 input_overflow_buf_.clear();
214 LOG(ERROR) << "IPC message is too big: " << size; 212 LOG(ERROR) << "IPC message is too big: " << size;
215 return false; 213 return false;
216 } 214 }
217 215
218 } // namespace internal 216 } // namespace internal
219 } // namespace IPC 217 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_reader.h ('k') | ipc/ipc_channel_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698