summaryrefslogtreecommitdiffstats
path: root/chrome_frame/metrics_service.cc
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 12:15:08 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 12:15:08 +0000
commit29948268e9627a0c5160f62ec003f84416ddc9b3 (patch)
treee0613a8dedcc659f3d0512c783b0183968ecd55a /chrome_frame/metrics_service.cc
parent184ec596c2961296978060fa57a595da146665e8 (diff)
downloadchromium_src-29948268e9627a0c5160f62ec003f84416ddc9b3.zip
chromium_src-29948268e9627a0c5160f62ec003f84416ddc9b3.tar.gz
chromium_src-29948268e9627a0c5160f62ec003f84416ddc9b3.tar.bz2
Begin to separate the MetricsService logic for creating vs uploading logs
The biggest change here is to remove the dedicated current->staged->upload pipeline, and instead have finishing a log add it to the queue (the same one that's used for old logs that came from disk), and always do uploading by staging from the queue. That will allow for MetricsService to handle cutting logs and uploading logs separately in a future CL (and allows for a bit of simplification now in the shutdown case, where it's no longer necessary to stage the current log for upload just so that it's possible to immediately store it). The rest of the MetricsService changes aren't actually changing the flow, the just split some things into more methods so that future CLs to separate cutting logs and uploading them will be smaller and easier to understand. StartFinalLogInfoCollection/OnFinalLogInfoCollectionDone were added to make it much more clear how StartScheduledUpload gets to the code that actually does the uploading, since it's confusing to have to follow the jumps through the various implementation details of the specific info being gathered to see what the end point is. BUG=None TEST=Metrics should continue to be reported from official builds Review URL: http://codereview.chromium.org/9396001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/metrics_service.cc')
-rw-r--r--chrome_frame/metrics_service.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc
index 622a892..0186b24 100644
--- a/chrome_frame/metrics_service.cc
+++ b/chrome_frame/metrics_service.cc
@@ -366,8 +366,11 @@ void MetricsService::StartRecording() {
if (log_manager_.current_log())
return;
+ MetricsLogManager::LogType log_type = (state_ == INITIALIZED) ?
+ MetricsLogManager::INITIAL_LOG : MetricsLogManager::ONGOING_LOG;
log_manager_.BeginLoggingWithLog(new MetricsLogBase(client_id_, session_id_,
- GetVersionString()));
+ GetVersionString()),
+ log_type);
if (state_ == INITIALIZED)
state_ = ACTIVE;
}
@@ -384,10 +387,12 @@ void MetricsService::StopRecording(bool save_log) {
RecordCurrentHistograms();
}
- if (save_log)
- log_manager_.StageCurrentLogForUpload();
- else
+ if (save_log) {
+ log_manager_.FinishCurrentLog();
+ log_manager_.StageNextLogForUpload();
+ } else {
log_manager_.DiscardCurrentLog();
+ }
}
void MetricsService::MakePendingLog() {
@@ -409,8 +414,6 @@ void MetricsService::MakePendingLog() {
DCHECK(false);
return;
}
-
- DCHECK(log_manager_.has_staged_log());
}
bool MetricsService::TransmissionPermitted() const {
@@ -434,19 +437,18 @@ bool MetricsService::UploadData() {
}
MakePendingLog();
- DCHECK(log_manager_.has_staged_log());
bool ret = true;
- if (log_manager_.staged_log_text().empty()) {
- NOTREACHED() << "Failed to compress log for transmission.";
- ret = false;
- } else {
+ if (log_manager_.has_staged_log()) {
HRESULT hr = ChromeFrameMetricsDataUploader::UploadDataHelper(
log_manager_.staged_log_text().xml);
DCHECK(SUCCEEDED(hr));
+ log_manager_.DiscardStagedLog();
+ } else {
+ NOTREACHED();
+ ret = false;
}
- log_manager_.DiscardStagedLog();
currently_uploading = 0;
return ret;