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

Unified Diff: chrome/common/ipc_channel_posix.cc

Issue 155174: linux: fix renderer/plugin crash when loading multiple pages with plugins (Closed)
Patch Set: Created 11 years, 5 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_posix.h ('k') | chrome/plugin/plugin_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_channel_posix.cc
diff --git a/chrome/common/ipc_channel_posix.cc b/chrome/common/ipc_channel_posix.cc
index 63f2703d3fd3f94d7e389ad8e775ec0d9b96406a..16ae02cb0b861621a4e62b7b08b0c305d43a823f 100644
--- a/chrome/common/ipc_channel_posix.cc
+++ b/chrome/common/ipc_channel_posix.cc
@@ -89,12 +89,14 @@ class PipeMap {
// Remove the mapping for the given channel id. No error is signaled if the
// channel_id doesn't exist
- void Remove(const std::string& channel_id) {
+ void RemoveAndClose(const std::string& channel_id) {
AutoLock locked(lock_);
ChannelToFDMap::iterator i = map_.find(channel_id);
- if (i != map_.end())
+ if (i != map_.end()) {
+ HANDLE_EINTR(close(i->second));
map_.erase(i);
+ }
}
// Insert a mapping from @channel_id to @fd. It's a fatal error to insert a
@@ -271,6 +273,11 @@ void AddChannelSocket(const std::string& name, int socket) {
}
// static
+void RemoveAndCloseChannelSocket(const std::string& name) {
+ Singleton<PipeMap>()->RemoveAndClose(name);
+}
+
+// static
bool SocketPair(int* fd1, int* fd2) {
int pipe_fds[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) {
@@ -423,8 +430,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
DCHECK(bytes_read);
if (client_pipe_ != -1) {
- Singleton<PipeMap>()->Remove(pipe_name_);
- HANDLE_EINTR(close(client_pipe_));
+ Singleton<PipeMap>()->RemoveAndClose(pipe_name_);
client_pipe_ = -1;
}
@@ -776,8 +782,7 @@ void Channel::ChannelImpl::Close() {
pipe_ = -1;
}
if (client_pipe_ != -1) {
- Singleton<PipeMap>()->Remove(pipe_name_);
- HANDLE_EINTR(close(client_pipe_));
+ Singleton<PipeMap>()->RemoveAndClose(pipe_name_);
client_pipe_ = -1;
}
« no previous file with comments | « chrome/common/ipc_channel_posix.h ('k') | chrome/plugin/plugin_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698