#include "components/heap_profiling/in_process/heap_profiler_parameters.h"
#include <string>
#include <string_view>
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/json/json_reader.h"
#include "base/json/json_value_converter.h"
#include "base/metrics/field_trial_params.h"
#include "base/profiler/process_type.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/variations/variations_switches.h"
namespace heap_profiling {
namespace {
#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
constexpr int kDefaultSamplingRateBytes = 1'000'000;
constexpr base::TimeDelta kDefaultCollectionInterval = base::Minutes(30);
#else
constexpr int kDefaultSamplingRateBytes = …;
constexpr base::TimeDelta kDefaultCollectionInterval = …;
#endif
#if BUILDFLAG(IS_ANDROID)
constexpr double kDefaultStableProbability = 0.0025;
#else
constexpr double kDefaultStableProbability = …;
#endif
constexpr double kDefaultNonStableProbability = …;
constexpr HeapProfilerParameters kDefaultHeapProfilerParameters{ … };
constexpr base::FeatureParam<std::string> kDefaultParameters{ … };
constexpr base::FeatureParam<std::string> kBrowserProcessParameters{ … };
constexpr base::FeatureParam<std::string> kRendererProcessParameters{ … };
constexpr base::FeatureParam<std::string> kGPUProcessParameters{ … };
constexpr base::FeatureParam<std::string> kUtilityProcessParameters{ … };
constexpr base::FeatureParam<std::string> kNetworkProcessParameters{ … };
bool ConvertCollectionInterval(const base::Value* value,
base::TimeDelta* result) { … }
}
BASE_FEATURE(…);
BASE_FEATURE(…);
const base::FeatureParam<int> kGpuSnapshotProbability{ … };
const base::FeatureParam<int> kNetworkSnapshotProbability{ … };
const base::FeatureParam<int> kRendererSnapshotProbability{ … };
const base::FeatureParam<int> kUtilitySnapshotProbability{ … };
void HeapProfilerParameters::RegisterJSONConverter(
base::JSONValueConverter<HeapProfilerParameters>* converter) { … }
bool HeapProfilerParameters::UpdateFromJSON(std::string_view json_string) { … }
HeapProfilerParameters GetDefaultHeapProfilerParameters() { … }
HeapProfilerParameters GetHeapProfilerParametersForProcess(
base::ProfilerProcessType process_type) { … }
}