Index: chrome/browser/metrics/drive_metrics_provider.h |
diff --git a/chrome/browser/metrics/drive_metrics_provider.h b/chrome/browser/metrics/drive_metrics_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..74626a87fd876bee8238e039bb7c771ac1b95389 |
--- /dev/null |
+++ b/chrome/browser/metrics/drive_metrics_provider.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2015 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_DRIVE_METRICS_PROVIDER_H_ |
+#define CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
+#include "components/metrics/metrics_provider.h" |
+ |
+// Provides metrics about the local drives on a user's computer. Currently only |
+// checks to see if they incur a seek-time penalty (e.g. if they're SSDs). |
+// |
+// Defers gathering metrics until after "rush hour" (startup) so as to not bog |
+// down the FILE thread. |
+class DriveMetricsProvider : public metrics::MetricsProvider { |
+ public: |
+ DriveMetricsProvider(); |
+ ~DriveMetricsProvider() override; |
+ |
+ // metrics::MetricsDataProvider: |
+ void ProvideSystemProfileMetrics( |
+ metrics::SystemProfileProto* system_profile_proto) override; |
+ |
+ struct SeekPenaltyResponse { |
Alexei Svitkine (slow)
2015/03/16 16:49:36
Move these to the private section.
Dan Beam
2015/03/16 19:20:23
they were used in the anonymous namespace, so had
|
+ SeekPenaltyResponse(); |
+ bool success; |
+ bool has_seek_penalty; |
+ }; |
+ |
+ struct DriveMetrics { |
+ SeekPenaltyResponse app_drive; |
+ SeekPenaltyResponse user_data_drive; |
+ }; |
+ |
+ private: |
+ // Called when metrics are done being gathered from the FILE thread. |
+ void GotDriveMetrics(const DriveMetrics& metrics); |
+ |
+ // False until |GotDriveMetrics| is called. |
+ bool got_metrics_; |
+ DriveMetrics metrics_; |
+ |
+ base::ThreadChecker thread_checker_; |
+ base::WeakPtrFactory<DriveMetricsProvider> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DriveMetricsProvider); |
+}; |
+ |
+#endif // CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_ |