// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module tracing.mojom;
// Identifies a rule used in BackgroundTracingAgent.
struct BackgroundTracingRule {
string rule_id;
};
// This interface is used to receive callbacks from BackgroundTracingAgent.
interface BackgroundTracingAgentClient {
// Called once the BackgroundTracingAgent implementation is initialized.
OnInitialized();
// Called when a monitored histogram trigger is hit. Histograms are monitored
// by calling BackgroundTracingAgent::SetUMACallback().
OnTriggerBackgroundTrace(BackgroundTracingRule rule, int32? histogram_value);
};
// This interface is used to allow clients (the browser process) to monitor for
// specific metrics being hit and control when to start/stop tracing in
// response. How metrics are communicated b/w processes is not covered here.
interface BackgroundTracingAgent {
// Call this method to begin reporting metrics corresponding to the named
// histogram. Lower and upper bound values constrain what data is reported.
// This results in OnTriggerBackgroundTrace callbacks.
SetUMACallback(BackgroundTracingRule rule, string histogram_name,
int32 histogram_lower_value,
int32 histogram_upper_value);
// Call this method to stop reporting metrics corresponding to |rule|.
ClearUMACallback(BackgroundTracingRule rule);
};
// This interface is used to construct a BackgroundTracingAgent.
interface BackgroundTracingAgentProvider {
// Results in an OnInitialized callback to |client|.
Create(uint64 tracing_process_id,
pending_remote<BackgroundTracingAgentClient> client,
pending_receiver<BackgroundTracingAgent> agent);
};