diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/fuchsia/base/legacymetrics_client.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/fuchsia/base/legacymetrics_client.h')
-rw-r--r-- | chromium/fuchsia/base/legacymetrics_client.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/chromium/fuchsia/base/legacymetrics_client.h b/chromium/fuchsia/base/legacymetrics_client.h index 98576a1f410..b9ec76a2a1f 100644 --- a/chromium/fuchsia/base/legacymetrics_client.h +++ b/chromium/fuchsia/base/legacymetrics_client.h @@ -31,6 +31,8 @@ class LegacyMetricsClient { using ReportAdditionalMetricsCallback = base::RepeatingCallback<void( base::OnceCallback<void(std::vector<fuchsia::legacymetrics::Event>)>)>; + using NotifyFlushCallback = + base::OnceCallback<void(base::OnceClosure completion_cb)>; LegacyMetricsClient(); ~LegacyMetricsClient(); @@ -50,18 +52,27 @@ class LegacyMetricsClient { void SetReportAdditionalMetricsCallback( ReportAdditionalMetricsCallback callback); + // Sets a |callback| which is invoked to warn that the connection to the + // remote MetricsRecorder will be terminated. The completion closure passed to + // |callback| should be invoked to signal flush completion. + void SetNotifyFlushCallback(NotifyFlushCallback callback); + private: void ScheduleNextReport(); void StartReport(); void Report(std::vector<fuchsia::legacymetrics::Event> additional_metrics); void OnMetricsRecorderDisconnected(zx_status_t status); + void OnCloseSoon(); - // Incrementally sends the contents of |buffer| to |metrics_recorder|, and - // invokes |done_cb| when finished. - void DrainBuffer(std::vector<fuchsia::legacymetrics::Event> buffer); + // Incrementally sends the contents of |to_send_| to |metrics_recorder_|. + void DrainBuffer(); base::TimeDelta report_interval_; ReportAdditionalMetricsCallback report_additional_callback_; + NotifyFlushCallback notify_flush_callback_; + bool is_flushing_ = false; + bool record_ack_pending_ = false; + std::vector<fuchsia::legacymetrics::Event> to_send_; std::unique_ptr<LegacyMetricsUserActionRecorder> user_events_recorder_; fuchsia::legacymetrics::MetricsRecorderPtr metrics_recorder_; |