| 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 #include "chrome/browser/performance_monitor/performance_monitor.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void PerformanceMonitor::RegisterForNotifications() { | 89 void PerformanceMonitor::RegisterForNotifications() { |
| 90 // Extensions | 90 // Extensions |
| 91 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 91 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 92 content::NotificationService::AllSources()); | 92 content::NotificationService::AllSources()); |
| 93 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, | 93 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, |
| 94 content::NotificationService::AllSources()); | 94 content::NotificationService::AllSources()); |
| 95 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 95 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 96 content::NotificationService::AllSources()); | 96 content::NotificationService::AllSources()); |
| 97 registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 97 registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 98 content::NotificationService::AllSources()); | 98 content::NotificationService::AllSources()); |
| 99 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 100 content::NotificationService::AllSources()); |
| 99 | 101 |
| 100 // Crashes | 102 // Crashes |
| 101 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_HANG, | 103 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_HANG, |
| 102 content::NotificationService::AllSources()); | 104 content::NotificationService::AllSources()); |
| 103 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 105 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 104 content::NotificationService::AllSources()); | 106 content::NotificationService::AllSources()); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void PerformanceMonitor::CheckForVersionUpdateOnBackgroundThread() { | 109 void PerformanceMonitor::CheckForVersionUpdateOnBackgroundThread() { |
| 108 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 110 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 extension->name(), | 199 extension->name(), |
| 198 extension->url().spec(), | 200 extension->url().spec(), |
| 199 extension->location(), | 201 extension->location(), |
| 200 extension->VersionString(), | 202 extension->VersionString(), |
| 201 extension->description(), | 203 extension->description(), |
| 202 info->reason)); | 204 info->reason)); |
| 203 break; | 205 break; |
| 204 } | 206 } |
| 205 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { | 207 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { |
| 206 const CrxInstaller* installer = | 208 const CrxInstaller* installer = |
| 207 content::Source<CrxInstaller>(source).ptr(); | 209 content::Source<CrxInstaller>(source).ptr(); |
| 208 | 210 |
| 209 // Check if the reason for the install was due to an extension update. | 211 // Check if the reason for the install was due to an extension update. |
| 210 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE) | 212 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE) |
| 211 break; | 213 break; |
| 212 | 214 |
| 213 const Extension* extension = content::Details<Extension>(details).ptr(); | 215 const Extension* extension = content::Details<Extension>(details).ptr(); |
| 214 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(), | 216 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(), |
| 215 extension->id(), | 217 extension->id(), |
| 216 extension->name(), | 218 extension->name(), |
| 217 extension->url().spec(), | 219 extension->url().spec(), |
| 218 extension->location(), | 220 extension->location(), |
| 219 extension->VersionString(), | 221 extension->VersionString(), |
| 220 extension->description())); | 222 extension->description())); |
| 221 break; | 223 break; |
| 222 } | 224 } |
| 225 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
| 226 const Extension* extension = content::Details<Extension>(details).ptr(); |
| 227 AddEvent(util::CreateExtensionUninstallEvent(base::Time::Now(), |
| 228 extension->id(), |
| 229 extension->name(), |
| 230 extension->url().spec(), |
| 231 extension->location(), |
| 232 extension->VersionString(), |
| 233 extension->description())); |
| 234 break; |
| 235 } |
| 223 case content::NOTIFICATION_RENDERER_PROCESS_HANG: { | 236 case content::NOTIFICATION_RENDERER_PROCESS_HANG: { |
| 224 content::WebContents* contents = | 237 content::WebContents* contents = |
| 225 content::Source<content::WebContents>(source).ptr(); | 238 content::Source<content::WebContents>(source).ptr(); |
| 226 AddEvent(util::CreateRendererFreezeEvent(base::Time::Now(), | 239 AddEvent(util::CreateRendererFreezeEvent(base::Time::Now(), |
| 227 contents->GetURL().spec())); | 240 contents->GetURL().spec())); |
| 228 break; | 241 break; |
| 229 } | 242 } |
| 230 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { | 243 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { |
| 231 content::RenderProcessHost::RendererClosedDetails closed_details = | 244 content::RenderProcessHost::RendererClosedDetails closed_details = |
| 232 *content::Details<content::RenderProcessHost::RendererClosedDetails>( | 245 *content::Details<content::RenderProcessHost::RendererClosedDetails>( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 247 break; | 260 break; |
| 248 } | 261 } |
| 249 default: { | 262 default: { |
| 250 NOTREACHED(); | 263 NOTREACHED(); |
| 251 break; | 264 break; |
| 252 } | 265 } |
| 253 } | 266 } |
| 254 } | 267 } |
| 255 | 268 |
| 256 } // namespace performance_monitor | 269 } // namespace performance_monitor |
| OLD | NEW |