summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 18:28:26 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 18:28:26 +0000
commit5c096b1116bb81f9dde31fee1663c13598f2e855 (patch)
tree204398a6026f555541b984a28cb3f0926f1717d8 /sandbox
parentfa1aebe8c8ef8010a2735c5515f61328951bf712 (diff)
downloadchromium_src-5c096b1116bb81f9dde31fee1663c13598f2e855.zip
chromium_src-5c096b1116bb81f9dde31fee1663c13598f2e855.tar.gz
chromium_src-5c096b1116bb81f9dde31fee1663c13598f2e855.tar.bz2
Add a DCHECK to make sure that SpawnTarget is not called
from multiple threads. In chrome all child processes are started from the PROCESS_LAUNCHER thread. BUG=28798 Review URL: http://codereview.chromium.org/548192 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/src/broker_services.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sandbox/src/broker_services.cc b/sandbox/src/broker_services.cc
index 2c53a42..4382f7e 100644
--- a/sandbox/src/broker_services.cc
+++ b/sandbox/src/broker_services.cc
@@ -227,6 +227,13 @@ ResultCode BrokerServicesBase::SpawnTarget(const wchar_t* exe_path,
if (!policy)
return SBOX_ERROR_BAD_PARAMS;
+ // Even though the resources touched by SpawnTarget can be accessed in
+ // multiple threads, the method itself cannot be called from more than
+ // 1 thread. This is to protect the global variables used while setting up
+ // the child process.
+ static DWORD thread_id = ::GetCurrentThreadId();
+ DCHECK(thread_id == ::GetCurrentThreadId());
+
AutoLock lock(&lock_);
// This downcast is safe as long as we control CreatePolicy()