summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorgregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 01:10:42 +0000
committergregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 01:10:42 +0000
commit0d84c5da3cdd0bb2656d284e826a240436f15b05 (patch)
treea66ec29feb02cefe16f418072db43f23fb5507af /chrome
parentc9408bca7cc3e45ab12bff6b3c4d554e4414c903 (diff)
downloadchromium_src-0d84c5da3cdd0bb2656d284e826a240436f15b05.zip
chromium_src-0d84c5da3cdd0bb2656d284e826a240436f15b05.tar.gz
chromium_src-0d84c5da3cdd0bb2656d284e826a240436f15b05.tar.bz2
Bug fix: MetricsService::RecordPluginChanges should handle only plugins
Review URL: http://codereview.chromium.org/264020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/metrics/metrics_service.cc16
-rw-r--r--chrome/browser/metrics/metrics_service.h17
2 files changed, 28 insertions, 5 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 7f654f4..a270a6a 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -1695,12 +1695,14 @@ void MetricsService::LogChildProcessChange(
NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- const std::wstring& child_name =
- Details<ChildProcessInfo>(details)->name();
+ Details<ChildProcessInfo> child_details(details);
+ const std::wstring& child_name = child_details->name();
+
if (child_process_stats_buffer_.find(child_name) ==
child_process_stats_buffer_.end()) {
- child_process_stats_buffer_[child_name] = ChildProcessStats();
+ child_process_stats_buffer_[child_name] =
+ ChildProcessStats(child_details->type());
}
ChildProcessStats& stats = child_process_stats_buffer_[child_name];
@@ -1822,8 +1824,14 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
for (std::map<std::wstring, ChildProcessStats>::iterator cache_iter =
child_process_stats_buffer_.begin();
cache_iter != child_process_stats_buffer_.end(); ++cache_iter) {
- std::wstring plugin_name = cache_iter->first;
ChildProcessStats stats = cache_iter->second;
+
+ // Insert only plugins information into the plugins list.
+ if (ChildProcessInfo::PLUGIN_PROCESS != stats.process_type)
+ continue;
+
+ std::wstring plugin_name = cache_iter->first;
+
DictionaryValue* plugin_dict = new DictionaryValue;
plugin_dict->SetString(prefs::kStabilityPluginName, plugin_name);
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 88912ec..7bf4911 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -20,6 +20,7 @@
#include "base/values.h"
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/child_process_info.h"
#include "chrome/common/notification_registrar.h"
#include "webkit/glue/webplugininfo.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
@@ -37,7 +38,19 @@ class TemplateURLModel;
// reported to the UMA server on next launch.
struct ChildProcessStats {
public:
- ChildProcessStats() : process_launches(0), process_crashes(0), instances(0) {}
+ ChildProcessStats(ChildProcessInfo::ProcessType type)
+ : process_launches(0),
+ process_crashes(0),
+ instances(0),
+ process_type(type) {}
+
+ // This constructor is only used by the map to return some default value for
+ // an index for which no value has been assigned.
+ ChildProcessStats()
+ : process_launches(0),
+ process_crashes(0),
+ instances(0),
+ process_type(ChildProcessInfo::UNKNOWN_PROCESS) {}
// The number of times that the given child process has been launched
int process_launches;
@@ -49,6 +62,8 @@ struct ChildProcessStats {
// An instance is a DOM object rendered by this child process during a page
// load.
int instances;
+
+ ChildProcessInfo::ProcessType process_type;
};
class MetricsService : public NotificationObserver,