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

Unified Diff: chrome/browser/metrics/metrics_service.h

Issue 6869034: Factor a scheduler object out of MetricsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to trunk Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_reporting_scheduler.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.h
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 0d4730efddb1e76ff99cbd8185dd870c4b6bcd61..6acb6a2f375eb1bb1609ac3a6314817b4121131e 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -31,6 +31,7 @@ class DictionaryValue;
class ListValue;
class HistogramSynchronizer;
class MetricsLogBase;
+class MetricsReportingScheduler;
class PrefService;
class TemplateURLModel;
@@ -40,12 +41,6 @@ struct WebPluginInfo;
}
}
-// Forward declaration of the xmlNode to avoid having tons of gyp files
-// needing to depend on the libxml third party lib.
-struct _xmlNode;
-typedef struct _xmlNode xmlNode;
-typedef xmlNode* xmlNodePtr;
-
class MetricsService : public NotificationObserver,
public URLFetcher::Delegate,
@@ -209,15 +204,16 @@ class MetricsService : public NotificationObserver,
// next run. Note that IF this text is "too large," we just dicard it.
void PushPendingLogTextToUnsentOngoingLogs();
- // Start timer for next log transmission.
- void StartLogTransmissionTimer();
+ // Ensures that scheduler is running, assuming the current settings are such
+ // that metrics should be reported. If not, this is a no-op.
+ void StartSchedulerIfNecessary();
- // Internal function to collect process memory information.
- void LogTransmissionTimerDone();
+ // Starts the process of uploading metrics data.
+ void StartScheduledUpload();
// Do not call OnMemoryDetailCollectionDone() or
- // OnHistogramSynchronizationDone() directly.
- // Use StartLogTransmissionTimer() to schedule a call.
+ // OnHistogramSynchronizationDone() directly; use
+ // StartSchedulerIfNecessary() to schedule a call.
void OnMemoryDetailCollectionDone();
void OnHistogramSynchronizationDone();
@@ -226,10 +222,6 @@ class MetricsService : public NotificationObserver,
// MakePendingLog does nothing and returns.
void MakePendingLog();
- // Determines from state_ and permissions set out by the server whether the
- // pending_log_ should be sent or discarded.
- bool ServerPermitsTransmission() const;
-
// Check to see if there are any unsent logs from previous sessions.
bool unsent_logs() const {
return !unsent_initial_logs_.empty() || !unsent_ongoing_logs_.empty();
@@ -264,9 +256,9 @@ class MetricsService : public NotificationObserver,
const ResponseCookies& cookies,
const std::string& data);
- // Called by OnURLFetchComplete to handle the case when the server returned
- // a response code not equal to 200.
- void HandleBadResponseCode();
+ // Logs debugging details, for the case where the server returns a response
+ // code other than 200.
+ void LogBadResponseCode();
// Records a window-related notification.
void LogWindowChange(NotificationType type,
@@ -345,12 +337,6 @@ class MetricsService : public NotificationObserver,
bool recording_active_;
bool reporting_active_;
- // The variable server_permits_upload_ is set true when the response
- // data forbids uploading. This should coinside with the "die roll"
- // with probability in the upload tag of the response data came out
- // affirmative.
- bool server_permits_upload_;
-
// The progession of states made by the browser are recorded in the following
// state.
State state_;
@@ -409,14 +395,12 @@ class MetricsService : public NotificationObserver,
// at creation time from the prefs.
scoped_ptr<DictionaryValue> profile_dictionary_;
- // The interval between consecutive log transmissions (to avoid hogging the
- // outbound network link). This is usually also the duration for which we
- // build up a log, but if other unsent-logs from previous sessions exist, we
- // quickly transmit those unsent logs while we continue to build a log.
- base::TimeDelta interlog_duration_;
+ // The scheduler for determining when uploads should happen.
+ scoped_ptr<MetricsReportingScheduler> scheduler_;
- // Indicate that a timer for sending the next log has already been queued.
- bool timer_pending_;
+ // Indicates that an asynchronous reporting step is running.
+ // This is used only for debugging.
+ bool waiting_for_asynchronus_reporting_step_;
#if defined(OS_CHROMEOS)
// The external metric service is used to log ChromeOS UMA events.
« no previous file with comments | « chrome/browser/metrics/metrics_reporting_scheduler.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698