| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 content::Details<Extension>(details).ptr()); | 479 content::Details<Extension>(details).ptr()); |
| 480 } | 480 } |
| 481 break; | 481 break; |
| 482 } | 482 } |
| 483 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { | 483 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
| 484 AddExtensionEvent(EVENT_EXTENSION_UNINSTALL, | 484 AddExtensionEvent(EVENT_EXTENSION_UNINSTALL, |
| 485 content::Details<Extension>(details).ptr()); | 485 content::Details<Extension>(details).ptr()); |
| 486 break; | 486 break; |
| 487 } | 487 } |
| 488 case content::NOTIFICATION_RENDERER_PROCESS_HANG: { | 488 case content::NOTIFICATION_RENDERER_PROCESS_HANG: { |
| 489 content::WebContents* contents = | 489 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), |
| 490 content::Source<content::WebContents>(source).ptr(); | 490 EVENT_RENDERER_HANG)); |
| 491 AddEvent(util::CreateRendererFreezeEvent(base::Time::Now(), | |
| 492 contents->GetURL().spec())); | |
| 493 break; | 491 break; |
| 494 } | 492 } |
| 495 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { | 493 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { |
| 496 AddCrashEvent(*content::Details< | 494 AddRendererClosedEvent(*content::Details< |
| 497 content::RenderProcessHost::RendererClosedDetails>(details).ptr()); | 495 content::RenderProcessHost::RendererClosedDetails>(details).ptr()); |
| 498 break; | 496 break; |
| 499 } | 497 } |
| 500 case chrome::NOTIFICATION_PROFILE_ADDED: { | 498 case chrome::NOTIFICATION_PROFILE_ADDED: { |
| 501 Profile* profile = content::Source<Profile>(source).ptr(); | 499 Profile* profile = content::Source<Profile>(source).ptr(); |
| 502 if (!profile->DidLastSessionExitCleanly()) { | 500 if (!profile->DidLastSessionExitCleanly()) { |
| 503 BrowserThread::PostBlockingPoolSequencedTask( | 501 BrowserThread::PostBlockingPoolSequencedTask( |
| 504 Database::kDatabaseSequenceToken, | 502 Database::kDatabaseSequenceToken, |
| 505 FROM_HERE, | 503 FROM_HERE, |
| 506 base::Bind( | 504 base::Bind( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 AddEvent(util::CreateExtensionEvent(type, | 540 AddEvent(util::CreateExtensionEvent(type, |
| 543 base::Time::Now(), | 541 base::Time::Now(), |
| 544 extension->id(), | 542 extension->id(), |
| 545 extension->name(), | 543 extension->name(), |
| 546 extension->url().spec(), | 544 extension->url().spec(), |
| 547 extension->location(), | 545 extension->location(), |
| 548 extension->VersionString(), | 546 extension->VersionString(), |
| 549 extension->description())); | 547 extension->description())); |
| 550 } | 548 } |
| 551 | 549 |
| 552 void PerformanceMonitor::AddCrashEvent( | 550 void PerformanceMonitor::AddRendererClosedEvent( |
| 553 const content::RenderProcessHost::RendererClosedDetails& details) { | 551 const content::RenderProcessHost::RendererClosedDetails& details) { |
| 554 // We only care if this is an invalid termination. | 552 // We only care if this is an invalid termination. |
| 555 if (details.status == base::TERMINATION_STATUS_NORMAL_TERMINATION || | 553 if (details.status == base::TERMINATION_STATUS_NORMAL_TERMINATION || |
| 556 details.status == base::TERMINATION_STATUS_STILL_RUNNING) | 554 details.status == base::TERMINATION_STATUS_STILL_RUNNING) |
| 557 return; | 555 return; |
| 558 | 556 |
| 559 // Determine the type of crash. | 557 // Determine the type of crash. |
| 560 EventType type = | 558 EventType type = |
| 561 details.status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 559 details.status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
| 562 EVENT_KILLED_BY_OS_CRASH : EVENT_RENDERER_CRASH; | 560 EVENT_RENDERER_KILLED : EVENT_RENDERER_CRASH; |
| 563 | 561 |
| 564 AddEvent(util::CreateCrashEvent(base::Time::Now(), type)); | 562 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type)); |
| 565 } | 563 } |
| 566 | 564 |
| 567 } // namespace performance_monitor | 565 } // namespace performance_monitor |
| OLD | NEW |