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

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: explicit BrowserShutdownProfileDumper. 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..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;
jochen (gone - plz use gerrit) 2014/06/06 07:01:49 can't you do this before thread restrictions are t
Alexander Alekseev 2014/06/06 15:43:41 Done.
+ 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
« 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