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..a41edbc0bef3b8fc29eacd9a05690b548a28a579 |
--- /dev/null |
+++ b/content/browser/tracing/add_new_file_index.cc |
@@ -0,0 +1,27 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/tracing/add_new_file_index.h" |
+ |
+#include "base/file_util.h" |
+#include "base/strings/string_number_conversions.h" |
+ |
+namespace { |
+const unsigned int kMaxLogFileIndex = 1000000; |
+} |
+ |
+namespace content { |
+ |
+base::FilePath AddNewLogFileIndex(const base::FilePath& trace_file) { |
+ // trace file should be initialized synchronously |
+ for (unsigned int i = 0; i < kMaxLogFileIndex; ++i) { |
+ const base::FilePath new_filename( |
+ trace_file.AppendASCII("." + base::UintToString(i))); |
+ if (!base::PathExists(new_filename)) |
+ return new_filename; |
+ } |
+ return trace_file; |
+} |
+ |
+} // namespace content |