trace_to_file.h 775 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright (c) 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_TEST_TRACE_TO_FILE_H_
  5. #define BASE_TEST_TRACE_TO_FILE_H_
  6. #include "base/files/file_path.h"
  7. namespace base {
  8. namespace test {
  9. class TraceToFile {
  10. public:
  11. TraceToFile();
  12. ~TraceToFile();
  13. void BeginTracingFromCommandLineOptions();
  14. void BeginTracing(const base::FilePath& path, const std::string& categories);
  15. void EndTracingIfNeeded();
  16. private:
  17. void WriteFileHeader();
  18. void AppendFileFooter();
  19. void TraceOutputCallback(const std::string& data);
  20. base::FilePath path_;
  21. bool started_;
  22. };
  23. } // namespace test
  24. } // namespace base
  25. #endif // BASE_TEST_TRACE_TO_FILE_H_