Commit 8c988624 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Chromium LUCI CQ

Add the UsageScenarioTracker class

This class is responsible for maintaining the integrity of a
UsageScenarioDataStore. The data providers will be added in separate
CLs.

When PowerMetricsReporter (to be added) receives power metrics from
PowerMonitor, it will query BatteryLevelProvider to obtain the battery
charge level, from which it will compute the discharge rate. Then, it
will query UsageScenarioDataStore via this class to obtain data about
the usage scenario.

Bug: 1153193
Change-Id: I6f97a9ce89c9b043a6b2df8adeebf95321b7b847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621678Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843727}
parent 6a920289
...@@ -846,6 +846,8 @@ static_library("browser") { ...@@ -846,6 +846,8 @@ static_library("browser") {
"metrics/ukm_background_recorder_service.h", "metrics/ukm_background_recorder_service.h",
"metrics/usage_scenario_data_store.cc", "metrics/usage_scenario_data_store.cc",
"metrics/usage_scenario_data_store.h", "metrics/usage_scenario_data_store.h",
"metrics/usage_scenario_tracker.cc",
"metrics/usage_scenario_tracker.h",
"metrics/variations/chrome_variations_service_client.cc", "metrics/variations/chrome_variations_service_client.cc",
"metrics/variations/chrome_variations_service_client.h", "metrics/variations/chrome_variations_service_client.h",
"native_window_notification_source.h", "native_window_notification_source.h",
......
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/metrics/usage_scenario_tracker.h"
UsageScenarioTracker::UsageScenarioTracker() = default;
UsageScenarioTracker::~UsageScenarioTracker() = default;
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_METRICS_USAGE_SCENARIO_TRACKER_H_
#define CHROME_BROWSER_METRICS_USAGE_SCENARIO_TRACKER_H_
#include "base/sequence_checker.h"
#include "chrome/browser/metrics/usage_scenario_data_store.h"
// Registers as an observer to various components to maintain a
// UsageScenarioDataStore.
class UsageScenarioTracker {
public:
UsageScenarioTracker();
UsageScenarioTracker(const UsageScenarioTracker& rhs) = delete;
UsageScenarioTracker& operator=(const UsageScenarioTracker& rhs) = delete;
~UsageScenarioTracker();
// Return the data store owned by this tracker.
UsageScenarioDataStore* data_store() { return &data_store_; }
private:
UsageScenarioDataStoreImpl data_store_;
// TODO(crbug.com/1153193): Add the events providers for the data store.
SEQUENCE_CHECKER(sequence_checker_);
};
#endif // CHROME_BROWSER_METRICS_USAGE_SCENARIO_TRACKER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment