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

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..11d57c12043530424d8a13164d521b010ee0993f 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,28 @@ 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;
+ if (!it.ReadInt(&claimed_pid)) {
NOTREACHED();
- // Something went wrong. Abort connection.
Close();
listener()->OnChannelError();
return;
}
+
+ if (validate_client_) {
+ int32 secret;
+ bool result = it.ReadInt(&secret);
+ if (!result || secret != client_secret_) {
+ NOTREACHED();
jam 2012/12/17 16:21:57 seems unfortunate to duplicate this little block t
+ 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