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

Side by Side Diff: ipc/ipc_channel_reader.cc

Issue 1262543003: ipc: Create an unforgeable mechanism to get the process id of the sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dchecks. Created 5 years, 4 months 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ipc/ipc_listener.h" 9 #include "ipc/ipc_listener.h"
10 #include "ipc/ipc_logging.h" 10 #include "ipc/ipc_logging.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return DISPATCH_WAITING_ON_BROKER; 143 return DISPATCH_WAITING_ON_BROKER;
144 } 144 }
145 145
146 DispatchMessage(m); 146 DispatchMessage(m);
147 queued_messages_.erase(queued_messages_.begin()); 147 queued_messages_.erase(queued_messages_.begin());
148 } 148 }
149 return DISPATCH_FINISHED; 149 return DISPATCH_FINISHED;
150 } 150 }
151 151
152 void ChannelReader::DispatchMessage(Message* m) { 152 void ChannelReader::DispatchMessage(Message* m) {
153 m->set_sender_pid(GetSenderPID());
154
153 #ifdef IPC_MESSAGE_LOG_ENABLED 155 #ifdef IPC_MESSAGE_LOG_ENABLED
154 std::string name; 156 std::string name;
155 Logging::GetInstance()->GetMessageText(m->type(), &name, m, NULL); 157 Logging::GetInstance()->GetMessageText(m->type(), &name, m, NULL);
156 TRACE_EVENT1("ipc,toplevel", "ChannelReader::DispatchInputData", "name", 158 TRACE_EVENT1("ipc,toplevel", "ChannelReader::DispatchInputData", "name",
157 name); 159 name);
158 #else 160 #else
159 TRACE_EVENT2("ipc,toplevel", "ChannelReader::DispatchInputData", "class", 161 TRACE_EVENT2("ipc,toplevel", "ChannelReader::DispatchInputData", "class",
160 IPC_MESSAGE_ID_CLASS(m->type()), "line", 162 IPC_MESSAGE_ID_CLASS(m->type()), "line",
161 IPC_MESSAGE_ID_LINE(m->type())); 163 IPC_MESSAGE_ID_LINE(m->type()));
162 #endif 164 #endif
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 219 }
218 220
219 void ChannelReader::StopObservingAttachmentBroker() { 221 void ChannelReader::StopObservingAttachmentBroker() {
220 #if USE_ATTACHMENT_BROKER 222 #if USE_ATTACHMENT_BROKER
221 GetAttachmentBroker()->RemoveObserver(this); 223 GetAttachmentBroker()->RemoveObserver(this);
222 #endif // USE_ATTACHMENT_BROKER 224 #endif // USE_ATTACHMENT_BROKER
223 } 225 }
224 226
225 } // namespace internal 227 } // namespace internal
226 } // namespace IPC 228 } // 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