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

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

Issue 308433004: Reduce plugin_metrics_provider_ usage in MetricsService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1384
1385 // Redundant setting to assure that we always reset this value at shutdown 1385 // Redundant setting to assure that we always reset this value at shutdown
1386 // (and that we don't use some alternate path, and not call LogCleanShutdown). 1386 // (and that we don't use some alternate path, and not call LogCleanShutdown).
1387 clean_shutdown_status_ = CLEANLY_SHUTDOWN; 1387 clean_shutdown_status_ = CLEANLY_SHUTDOWN;
1388 1388
1389 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); 1389 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true);
1390 local_state_->SetInteger(prefs::kStabilityExecutionPhase, 1390 local_state_->SetInteger(prefs::kStabilityExecutionPhase,
1391 MetricsService::SHUTDOWN_COMPLETE); 1391 MetricsService::SHUTDOWN_COMPLETE);
1392 } 1392 }
1393 1393
1394 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) {
1395 #if defined(ENABLE_PLUGINS)
1396 // TODO(asvitkine): Move this out of here.
1397 plugin_metrics_provider_->LogPluginLoadingError(plugin_path);
1398 #endif
1399 }
1400
1401 bool MetricsService::ShouldLogEvents() { 1394 bool MetricsService::ShouldLogEvents() {
1402 // We simply don't log events to UMA if there is a single incognito 1395 // We simply don't log events to UMA if there is a single incognito
1403 // session visible. The problem is that we always notify using the orginal 1396 // session visible. The problem is that we always notify using the orginal
1404 // profile in order to simplify notification processing. 1397 // profile in order to simplify notification processing.
1405 return !client_->IsOffTheRecordSessionActive(); 1398 return !client_->IsOffTheRecordSessionActive();
1406 } 1399 }
1407 1400
1408 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { 1401 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) {
1409 DCHECK(IsSingleThreaded()); 1402 DCHECK(IsSingleThreaded());
1410 local_state_->SetBoolean(path, value); 1403 local_state_->SetBoolean(path, value);
1411 RecordCurrentState(local_state_); 1404 RecordCurrentState(local_state_);
1412 } 1405 }
1413 1406
1414 void MetricsService::RecordCurrentState(PrefService* pref) { 1407 void MetricsService::RecordCurrentState(PrefService* pref) {
1415 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); 1408 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT());
1416 1409
1417 #if defined(ENABLE_PLUGINS) 1410 for (size_t i = 0; i < metrics_providers_.size(); ++i)
1418 plugin_metrics_provider_->RecordPluginChanges(); 1411 metrics_providers_[i]->RecordCurrentState();
Alexei Svitkine (slow) 2014/05/29 20:47:44 I know this is what the current code does, but I'm
blundell 2014/05/30 14:42:10 I think you're better suited to make that change.
1419 #endif
1420 } 1412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698