chromium/remoting/base/breakpad_utils.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_BASE_BREAKPAD_UTILS_H_
#define REMOTING_BASE_BREAKPAD_UTILS_H_

#include <atomic>
#include <memory>
#include <string>

#include "base/files/file_path.h"
#include "base/process/process_handle.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"

#if BUILDFLAG(IS_WIN)
#include "base/win/scoped_handle.h"
#endif

namespace remoting {

// base::Value keys used in multiple crash components.
extern const char kBreakpadProductVersionKey[];
extern const char kBreakpadProcessStartTimeKey[];
extern const char kBreakpadProcessIdKey[];
extern const char kBreakpadProcessNameKey[];
extern const char kBreakpadProcessUptimeKey[];

// Returns the path to the directory to use when generating or processing
// minidumps. Does not attempt to create the directory or check R/W permissions.
extern base::FilePath GetMinidumpDirectoryPath();

extern bool CreateMinidumpDirectoryIfNeeded(
    const base::FilePath& minidump_directory);

extern bool WriteMetadataForMinidump(const base::FilePath& minidump_file_path,
                                     base::Value::Dict custom_client_info);

#if BUILDFLAG(IS_WIN)

// The name of the pipe to use for OOP crash reporting.
extern const wchar_t kCrashServerPipeName[];

base::win::ScopedHandle GetClientHandleForCrashServerPipe();
#endif  // BUILDFLAG(IS_WIN)

// Helper for generating and uploading minidumps.
class BreakpadHelper {};

}  // namespace remoting

#endif  // REMOTING_BASE_BREAKPAD_UTILS_H_