Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); | 439 registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); |
| 440 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, | 440 registry->RegisterIntegerPref(prefs::kStabilityExtensionRendererCrashCount, |
| 441 0); | 441 0); |
| 442 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); | 442 registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); |
| 443 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); | 443 registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); |
| 444 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0); | 444 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationFail, 0); |
| 445 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess, | 445 registry->RegisterIntegerPref(prefs::kStabilityBreakpadRegistrationSuccess, |
| 446 0); | 446 0); |
| 447 registry->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0); | 447 registry->RegisterIntegerPref(prefs::kStabilityDebuggerPresent, 0); |
| 448 registry->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0); | 448 registry->RegisterIntegerPref(prefs::kStabilityDebuggerNotPresent, 0); |
| 449 registry->RegisterIntegerPref(prefs::kStabilityGpuCrashCount, 0); | |
| 449 #if defined(OS_CHROMEOS) | 450 #if defined(OS_CHROMEOS) |
| 450 registry->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0); | 451 registry->RegisterIntegerPref(prefs::kStabilityOtherUserCrashCount, 0); |
| 451 registry->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0); | 452 registry->RegisterIntegerPref(prefs::kStabilityKernelCrashCount, 0); |
| 452 registry->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount, 0); | 453 registry->RegisterIntegerPref(prefs::kStabilitySystemUncleanShutdownCount, 0); |
| 453 #endif // OS_CHROMEOS | 454 #endif // OS_CHROMEOS |
| 454 | 455 |
| 455 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfile, | 456 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfile, |
| 456 std::string()); | 457 std::string()); |
| 457 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfileHash, | 458 registry->RegisterStringPref(prefs::kStabilitySavedSystemProfileHash, |
| 458 std::string()); | 459 std::string()); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 479 local_state->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0); | 480 local_state->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0); |
| 480 local_state->SetInteger(prefs::kStabilityDebuggerPresent, 0); | 481 local_state->SetInteger(prefs::kStabilityDebuggerPresent, 0); |
| 481 local_state->SetInteger(prefs::kStabilityDebuggerNotPresent, 0); | 482 local_state->SetInteger(prefs::kStabilityDebuggerNotPresent, 0); |
| 482 | 483 |
| 483 local_state->SetInteger(prefs::kStabilityLaunchCount, 0); | 484 local_state->SetInteger(prefs::kStabilityLaunchCount, 0); |
| 484 local_state->SetInteger(prefs::kStabilityCrashCount, 0); | 485 local_state->SetInteger(prefs::kStabilityCrashCount, 0); |
| 485 | 486 |
| 486 local_state->SetInteger(prefs::kStabilityPageLoadCount, 0); | 487 local_state->SetInteger(prefs::kStabilityPageLoadCount, 0); |
| 487 local_state->SetInteger(prefs::kStabilityRendererCrashCount, 0); | 488 local_state->SetInteger(prefs::kStabilityRendererCrashCount, 0); |
| 488 local_state->SetInteger(prefs::kStabilityRendererHangCount, 0); | 489 local_state->SetInteger(prefs::kStabilityRendererHangCount, 0); |
| 490 local_state->SetInteger(prefs::kStabilityGpuCrashCount, 0); | |
| 489 | 491 |
| 490 local_state->SetInt64(prefs::kStabilityLaunchTimeSec, 0); | 492 local_state->SetInt64(prefs::kStabilityLaunchTimeSec, 0); |
| 491 local_state->SetInt64(prefs::kStabilityLastTimestampSec, 0); | 493 local_state->SetInt64(prefs::kStabilityLastTimestampSec, 0); |
| 492 | 494 |
| 493 local_state->ClearPref(prefs::kStabilityPluginStats); | 495 local_state->ClearPref(prefs::kStabilityPluginStats); |
| 494 | 496 |
| 495 local_state->ClearPref(prefs::kMetricsInitialLogs); | 497 local_state->ClearPref(prefs::kMetricsInitialLogs); |
| 496 local_state->ClearPref(prefs::kMetricsOngoingLogs); | 498 local_state->ClearPref(prefs::kMetricsOngoingLogs); |
| 497 } | 499 } |
| 498 | 500 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED, | 670 registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED, |
| 669 content::NotificationService::AllSources()); | 671 content::NotificationService::AllSources()); |
| 670 registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING, | 672 registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING, |
| 671 content::NotificationService::AllSources()); | 673 content::NotificationService::AllSources()); |
| 672 registrar->Add(observer, content::NOTIFICATION_LOAD_START, | 674 registrar->Add(observer, content::NOTIFICATION_LOAD_START, |
| 673 content::NotificationService::AllSources()); | 675 content::NotificationService::AllSources()); |
| 674 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, | 676 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, |
| 675 content::NotificationService::AllSources()); | 677 content::NotificationService::AllSources()); |
| 676 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 678 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 677 content::NotificationService::AllSources()); | 679 content::NotificationService::AllSources()); |
| 680 registrar->Add(observer, content::NOTIFICATION_GPU_PROCESS_CLOSED, | |
| 681 content::NotificationService::AllSources()); | |
| 678 registrar->Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, | 682 registrar->Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
| 679 content::NotificationService::AllSources()); | 683 content::NotificationService::AllSources()); |
| 680 registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 684 registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 681 content::NotificationService::AllSources()); | 685 content::NotificationService::AllSources()); |
| 682 } | 686 } |
| 683 | 687 |
| 684 void MetricsService::BrowserChildProcessHostConnected( | 688 void MetricsService::BrowserChildProcessHostConnected( |
| 685 const content::ChildProcessData& data) { | 689 const content::ChildProcessData& data) { |
| 686 GetChildProcessStats(data).process_launches++; | 690 GetChildProcessStats(data).process_launches++; |
| 687 } | 691 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 break; | 747 break; |
| 744 | 748 |
| 745 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { | 749 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { |
| 746 MetricsLog* current_log = | 750 MetricsLog* current_log = |
| 747 static_cast<MetricsLog*>(log_manager_.current_log()); | 751 static_cast<MetricsLog*>(log_manager_.current_log()); |
| 748 DCHECK(current_log); | 752 DCHECK(current_log); |
| 749 current_log->RecordOmniboxOpenedURL( | 753 current_log->RecordOmniboxOpenedURL( |
| 750 *content::Details<OmniboxLog>(details).ptr()); | 754 *content::Details<OmniboxLog>(details).ptr()); |
| 751 break; | 755 break; |
| 752 } | 756 } |
| 757 case content::NOTIFICATION_GPU_PROCESS_CLOSED: { | |
|
Alexei Svitkine (slow)
2013/12/13 22:37:22
Nit: blank line before this; also {}'s unnecessary
rkaplow
2013/12/13 23:54:03
ok, was following most of the style from this meth
| |
| 758 LogGpuCrash(); | |
| 759 break; | |
| 760 } | |
| 753 | 761 |
| 754 default: | 762 default: |
| 755 NOTREACHED(); | 763 NOTREACHED(); |
| 756 break; | 764 break; |
| 757 } | 765 } |
| 758 | 766 |
| 759 HandleIdleSinceLastTransmission(false); | 767 HandleIdleSinceLastTransmission(false); |
| 760 } | 768 } |
| 761 | 769 |
| 762 void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) { | 770 void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) { |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1723 } | 1731 } |
| 1724 return; | 1732 return; |
| 1725 } | 1733 } |
| 1726 } | 1734 } |
| 1727 | 1735 |
| 1728 SyntheticTrialGroup trial_group( | 1736 SyntheticTrialGroup trial_group( |
| 1729 trial.id.name, trial.id.group, base::TimeTicks::Now()); | 1737 trial.id.name, trial.id.group, base::TimeTicks::Now()); |
| 1730 synthetic_trial_groups_.push_back(trial_group); | 1738 synthetic_trial_groups_.push_back(trial_group); |
| 1731 } | 1739 } |
| 1732 | 1740 |
| 1741 void MetricsService::LogGpuCrash() { | |
| 1742 IncrementPrefValue(prefs::kStabilityGpuCrashCount); | |
| 1743 } | |
| 1744 | |
| 1733 void MetricsService::GetCurrentSyntheticFieldTrials( | 1745 void MetricsService::GetCurrentSyntheticFieldTrials( |
| 1734 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials) { | 1746 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials) { |
| 1735 DCHECK(synthetic_trials); | 1747 DCHECK(synthetic_trials); |
| 1736 synthetic_trials->clear(); | 1748 synthetic_trials->clear(); |
| 1737 const MetricsLog* current_log = | 1749 const MetricsLog* current_log = |
| 1738 static_cast<const MetricsLog*>(log_manager_.current_log()); | 1750 static_cast<const MetricsLog*>(log_manager_.current_log()); |
| 1739 for (size_t i = 0; i < synthetic_trial_groups_.size(); ++i) { | 1751 for (size_t i = 0; i < synthetic_trial_groups_.size(); ++i) { |
| 1740 if (synthetic_trial_groups_[i].start_time <= current_log->creation_time()) | 1752 if (synthetic_trial_groups_[i].start_time <= current_log->creation_time()) |
| 1741 synthetic_trials->push_back(synthetic_trial_groups_[i].id); | 1753 synthetic_trials->push_back(synthetic_trial_groups_[i].id); |
| 1742 } | 1754 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1932 if (local_state) { | 1944 if (local_state) { |
| 1933 const PrefService::Preference* uma_pref = | 1945 const PrefService::Preference* uma_pref = |
| 1934 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1946 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1935 if (uma_pref) { | 1947 if (uma_pref) { |
| 1936 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1948 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1937 DCHECK(success); | 1949 DCHECK(success); |
| 1938 } | 1950 } |
| 1939 } | 1951 } |
| 1940 return result; | 1952 return result; |
| 1941 } | 1953 } |
| OLD | NEW |