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

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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync_driver/device_count_metrics_provider.h" 5 #include "components/sync/driver/device_count_metrics_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "components/sync_driver/device_info_tracker.h" 10 #include "components/sync/driver/device_info_tracker.h"
11 11
12 namespace sync_driver { 12 namespace sync_driver {
13 13
14 DeviceCountMetricsProvider::DeviceCountMetricsProvider( 14 DeviceCountMetricsProvider::DeviceCountMetricsProvider(
15 const ProvideTrackersCallback& provide_trackers) 15 const ProvideTrackersCallback& provide_trackers)
16 : provide_trackers_(provide_trackers) {} 16 : provide_trackers_(provide_trackers) {}
17 17
18 DeviceCountMetricsProvider::~DeviceCountMetricsProvider() {} 18 DeviceCountMetricsProvider::~DeviceCountMetricsProvider() {}
19 19
20 int DeviceCountMetricsProvider::MaxActiveDeviceCount() const { 20 int DeviceCountMetricsProvider::MaxActiveDeviceCount() const {
21 std::vector<const sync_driver::DeviceInfoTracker*> trackers; 21 std::vector<const sync_driver::DeviceInfoTracker*> trackers;
22 provide_trackers_.Run(&trackers); 22 provide_trackers_.Run(&trackers);
23 int max = 0; 23 int max = 0;
24 for (auto* tracker : trackers) { 24 for (auto* tracker : trackers) {
25 max = std::max(max, tracker->CountActiveDevices()); 25 max = std::max(max, tracker->CountActiveDevices());
26 } 26 }
27 return max; 27 return max;
28 } 28 }
29 29
30 void DeviceCountMetricsProvider::ProvideGeneralMetrics( 30 void DeviceCountMetricsProvider::ProvideGeneralMetrics(
31 metrics::ChromeUserMetricsExtension* uma_proto) { 31 metrics::ChromeUserMetricsExtension* uma_proto) {
32 UMA_HISTOGRAM_SPARSE_SLOWLY("Sync.DeviceCount", 32 UMA_HISTOGRAM_SPARSE_SLOWLY("Sync.DeviceCount",
33 std::min(MaxActiveDeviceCount(), 100)); 33 std::min(MaxActiveDeviceCount(), 100));
34 } 34 }
35 35
36 } // namespace sync_driver 36 } // namespace sync_driver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698