blob: ed327115e6fcf97a274b49162a95281fb3210344 [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_WEB_TEST_BROWSER_WEB_TEST_TRACING_CONTROLLER_H_
#define CONTENT_WEB_TEST_BROWSER_WEB_TEST_TRACING_CONTROLLER_H_
#include "base/files/file.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace perfetto {
class TracingSession;
} // namespace perfetto
namespace content {
class WebTestTracingController {
public:
explicit WebTestTracingController(base::FilePath trace_file_path);
~WebTestTracingController();
void StartTracing();
void StopTracing();
void TracingFinished();
private:
void OnTracingStopped();
base::FilePath trace_file_path_;
base::File tracing_file_;
std::unique_ptr<perfetto::TracingSession> tracing_session_;
absl::optional<base::RunLoop> stop_tracing_run_loop_;
bool tracing_is_stopping_ = false;
};
} // namespace content
#endif // CONTENT_WEB_TEST_BROWSER_WEB_TEST_TRACING_CONTROLLER_H_