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

Side by Side Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 886173002: Allow server endpoint to be injected into the NetMetricsLogUploader from chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_registry_simple.h" 15 #include "base/prefs/pref_registry_simple.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/google/google_brand.h" 23 #include "chrome/browser/google/google_brand.h"
24 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" 24 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h"
25 #include "chrome/browser/metrics/omnibox_metrics_provider.h" 25 #include "chrome/browser/metrics/omnibox_metrics_provider.h"
26 #include "chrome/browser/metrics/url_constants.h"
26 #include "chrome/browser/ui/browser_otr_state.h" 27 #include "chrome/browser/ui/browser_otr_state.h"
27 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/chrome_version_info.h" 30 #include "chrome/common/chrome_version_info.h"
30 #include "chrome/common/crash_keys.h" 31 #include "chrome/common/crash_keys.h"
31 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
32 #include "chrome/common/render_messages.h" 33 #include "chrome/common/render_messages.h"
33 #include "components/metrics/gpu/gpu_metrics_provider.h" 34 #include "components/metrics/gpu/gpu_metrics_provider.h"
34 #include "components/metrics/metrics_service.h" 35 #include "components/metrics/metrics_service.h"
35 #include "components/metrics/net/net_metrics_log_uploader.h" 36 #include "components/metrics/net/net_metrics_log_uploader.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Collect WebCore cache information to put into a histogram. 230 // Collect WebCore cache information to put into a histogram.
230 for (content::RenderProcessHost::iterator i( 231 for (content::RenderProcessHost::iterator i(
231 content::RenderProcessHost::AllHostsIterator()); 232 content::RenderProcessHost::AllHostsIterator());
232 !i.IsAtEnd(); i.Advance()) { 233 !i.IsAtEnd(); i.Advance()) {
233 i.GetCurrentValue()->Send(new ChromeViewMsg_GetCacheResourceStats()); 234 i.GetCurrentValue()->Send(new ChromeViewMsg_GetCacheResourceStats());
234 } 235 }
235 } 236 }
236 237
237 scoped_ptr<metrics::MetricsLogUploader> 238 scoped_ptr<metrics::MetricsLogUploader>
238 ChromeMetricsServiceClient::CreateUploader( 239 ChromeMetricsServiceClient::CreateUploader(
239 const std::string& server_url,
240 const std::string& mime_type,
241 const base::Callback<void(int)>& on_upload_complete) { 240 const base::Callback<void(int)>& on_upload_complete) {
242 return scoped_ptr<metrics::MetricsLogUploader>( 241 return scoped_ptr<metrics::MetricsLogUploader>(
243 new metrics::NetMetricsLogUploader( 242 new metrics::NetMetricsLogUploader(
244 g_browser_process->system_request_context(), server_url, mime_type, 243 g_browser_process->system_request_context(),
244 metrics::kMetricsServerUrl,
245 metrics::kMetricsMimeType,
245 on_upload_complete)); 246 on_upload_complete));
246 } 247 }
247 248
248 base::string16 ChromeMetricsServiceClient::GetRegistryBackupKey() { 249 base::string16 ChromeMetricsServiceClient::GetRegistryBackupKey() {
249 #if defined(OS_WIN) 250 #if defined(OS_WIN)
250 return L"Software\\" PRODUCT_STRING_PATH L"\\StabilityMetrics"; 251 return L"Software\\" PRODUCT_STRING_PATH L"\\StabilityMetrics";
251 #else 252 #else
252 return base::string16(); 253 return base::string16();
253 #endif 254 #endif
254 } 255 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // Capture the histogram samples. 546 // Capture the histogram samples.
546 if (dumps_with_crash != 0) 547 if (dumps_with_crash != 0)
547 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); 548 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash);
548 if (dumps_with_no_crash != 0) 549 if (dumps_with_no_crash != 0)
549 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); 550 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash);
550 int total_dumps = dumps_with_crash + dumps_with_no_crash; 551 int total_dumps = dumps_with_crash + dumps_with_no_crash;
551 if (total_dumps != 0) 552 if (total_dumps != 0)
552 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); 553 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps);
553 } 554 }
554 #endif // defined(OS_WIN) 555 #endif // defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698