#include "components/metrics/call_stacks/call_stack_profile_builder.h"
#include <algorithm>
#include <iterator>
#include <map>
#include <memory>
#include <string>
#include <tuple>
#include <utility>
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/metrics/metrics_hashes.h"
#include "base/no_destructor.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/metrics/call_stacks/call_stack_profile_encoding.h"
namespace metrics {
namespace {
std::unique_ptr<ChildCallStackProfileCollector>&
GetChildCallStackProfileCollector() { … }
base::RepeatingCallback<void(base::TimeTicks, SampledProfile)>&
GetBrowserProcessReceiverCallbackInstance() { … }
uint64_t HashModuleFilename(const base::FilePath& filename) { … }
}
CallStackProfileBuilder::CallStackProfileBuilder(
const base::CallStackProfileParams& profile_params,
const WorkIdRecorder* work_id_recorder,
base::OnceClosure completed_callback)
: … { … }
CallStackProfileBuilder::~CallStackProfileBuilder() = default;
base::ModuleCache* CallStackProfileBuilder::GetModuleCache() { … }
void CallStackProfileBuilder::RecordMetadata(
const base::MetadataRecorder::MetadataProvider& metadata_provider) { … }
void CallStackProfileBuilder::ApplyMetadataRetrospectively(
base::TimeTicks period_start,
base::TimeTicks period_end,
const base::MetadataRecorder::Item& item) { … }
void CallStackProfileBuilder::AddProfileMetadata(
const base::MetadataRecorder::Item& item) { … }
void CallStackProfileBuilder::OnSampleCompleted(
std::vector<base::Frame> frames,
base::TimeTicks sample_timestamp) { … }
void CallStackProfileBuilder::OnSampleCompleted(
std::vector<base::Frame> frames,
base::TimeTicks sample_timestamp,
size_t weight,
size_t count) { … }
void CallStackProfileBuilder::OnProfileCompleted(
base::TimeDelta profile_duration,
base::TimeDelta sampling_period) { … }
void CallStackProfileBuilder::SetBrowserProcessReceiverCallback(
const base::RepeatingCallback<void(base::TimeTicks, SampledProfile)>&
callback) { … }
void CallStackProfileBuilder::SetParentProfileCollectorForChildProcess(
mojo::PendingRemote<metrics::mojom::CallStackProfileCollector>
browser_interface) { … }
void CallStackProfileBuilder::ResetChildCallStackProfileCollectorForTesting() { … }
void CallStackProfileBuilder::PassProfilesToMetricsProvider(
base::TimeTicks profile_start_time,
SampledProfile sampled_profile) { … }
bool CallStackProfileBuilder::StackComparer::operator()(
const CallStackProfile::Stack* stack1,
const CallStackProfile::Stack* stack2) const { … }
}