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

Side by Side Diff: components/metrics/metrics_service.cc

Issue 2614533002: Add server_url and mime_type params to CreateUploader. (Closed)
Patch Set: Missing Include Created 3 years, 11 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 #include "components/browser_watcher/stability_data_names.h" 152 #include "components/browser_watcher/stability_data_names.h"
153 #include "components/browser_watcher/stability_debugging.h" 153 #include "components/browser_watcher/stability_debugging.h"
154 #include "components/metrics/data_use_tracker.h" 154 #include "components/metrics/data_use_tracker.h"
155 #include "components/metrics/metrics_log.h" 155 #include "components/metrics/metrics_log.h"
156 #include "components/metrics/metrics_log_manager.h" 156 #include "components/metrics/metrics_log_manager.h"
157 #include "components/metrics/metrics_log_uploader.h" 157 #include "components/metrics/metrics_log_uploader.h"
158 #include "components/metrics/metrics_pref_names.h" 158 #include "components/metrics/metrics_pref_names.h"
159 #include "components/metrics/metrics_reporting_scheduler.h" 159 #include "components/metrics/metrics_reporting_scheduler.h"
160 #include "components/metrics/metrics_service_client.h" 160 #include "components/metrics/metrics_service_client.h"
161 #include "components/metrics/metrics_state_manager.h" 161 #include "components/metrics/metrics_state_manager.h"
162 #include "components/metrics/url_constants.h"
162 #include "components/prefs/pref_registry_simple.h" 163 #include "components/prefs/pref_registry_simple.h"
163 #include "components/prefs/pref_service.h" 164 #include "components/prefs/pref_service.h"
164 #include "components/variations/entropy_provider.h" 165 #include "components/variations/entropy_provider.h"
165 166
166 namespace metrics { 167 namespace metrics {
167 168
168 namespace { 169 namespace {
169 170
170 // Check to see that we're being called on only one thread. 171 // Check to see that we're being called on only one thread.
171 bool IsSingleThreaded() { 172 bool IsSingleThreaded() {
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 void MetricsService::SendStagedLog() { 1003 void MetricsService::SendStagedLog() {
1003 DCHECK(log_manager_.has_staged_log()); 1004 DCHECK(log_manager_.has_staged_log());
1004 if (!log_manager_.has_staged_log()) 1005 if (!log_manager_.has_staged_log())
1005 return; 1006 return;
1006 1007
1007 DCHECK(!log_upload_in_progress_); 1008 DCHECK(!log_upload_in_progress_);
1008 log_upload_in_progress_ = true; 1009 log_upload_in_progress_ = true;
1009 1010
1010 if (!log_uploader_) { 1011 if (!log_uploader_) {
1011 log_uploader_ = client_->CreateUploader( 1012 log_uploader_ = client_->CreateUploader(
1013 client_->GetMetricsServerUrl(),
1014 metrics::kDefaultMetricsMimeType,
1012 base::Bind(&MetricsService::OnLogUploadComplete, 1015 base::Bind(&MetricsService::OnLogUploadComplete,
1013 self_ptr_factory_.GetWeakPtr())); 1016 self_ptr_factory_.GetWeakPtr()));
1014 } 1017 }
1015 1018
1016 const std::string hash = 1019 const std::string hash =
1017 base::HexEncode(log_manager_.staged_log_hash().data(), 1020 base::HexEncode(log_manager_.staged_log_hash().data(),
1018 log_manager_.staged_log_hash().size()); 1021 log_manager_.staged_log_hash().size());
1019 log_uploader_->UploadLog(log_manager_.staged_log(), hash); 1022 log_uploader_->UploadLog(log_manager_.staged_log(), hash);
1020 1023
1021 HandleIdleSinceLastTransmission(true); 1024 HandleIdleSinceLastTransmission(true);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed); 1226 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed);
1224 RecordCurrentState(local_state_); 1227 RecordCurrentState(local_state_);
1225 } 1228 }
1226 1229
1227 void MetricsService::RecordCurrentState(PrefService* pref) { 1230 void MetricsService::RecordCurrentState(PrefService* pref) {
1228 pref->SetInt64(prefs::kStabilityLastTimestampSec, 1231 pref->SetInt64(prefs::kStabilityLastTimestampSec,
1229 base::Time::Now().ToTimeT()); 1232 base::Time::Now().ToTimeT());
1230 } 1233 }
1231 1234
1232 } // namespace metrics 1235 } // namespace metrics
OLDNEW
« no previous file with comments | « chromecast/browser/metrics/cast_metrics_service_client.cc ('k') | components/metrics/metrics_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698