chromium/base/debug/dump_without_crashing.cc

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

#include "base/debug/dump_without_crashing.h"

#include <map>
#include <utility>

#include "base/check.h"
#include "base/debug/crash_logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/synchronization/lock.h"
#include "base/trace_event/base_tracing.h"
#include "build/buildflag.h"

namespace {

// Pointer to the function that's called by DumpWithoutCrashing* to dump the
// process's memory.
void (*dump_without_crashing_function_)() =;

template <typename Map, typename Key>
bool ShouldDump(Map& map, Key& key, base::TimeDelta time_between_dumps) {}

// Map used to store the most recent time a location called
// ShouldDumpWithoutCrashWithLocation.
std::map<base::Location, base::TimeTicks>& LocationToTimestampMap() {}

// Map used to store the most recent time a pair of location and
// unique_identifier called ShouldDumpWithoutCrashWithLocationAndUniqueId.
std::map<std::pair<base::Location, size_t>, base::TimeTicks>&
LocationAndUniqueIdentifierToTimestampMap() {}

// This function takes `location` and `time_between_dumps` as an input
// and checks if DumpWithoutCrashing() meets the requirements to take the dump
// or not.
bool ShouldDumpWithoutCrashWithLocation(const base::Location& location,
                                        base::TimeDelta time_between_dumps) {}

// Pair of `location` and `unique_identifier` creates a unique key and checks
// if DumpWithoutCrashingWithUniqueId() meets the requirements to take dump or
// not.
bool ShouldDumpWithoutCrashWithLocationAndUniqueId(
    size_t unique_identifier,
    const base::Location& location,
    base::TimeDelta time_between_dumps) {}

}  // namespace

namespace base {

namespace debug {

bool DumpWithoutCrashingUnthrottled() {}

bool DumpWithoutCrashing(const base::Location& location,
                         base::TimeDelta time_between_dumps) {}

bool DumpWithoutCrashingWithUniqueId(size_t unique_identifier,
                                     const base::Location& location,
                                     base::TimeDelta time_between_dumps) {}

void SetDumpWithoutCrashingFunction(void (*function)()) {}

void ClearMapsForTesting() {}

}  // namespace debug
}  // namespace base