| Index: content/browser/tracing/add_new_file_index.cc
|
| diff --git a/content/browser/tracing/add_new_file_index.cc b/content/browser/tracing/add_new_file_index.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ad359f6965f35ee74971011d49f3690117912885
|
| --- /dev/null
|
| +++ b/content/browser/tracing/add_new_file_index.cc
|
| @@ -0,0 +1,25 @@
|
| +#include "content/browser/tracing/add_new_file_index.h"
|
| +
|
| +#include "base/file_util.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "base/threading/thread_restrictions.h"
|
| +
|
| +namespace {
|
| +const unsigned int kMaxLogFileIndex = 1000000;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +base::FilePath AddNewLogFileIndex(const base::FilePath& trace_file) {
|
| + // trace file should be initialized synchronously
|
| + base::ThreadRestrictions::ScopedAllowIO allow_io;
|
| + for (unsigned int i = 0; i < kMaxLogFileIndex; ++i) {
|
| + const base::FilePath new_filename(trace_file.value() + "." +
|
| + base::UintToString(i));
|
| + if (!base::PathExists(new_filename))
|
| + return new_filename;
|
| + }
|
| + return trace_file;
|
| +}
|
| +
|
| +} // namespace content
|
|
|