OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_checker.h" |
| 11 #include "components/metrics/metrics_provider.h" |
| 12 |
| 13 // Provides metrics about the local drives on a user's computer. Currently only |
| 14 // checks to see if they incur a seek-time penalty (e.g. if they're SSDs). |
| 15 // |
| 16 // Defers gathering metrics until after "rush hour" (startup) so as to not bog |
| 17 // down the FILE thread. |
| 18 class DriveMetricsProvider : public metrics::MetricsProvider { |
| 19 public: |
| 20 DriveMetricsProvider(); |
| 21 ~DriveMetricsProvider() override; |
| 22 |
| 23 // metrics::MetricsDataProvider: |
| 24 void ProvideSystemProfileMetrics( |
| 25 metrics::SystemProfileProto* system_profile_proto) override; |
| 26 |
| 27 struct SeekPenaltyResponse { |
| 28 SeekPenaltyResponse(); |
| 29 bool success; |
| 30 bool has_seek_penalty; |
| 31 }; |
| 32 |
| 33 struct DriveMetrics { |
| 34 SeekPenaltyResponse app_drive; |
| 35 SeekPenaltyResponse user_data_drive; |
| 36 }; |
| 37 |
| 38 private: |
| 39 // Called when metrics are done being gathered from the FILE thread. |
| 40 void GotDriveMetrics(const DriveMetrics& metrics); |
| 41 |
| 42 // False until |GotDriveMetrics| is called. |
| 43 bool got_metrics_; |
| 44 DriveMetrics metrics_; |
| 45 |
| 46 base::ThreadChecker thread_checker_; |
| 47 base::WeakPtrFactory<DriveMetricsProvider> weak_ptr_factory_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(DriveMetricsProvider); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_ |
OLD | NEW |