Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: content/browser/tracing/add_new_file_index.cc

Issue 311313005: Add --trace-rotate-startup-file option and store unsaved trace data on exit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tracing/add_new_file_index.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/tracing/add_new_file_index.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698