| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 10 // A MetricsService instance is typically created at application startup. It |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 // Wake up metrics logs sending if necessary now that new | 1332 // Wake up metrics logs sending if necessary now that new |
| 1333 // log data is available. | 1333 // log data is available. |
| 1334 HandleIdleSinceLastTransmission(false); | 1334 HandleIdleSinceLastTransmission(false); |
| 1335 } | 1335 } |
| 1336 #endif // OS_CHROMEOS | 1336 #endif // OS_CHROMEOS |
| 1337 | 1337 |
| 1338 void MetricsService::LogChildProcessChange( | 1338 void MetricsService::LogChildProcessChange( |
| 1339 int type, | 1339 int type, |
| 1340 const content::NotificationSource& source, | 1340 const content::NotificationSource& source, |
| 1341 const content::NotificationDetails& details) { | 1341 const content::NotificationDetails& details) { |
| 1342 content::Details<ChildProcessInfo> child_details(details); | 1342 content::Details<content::ChildProcessData> child_details(details); |
| 1343 const string16& child_name = child_details->name(); | 1343 const string16& child_name = child_details->name; |
| 1344 | 1344 |
| 1345 if (child_process_stats_buffer_.find(child_name) == | 1345 if (child_process_stats_buffer_.find(child_name) == |
| 1346 child_process_stats_buffer_.end()) { | 1346 child_process_stats_buffer_.end()) { |
| 1347 child_process_stats_buffer_[child_name] = | 1347 child_process_stats_buffer_[child_name] = |
| 1348 ChildProcessStats(child_details->type()); | 1348 ChildProcessStats(child_details->type); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; | 1351 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; |
| 1352 switch (type) { | 1352 switch (type) { |
| 1353 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: | 1353 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: |
| 1354 stats.process_launches++; | 1354 stats.process_launches++; |
| 1355 break; | 1355 break; |
| 1356 | 1356 |
| 1357 case content::NOTIFICATION_CHILD_INSTANCE_CREATED: | 1357 case content::NOTIFICATION_CHILD_INSTANCE_CREATED: |
| 1358 stats.instances++; | 1358 stats.instances++; |
| 1359 break; | 1359 break; |
| 1360 | 1360 |
| 1361 case content::NOTIFICATION_CHILD_PROCESS_CRASHED: | 1361 case content::NOTIFICATION_CHILD_PROCESS_CRASHED: |
| 1362 stats.process_crashes++; | 1362 stats.process_crashes++; |
| 1363 // Exclude plugin crashes from the count below because we report them via | 1363 // Exclude plugin crashes from the count below because we report them via |
| 1364 // a separate UMA metric. | 1364 // a separate UMA metric. |
| 1365 if (!IsPluginProcess(child_details->type())) { | 1365 if (!IsPluginProcess(child_details->type)) { |
| 1366 IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); | 1366 IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); |
| 1367 } | 1367 } |
| 1368 break; | 1368 break; |
| 1369 | 1369 |
| 1370 default: | 1370 default: |
| 1371 NOTREACHED() << "Unexpected notification type " << type; | 1371 NOTREACHED() << "Unexpected notification type " << type; |
| 1372 return; | 1372 return; |
| 1373 } | 1373 } |
| 1374 } | 1374 } |
| 1375 | 1375 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 if (local_state) { | 1552 if (local_state) { |
| 1553 const PrefService::Preference* uma_pref = | 1553 const PrefService::Preference* uma_pref = |
| 1554 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1554 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1555 if (uma_pref) { | 1555 if (uma_pref) { |
| 1556 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1556 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1557 DCHECK(success); | 1557 DCHECK(success); |
| 1558 } | 1558 } |
| 1559 } | 1559 } |
| 1560 return result; | 1560 return result; |
| 1561 } | 1561 } |
| OLD | NEW |