Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Side by Side Diff: components/sync_driver/device_count_metrics_provider.cc

Issue 2203673002: [Sync] Move //components/sync_driver to //components/sync/driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sd-a
Patch Set: Full change rebased on static lib. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 #include "components/sync_driver/device_count_metrics_provider.h"
6
7 #include <algorithm>
8
9 #include "base/metrics/sparse_histogram.h"
10 #include "components/sync_driver/device_info_tracker.h"
11
12 namespace sync_driver {
13
14 DeviceCountMetricsProvider::DeviceCountMetricsProvider(
15 const ProvideTrackersCallback& provide_trackers)
16 : provide_trackers_(provide_trackers) {}
17
18 DeviceCountMetricsProvider::~DeviceCountMetricsProvider() {}
19
20 int DeviceCountMetricsProvider::MaxActiveDeviceCount() const {
21 std::vector<const sync_driver::DeviceInfoTracker*> trackers;
22 provide_trackers_.Run(&trackers);
23 int max = 0;
24 for (auto* tracker : trackers) {
25 max = std::max(max, tracker->CountActiveDevices());
26 }
27 return max;
28 }
29
30 void DeviceCountMetricsProvider::ProvideGeneralMetrics(
31 metrics::ChromeUserMetricsExtension* uma_proto) {
32 UMA_HISTOGRAM_SPARSE_SLOWLY("Sync.DeviceCount",
33 std::min(MaxActiveDeviceCount(), 100));
34 }
35
36 } // namespace sync_driver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698