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

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

Issue 1130993005: Reset metrics if cellular uploads logic should be applied. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 void ChromeMetricsServiceClient::LogPluginLoadingError( 272 void ChromeMetricsServiceClient::LogPluginLoadingError(
273 const base::FilePath& plugin_path) { 273 const base::FilePath& plugin_path) {
274 #if defined(ENABLE_PLUGINS) 274 #if defined(ENABLE_PLUGINS)
275 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); 275 plugin_metrics_provider_->LogPluginLoadingError(plugin_path);
276 #else 276 #else
277 NOTREACHED(); 277 NOTREACHED();
278 #endif // defined(ENABLE_PLUGINS) 278 #endif // defined(ENABLE_PLUGINS)
279 } 279 }
280 280
281 void ChromeMetricsServiceClient::Initialize() { 281 void ChromeMetricsServiceClient::Initialize() {
282
Alexei Svitkine (slow) 2015/05/07 21:06:53 Nit: No blank line at start of function.
gayane -on leave until 09-2017 2015/05/07 21:25:59 Done.
283 // Reset metrics reports before initializing metrics service so that metrics
284 // log manager is initialized correctly.
Alexei Svitkine (slow) 2015/05/07 22:04:17 This comment only explains why you're doing this h
gayane -on leave until 09-2017 2015/05/11 23:02:05 Done.
285 #if defined(OS_ANDROID)
286 PrefService* local_state = g_browser_process->local_state();
287 if (!local_state->HasPrefPath(prefs::kMetricsReportingEnabled) &&
Alexei Svitkine (slow) 2015/05/07 21:06:53 Can you remind me where this pref will be initiali
gayane -on leave until 09-2017 2015/05/07 21:25:58 This pref will be initialized as soon as new sessi
Alexei Svitkine (slow) 2015/05/07 22:04:17 I see - it's unfortunate that the two places are s
gayane -on leave until 09-2017 2015/05/11 23:02:05 I guess we could do this in UmaSessionStats if I c
Alexei Svitkine (slow) 2015/05/12 16:40:00 That seems more complicated. I'm OK with the curre
288 variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
Alexei Svitkine (slow) 2015/05/07 21:06:53 Nit: Align.
gayane -on leave until 09-2017 2015/05/07 21:25:59 Done.
289 "Enabled") == "true") {
290 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs);
291 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs);
292 }
293 #endif
294
282 metrics_service_.reset(new metrics::MetricsService( 295 metrics_service_.reset(new metrics::MetricsService(
283 metrics_state_manager_, this, g_browser_process->local_state())); 296 metrics_state_manager_, this, g_browser_process->local_state()));
284 297
285 // Register metrics providers. 298 // Register metrics providers.
286 #if defined(ENABLE_EXTENSIONS) 299 #if defined(ENABLE_EXTENSIONS)
287 metrics_service_->RegisterMetricsProvider( 300 metrics_service_->RegisterMetricsProvider(
288 scoped_ptr<metrics::MetricsProvider>( 301 scoped_ptr<metrics::MetricsProvider>(
289 new ExtensionsMetricsProvider(metrics_state_manager_))); 302 new ExtensionsMetricsProvider(metrics_state_manager_)));
290 #endif 303 #endif
291 metrics_service_->RegisterMetricsProvider( 304 metrics_service_->RegisterMetricsProvider(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 new SigninStatusMetricsProviderChromeOS; 369 new SigninStatusMetricsProviderChromeOS;
357 metrics_service_->RegisterMetricsProvider( 370 metrics_service_->RegisterMetricsProvider(
358 scoped_ptr<metrics::MetricsProvider>(signin_metrics_provider_cros)); 371 scoped_ptr<metrics::MetricsProvider>(signin_metrics_provider_cros));
359 #endif // defined(OS_CHROMEOS) 372 #endif // defined(OS_CHROMEOS)
360 373
361 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) 374 #if !defined(OS_CHROMEOS) && !defined(OS_IOS)
362 metrics_service_->RegisterMetricsProvider( 375 metrics_service_->RegisterMetricsProvider(
363 scoped_ptr<metrics::MetricsProvider>( 376 scoped_ptr<metrics::MetricsProvider>(
364 SigninStatusMetricsProvider::CreateInstance())); 377 SigninStatusMetricsProvider::CreateInstance()));
365 #endif // !defined(OS_CHROMEOS) && !defined(OS_IOS) 378 #endif // !defined(OS_CHROMEOS) && !defined(OS_IOS)
379
380 // Reset stability metrics after all providers are registered.
Alexei Svitkine (slow) 2015/05/07 22:04:17 Expand comment to mention *why* it's done after al
gayane -on leave until 09-2017 2015/05/11 23:02:05 Done.
381 #if defined(OS_ANDROID)
382 if (!local_state->HasPrefPath(prefs::kMetricsReportingEnabled) &&
383 variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
384 "Enabled") == "true") {
Alexei Svitkine (slow) 2015/05/07 21:06:53 You're repeating this in two places - make a helpe
gayane -on leave until 09-2017 2015/05/07 21:25:58 Done.
385 metrics_service_->ClearSavedStabilityMetrics();
386 }
387 #endif
366 } 388 }
367 389
368 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() { 390 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() {
369 const base::Closure got_plugin_info_callback = 391 const base::Closure got_plugin_info_callback =
370 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo, 392 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo,
371 weak_ptr_factory_.GetWeakPtr()); 393 weak_ptr_factory_.GetWeakPtr());
372 394
373 #if defined(ENABLE_PLUGINS) 395 #if defined(ENABLE_PLUGINS)
374 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback); 396 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback);
375 #else 397 #else
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 case content::NOTIFICATION_LOAD_START: 547 case content::NOTIFICATION_LOAD_START:
526 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: 548 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED:
527 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: 549 case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG:
528 metrics_service_->OnApplicationNotIdle(); 550 metrics_service_->OnApplicationNotIdle();
529 break; 551 break;
530 552
531 default: 553 default:
532 NOTREACHED(); 554 NOTREACHED();
533 } 555 }
534 } 556 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698