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

Side by Side Diff: components/metrics/metrics_reporting_scheduler.h

Issue 922383003: Enable UMA log uploads for cellular networks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments fixed Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_ 5 #ifndef COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_
6 #define COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_ 6 #define COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "components/metrics/net/network_metrics_provider.h"
13 14
14 namespace metrics { 15 namespace metrics {
15 16
16 // Scheduler task to drive a MetricsService object's uploading. 17 // Scheduler task to drive a MetricsService object's uploading.
17 class MetricsReportingScheduler { 18 class MetricsReportingScheduler {
18 public: 19 public:
19 explicit MetricsReportingScheduler(const base::Closure& upload_callback); 20 // Creates MetricsServiceScheduler object with the given |upload_callback|
21 // callback to call when uploading should happen and |cellular_callback|
22 // callback to get current network connection type.
23 MetricsReportingScheduler(
24 const base::Closure& upload_callback,
25 const base::Callback<void(bool*)>& cellular_callback);
20 ~MetricsReportingScheduler(); 26 ~MetricsReportingScheduler();
21 27
22 // Starts scheduling uploads. This in a no-op if the scheduler is already 28 // Starts scheduling uploads. This in a no-op if the scheduler is already
23 // running, so it is safe to call more than once. 29 // running, so it is safe to call more than once.
24 void Start(); 30 void Start();
25 31
26 // Stops scheduling uploads. 32 // Stops scheduling uploads.
27 void Stop(); 33 void Stop();
28 34
29 // Callback from MetricsService when the startup init task has completed. 35 // Callback from MetricsService when the startup init task has completed.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Indicates that the last triggered upload hasn't resolved yet. 83 // Indicates that the last triggered upload hasn't resolved yet.
78 bool callback_pending_; 84 bool callback_pending_;
79 85
80 // Whether the InitTaskComplete() callback has been called. 86 // Whether the InitTaskComplete() callback has been called.
81 bool init_task_complete_; 87 bool init_task_complete_;
82 88
83 // Whether the initial scheduled upload timer has fired before the init task 89 // Whether the initial scheduled upload timer has fired before the init task
84 // has been completed. 90 // has been completed.
85 bool waiting_for_init_task_complete_; 91 bool waiting_for_init_task_complete_;
86 92
93 // Callback function used to get current network connection type.
94 base::Callback<void(bool*)> cellular_callback_;
95
87 DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler); 96 DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler);
88 }; 97 };
89 98
90 } // namespace metrics 99 } // namespace metrics
91 100
92 #endif // COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_ 101 #endif // COMPONENTS_METRICS_METRICS_REPORTING_SCHEDULER_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.cc ('k') | components/metrics/metrics_reporting_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698