Index: base/debug/trace_to_file.h |
diff --git a/base/debug/trace_to_file.h b/base/debug/trace_to_file.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a75307e0a3c88d24ef3a8443f84f512ec7c217f4 |
--- /dev/null |
+++ b/base/debug/trace_to_file.h |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 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. |
+ |
+#ifndef BASE_DEBUG_TRACE_TO_FILE_H_ |
+#define BASE_DEBUG_TRACE_TO_FILE_H_ |
+ |
+#include "base/files/file_path.h" |
+ |
+namespace base { |
+namespace debug { |
+ |
+class TraceToFile { |
+ public: |
+ TraceToFile(); |
+ ~TraceToFile(); |
+ |
+ void BeginTracingFromCommandLineOptions(); |
+ void BeginTracing(const base::FilePath& path, const std::string& categories); |
+ |
+ // Assumes current message loop is not being pumped and is idle. |
+ // This is a valid assumption for unit tests, but not for the browser. |
+ void EndTracingIfNeeded(); |
+ |
+ private: |
+ void WriteFileHeader(); |
+ void AppendFileFooter(); |
+ |
+ void TraceOutputCallback(const std::string& data); |
+ |
+ base::FilePath path_; |
+ bool started_; |
+}; |
+ |
+} // namespace debug |
+} // namespace base |
+ |
+#endif // BASE_DEBUG_TRACE_TO_FILE_H_ |