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

Unified Diff: chrome/common/ipc_channel_proxy.cc

Issue 42113: Ensure that a listener's OnChannelConnected is called before OnMessageReceive... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/ipc_channel_proxy.h ('k') | chrome/common/ipc_sync_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_channel_proxy.cc
===================================================================
--- chrome/common/ipc_channel_proxy.cc (revision 11508)
+++ chrome/common/ipc_channel_proxy.cc (working copy)
@@ -18,7 +18,9 @@
: listener_message_loop_(MessageLoop::current()),
listener_(listener),
ipc_message_loop_(ipc_message_loop),
- channel_(NULL) {
+ channel_(NULL),
+ peer_pid_(0),
+ channel_connected_called_(false) {
if (filter)
filters_.push_back(filter);
}
@@ -68,12 +70,13 @@
// Called on the IPC::Channel thread
void ChannelProxy::Context::OnChannelConnected(int32 peer_pid) {
+ peer_pid_ = peer_pid;
for (size_t i = 0; i < filters_.size(); ++i)
filters_[i]->OnChannelConnected(peer_pid);
// See above comment about using listener_message_loop_ here.
listener_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &Context::OnDispatchConnected, peer_pid));
+ this, &Context::OnDispatchConnected));
}
// Called on the IPC::Channel thread
@@ -160,6 +163,8 @@
if (!listener_)
return;
+ OnDispatchConnected();
+
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging* logger = Logging::current();
if (message.type() == IPC_LOGGING_ID) {
@@ -180,9 +185,13 @@
}
// Called on the listener's thread
-void ChannelProxy::Context::OnDispatchConnected(int32 peer_pid) {
+void ChannelProxy::Context::OnDispatchConnected() {
+ if (channel_connected_called_)
+ return;
+
+ channel_connected_called_ = true;
if (listener_)
- listener_->OnChannelConnected(peer_pid);
+ listener_->OnChannelConnected(peer_pid_);
}
// Called on the listener's thread
« no previous file with comments | « chrome/common/ipc_channel_proxy.h ('k') | chrome/common/ipc_sync_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698