OLD | NEW |
(Empty) | |
| 1 #include "content/browser/tracing/add_new_file_index.h" |
| 2 |
| 3 #include "base/file_util.h" |
| 4 #include "base/strings/string_number_conversions.h" |
| 5 #include "base/threading/thread_restrictions.h" |
| 6 |
| 7 namespace { |
| 8 const unsigned int kMaxLogFileIndex = 1000000; |
| 9 } |
| 10 |
| 11 namespace content { |
| 12 |
| 13 base::FilePath AddNewLogFileIndex(const base::FilePath& trace_file) { |
| 14 // trace file should be initialized synchronously |
| 15 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 16 for (unsigned int i = 0; i < kMaxLogFileIndex; ++i) { |
| 17 const base::FilePath new_filename(trace_file.value() + "." + |
| 18 base::UintToString(i)); |
| 19 if (!base::PathExists(new_filename)) |
| 20 return new_filename; |
| 21 } |
| 22 return trace_file; |
| 23 } |
| 24 |
| 25 } // namespace content |
OLD | NEW |