summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_service.cc93
-rw-r--r--chrome/browser/metrics/metrics_service.h10
-rw-r--r--chrome/browser/metrics/thread_watcher.cc2
-rw-r--r--chrome/browser/metrics/thread_watcher.h6
4 files changed, 56 insertions, 55 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 73c652c..ed6b5ce 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -181,6 +181,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/child_process_logging.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/guid.h"
#include "chrome/common/pref_names.h"
@@ -533,39 +534,39 @@ bool MetricsService::reporting_active() const {
// static
void MetricsService::SetUpNotifications(NotificationRegistrar* registrar,
NotificationObserver* observer) {
- registrar->Add(observer, NotificationType::BROWSER_OPENED,
+ registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::BROWSER_CLOSED,
+ registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::USER_ACTION,
+ registrar->Add(observer, content::NOTIFICATION_USER_ACTION,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::TAB_PARENTED,
+ registrar->Add(observer, content::NOTIFICATION_TAB_PARENTED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::TAB_CLOSING,
+ registrar->Add(observer, content::NOTIFICATION_TAB_CLOSING,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::LOAD_START,
+ registrar->Add(observer, content::NOTIFICATION_LOAD_START,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::LOAD_STOP,
+ registrar->Add(observer, content::NOTIFICATION_LOAD_STOP,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::RENDERER_PROCESS_CLOSED,
+ registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::RENDERER_PROCESS_HANG,
+ registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_HANG,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::CHILD_PROCESS_HOST_CONNECTED,
+ registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::CHILD_INSTANCE_CREATED,
+ registrar->Add(observer, content::NOTIFICATION_CHILD_INSTANCE_CREATED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::CHILD_PROCESS_CRASHED,
+ registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_CRASHED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::TEMPLATE_URL_SERVICE_LOADED,
+ registrar->Add(observer, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::OMNIBOX_OPENED_URL,
+ registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
NotificationService::AllSources());
- registrar->Add(observer, NotificationType::BOOKMARK_MODEL_LOADED,
+ registrar->Add(observer, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED,
NotificationService::AllSources());
}
-void MetricsService::Observe(NotificationType type,
+void MetricsService::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(current_log_);
@@ -574,30 +575,30 @@ void MetricsService::Observe(NotificationType type,
if (!CanLogNotification(type, source, details))
return;
- switch (type.value) {
- case NotificationType::USER_ACTION:
+ switch (type) {
+ case content::NOTIFICATION_USER_ACTION:
current_log_->RecordUserAction(*Details<const char*>(details).ptr());
break;
- case NotificationType::BROWSER_OPENED:
- case NotificationType::BROWSER_CLOSED:
+ case chrome::NOTIFICATION_BROWSER_OPENED:
+ case chrome::NOTIFICATION_BROWSER_CLOSED:
LogWindowChange(type, source, details);
break;
- case NotificationType::TAB_PARENTED:
- case NotificationType::TAB_CLOSING:
+ case content::NOTIFICATION_TAB_PARENTED:
+ case content::NOTIFICATION_TAB_CLOSING:
LogWindowChange(type, source, details);
break;
- case NotificationType::LOAD_STOP:
+ case content::NOTIFICATION_LOAD_STOP:
LogLoadComplete(type, source, details);
break;
- case NotificationType::LOAD_START:
+ case content::NOTIFICATION_LOAD_START:
LogLoadStarted();
break;
- case NotificationType::RENDERER_PROCESS_CLOSED: {
+ case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
RenderProcessHost::RendererClosedDetails* process_details =
Details<RenderProcessHost::RendererClosedDetails>(details).ptr();
if (process_details->status ==
@@ -613,21 +614,21 @@ void MetricsService::Observe(NotificationType type,
}
break;
- case NotificationType::RENDERER_PROCESS_HANG:
+ case content::NOTIFICATION_RENDERER_PROCESS_HANG:
LogRendererHang();
break;
- case NotificationType::CHILD_PROCESS_HOST_CONNECTED:
- case NotificationType::CHILD_PROCESS_CRASHED:
- case NotificationType::CHILD_INSTANCE_CREATED:
+ case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED:
+ case content::NOTIFICATION_CHILD_PROCESS_CRASHED:
+ case content::NOTIFICATION_CHILD_INSTANCE_CREATED:
LogChildProcessChange(type, source, details);
break;
- case NotificationType::TEMPLATE_URL_SERVICE_LOADED:
+ case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED:
LogKeywords(Source<TemplateURLService>(source).ptr());
break;
- case NotificationType::OMNIBOX_OPENED_URL: {
+ case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: {
MetricsLog* current_log = current_log_->AsMetricsLog();
DCHECK(current_log);
current_log->RecordOmniboxOpenedURL(
@@ -635,7 +636,7 @@ void MetricsService::Observe(NotificationType type,
break;
}
- case NotificationType::BOOKMARK_MODEL_LOADED: {
+ case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: {
Profile* p = Source<Profile>(source).ptr();
if (p)
LogBookmarks(p->GetBookmarkModel());
@@ -1384,7 +1385,7 @@ void MetricsService::LogBadResponseCode() {
}
}
-void MetricsService::LogWindowChange(NotificationType type,
+void MetricsService::LogWindowChange(int type,
const NotificationSource& source,
const NotificationDetails& details) {
int controller_id = -1;
@@ -1402,14 +1403,14 @@ void MetricsService::LogWindowChange(NotificationType type,
}
DCHECK_NE(controller_id, -1);
- switch (type.value) {
- case NotificationType::TAB_PARENTED:
- case NotificationType::BROWSER_OPENED:
+ switch (type) {
+ case content::NOTIFICATION_TAB_PARENTED:
+ case chrome::NOTIFICATION_BROWSER_OPENED:
window_type = MetricsLog::WINDOW_CREATE;
break;
- case NotificationType::TAB_CLOSING:
- case NotificationType::BROWSER_CLOSED:
+ case content::NOTIFICATION_TAB_CLOSING:
+ case chrome::NOTIFICATION_BROWSER_CLOSED:
window_map_.erase(window_map_.find(window_or_tab));
window_type = MetricsLog::WINDOW_DESTROY;
break;
@@ -1423,7 +1424,7 @@ void MetricsService::LogWindowChange(NotificationType type,
current_log_->RecordWindowEvent(window_type, controller_id, 0);
}
-void MetricsService::LogLoadComplete(NotificationType type,
+void MetricsService::LogLoadComplete(int type,
const NotificationSource& source,
const NotificationDetails& details) {
if (details == NotificationService::NoDetails())
@@ -1497,7 +1498,7 @@ void MetricsService::LogChromeOSCrash(const std::string &crash_type) {
#endif // OS_CHROMEOS
void MetricsService::LogChildProcessChange(
- NotificationType type,
+ int type,
const NotificationSource& source,
const NotificationDetails& details) {
Details<ChildProcessInfo> child_details(details);
@@ -1510,16 +1511,16 @@ void MetricsService::LogChildProcessChange(
}
ChildProcessStats& stats = child_process_stats_buffer_[child_name];
- switch (type.value) {
- case NotificationType::CHILD_PROCESS_HOST_CONNECTED:
+ switch (type) {
+ case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED:
stats.process_launches++;
break;
- case NotificationType::CHILD_INSTANCE_CREATED:
+ case content::NOTIFICATION_CHILD_INSTANCE_CREATED:
stats.instances++;
break;
- case NotificationType::CHILD_PROCESS_CRASHED:
+ case content::NOTIFICATION_CHILD_PROCESS_CRASHED:
stats.process_crashes++;
// Exclude plugin crashes from the count below because we report them via
// a separate UMA metric.
@@ -1529,7 +1530,7 @@ void MetricsService::LogChildProcessChange(
break;
default:
- NOTREACHED() << "Unexpected notification type " << type.value;
+ NOTREACHED() << "Unexpected notification type " << type;
return;
}
}
@@ -1659,7 +1660,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
child_process_stats_buffer_.clear();
}
-bool MetricsService::CanLogNotification(NotificationType type,
+bool MetricsService::CanLogNotification(int type,
const NotificationSource& source,
const NotificationDetails& details) {
// We simply don't log anything to UMA if there is a single incognito
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 5a031ed..dd4118f 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -98,7 +98,7 @@ class MetricsService : public NotificationObserver,
NotificationObserver* observer);
// Implementation of NotificationObserver
- virtual void Observe(NotificationType type,
+ virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -266,7 +266,7 @@ class MetricsService : public NotificationObserver,
void LogBadResponseCode();
// Records a window-related notification.
- void LogWindowChange(NotificationType type,
+ void LogWindowChange(int type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -302,7 +302,7 @@ class MetricsService : public NotificationObserver,
// Records a child process related notification. These are recorded to an
// in-object buffer because these notifications are sent on page load, and we
// don't want to slow that down.
- void LogChildProcessChange(NotificationType type,
+ void LogChildProcessChange(int type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -322,12 +322,12 @@ class MetricsService : public NotificationObserver,
void LogLoadStarted();
// Records a page load notification.
- void LogLoadComplete(NotificationType type,
+ void LogLoadComplete(int type,
const NotificationSource& source,
const NotificationDetails& details);
// Checks whether a notification can be logged.
- bool CanLogNotification(NotificationType type,
+ bool CanLogNotification(int type,
const NotificationSource& source,
const NotificationDetails& details);
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
index 3f974ac..2b0da7e 100644
--- a/chrome/browser/metrics/thread_watcher.cc
+++ b/chrome/browser/metrics/thread_watcher.cc
@@ -572,7 +572,7 @@ void ThreadWatcherObserver::RemoveNotifications() {
delete g_thread_watcher_observer_;
}
-void ThreadWatcherObserver::Observe(NotificationType type,
+void ThreadWatcherObserver::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
// There is some user activity, see if thread watchers are to be awakened.
diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h
index b28addf..a53316c 100644
--- a/chrome/browser/metrics/thread_watcher.h
+++ b/chrome/browser/metrics/thread_watcher.h
@@ -393,7 +393,7 @@ class ThreadWatcherObserver : public NotificationObserver {
// method is accessible on UI thread.
static void SetupNotifications(const base::TimeDelta& wakeup_interval);
- // Removes all NotificationTypes from |registrar_| and deletes
+ // Removes all ints from |registrar_| and deletes
// |g_thread_watcher_observer_|. This method is accessible on UI thread.
static void RemoveNotifications();
@@ -409,14 +409,14 @@ class ThreadWatcherObserver : public NotificationObserver {
// seconds. This is the implementation of NotificationObserver. When a
// matching notification is posted to the notification service, this method is
// called.
- virtual void Observe(NotificationType type,
+ virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details);
// The singleton of this class.
static ThreadWatcherObserver* g_thread_watcher_observer_;
- // The registrar that holds NotificationTypes to be observed.
+ // The registrar that holds ints to be observed.
NotificationRegistrar registrar_;
// This is the last time when woke all thread watchers up.