Commit d6c61134 authored by dpranke@chromium.org's avatar dpranke@chromium.org

Change CreateTemporaryDirInDir to be "more unique"

This change includes a process id in the synthesized temp dir
names, so that created directories will be more unique across
the system when you're running a bunch of base-using processes at
once (e.g., in the layout tests).

BUG=125678
R=brettw@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10264026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134827 0039d316-1c4b-4281-b951-d872f2087c98
parent 28588ac6
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
...@@ -559,6 +560,8 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, ...@@ -559,6 +560,8 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir,
// the one exists, keep trying another path name until we reach some limit. // the one exists, keep trying another path name until we reach some limit.
string16 new_dir_name; string16 new_dir_name;
new_dir_name.assign(prefix); new_dir_name.assign(prefix);
new_dir_name.append(base::IntToString16(::base::GetCurrentProcId()));
new_dir_name.push_back('_');
new_dir_name.append(base::IntToString16(rand() % kint16max)); new_dir_name.append(base::IntToString16(rand() % kint16max));
path_to_create = base_dir.Append(new_dir_name); path_to_create = base_dir.Append(new_dir_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment