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

Unified Diff: ipc/attachment_broker_privileged_mac.cc

Issue 1484763003: ipc: Slight change to GetSenderWithProcessId(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/attachment_broker_privileged.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker_privileged_mac.cc
diff --git a/ipc/attachment_broker_privileged_mac.cc b/ipc/attachment_broker_privileged_mac.cc
index f4dc043971abee7921f7098153ba5df5d7fdadc6..62e218c4b05804cb525b045a147ce18e27597693 100644
--- a/ipc/attachment_broker_privileged_mac.cc
+++ b/ipc/attachment_broker_privileged_mac.cc
@@ -8,6 +8,7 @@
#include "base/memory/shared_memory.h"
#include "base/process/port_provider_mac.h"
#include "base/process/process.h"
+#include "base/synchronization/lock.h"
#include "ipc/attachment_broker_messages.h"
#include "ipc/brokerable_attachment.h"
#include "ipc/ipc_channel.h"
@@ -210,6 +211,7 @@ bool AttachmentBrokerPrivilegedMac::RouteWireFormatToAnother(
// Another process is the destination.
base::ProcessId dest = wire_format.destination_process;
+ base::AutoLock auto_lock(*get_lock());
Sender* sender = GetSenderWithProcessId(dest);
if (!sender) {
// Assuming that this message was not sent from a malicious process, the
@@ -319,6 +321,7 @@ void AttachmentBrokerPrivilegedMac::SendPrecursorsForProcess(
bool to_self = pid == base::GetCurrentProcId();
if (!to_self) {
+ base::AutoLock auto_lock(*get_lock());
if (!GetSenderWithProcessId(pid)) {
// If there is no sender, then the destination process is no longer
// running, or never existed to begin with.
@@ -387,12 +390,15 @@ void AttachmentBrokerPrivilegedMac::ProcessExtractorsForProcess(
if (it == extractors_.end())
return;
- if (!GetSenderWithProcessId(pid)) {
- // If there is no sender, then the source process is no longer running.
- LogError(ERROR_SOURCE_NOT_FOUND);
- delete it->second;
- extractors_.erase(it);
- return;
+ {
+ base::AutoLock auto_lock(*get_lock());
+ if (!GetSenderWithProcessId(pid)) {
+ // If there is no sender, then the source process is no longer running.
+ LogError(ERROR_SOURCE_NOT_FOUND);
+ delete it->second;
+ extractors_.erase(it);
+ return;
+ }
}
mach_port_t task_port = port_provider_->TaskForPid(pid);
« no previous file with comments | « ipc/attachment_broker_privileged.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698