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

Unified Diff: ipc/ipc_channel_win.cc

Issue 11570038: Remove IPC::MessageIterator. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/indexed_db/indexed_db_message_filter.cc ('k') | ipc/ipc_message_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_win.cc
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc
index 10af1fecdb34a4317c3a4588f9788ba6dbff4f17..afed565339260253e4790e76a2e9e703711ad8ae 100644
--- a/ipc/ipc_channel_win.cc
+++ b/ipc/ipc_channel_win.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/pickle.h"
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
@@ -153,17 +154,24 @@ bool Channel::ChannelImpl::WillDispatchInputMessage(Message* msg) {
void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) {
// The hello message contains one parameter containing the PID.
- MessageIterator it = MessageIterator(msg);
- int32 claimed_pid = it.NextInt();
- if (validate_client_ && (it.NextInt() != client_secret_)) {
+ PickleIterator it(msg);
+ int32 claimed_pid;
+ bool failed = !it.ReadInt(&claimed_pid);
+
+ if (!failed && validate_client_) {
+ int32 secret;
+ failed = it.ReadInt(&secret) ? (secret != client_secret_) : true;
+ }
+
+ if (failed) {
NOTREACHED();
- // Something went wrong. Abort connection.
Close();
listener()->OnChannelError();
return;
}
+
peer_pid_ = claimed_pid;
- // validation completed.
+ // Validation completed.
validate_client_ = false;
listener()->OnChannelConnected(claimed_pid);
}
« no previous file with comments | « content/common/indexed_db/indexed_db_message_filter.cc ('k') | ipc/ipc_message_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698