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

Unified Diff: ipc/ipc_channel_proxy.cc

Issue 9968111: Make IPC channels track their peer process ID (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_proxy.cc
===================================================================
--- ipc/ipc_channel_proxy.cc (revision 130443)
+++ ipc/ipc_channel_proxy.cc (working copy)
@@ -66,8 +66,8 @@
: listener_message_loop_(base::MessageLoopProxy::current()),
listener_(listener),
ipc_message_loop_(ipc_message_loop),
- peer_pid_(0),
- channel_connected_called_(false) {
+ channel_connected_called_(false),
+ peer_pid_(base::kNullProcessId) {
}
ChannelProxy::Context::~Context() {
@@ -126,7 +126,8 @@
// the filter is run on the IO thread.
OnAddFilter();
- peer_pid_ = peer_pid;
+ // We cache off the peer_pid so it can be safely accessed from both threads.
+ peer_pid_ = channel_->peer_pid();
for (size_t i = 0; i < filters_.size(); ++i)
filters_[i]->OnChannelConnected(peer_pid);
@@ -386,6 +387,10 @@
context()->ClearIPCMessageLoop();
}
+base::ProcessId ChannelProxy::peer_pid() const {
+ return context_.get() ? context_->peer_pid_ : base::kNullProcessId;
jam 2012/04/05 00:11:42 are you sure you need to null check context_?
jschuh 2012/04/05 00:23:06 You're right. It's always passed or created in the
+}
+
#if defined(OS_POSIX) && !defined(OS_NACL)
// See the TODO regarding lazy initialization of the channel in
// ChannelProxy::Init().
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698