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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 // We only care if this is an invalid termination. | 613 // We only care if this is an invalid termination. |
614 if (details.status == base::TERMINATION_STATUS_NORMAL_TERMINATION || | 614 if (details.status == base::TERMINATION_STATUS_NORMAL_TERMINATION || |
615 details.status == base::TERMINATION_STATUS_STILL_RUNNING) | 615 details.status == base::TERMINATION_STATUS_STILL_RUNNING) |
616 return; | 616 return; |
617 | 617 |
618 // Determine the type of crash. | 618 // Determine the type of crash. |
619 EventType type = | 619 EventType type = |
620 details.status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 620 details.status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
621 EVENT_RENDERER_KILLED : EVENT_RENDERER_CRASH; | 621 EVENT_RENDERER_KILLED : EVENT_RENDERER_CRASH; |
622 | 622 |
623 content::RenderProcessHost::RenderWidgetHostsIterator iter = | |
624 host->GetRenderWidgetHostsIterator(); | |
625 | |
626 // A RenderProcessHost may contain multiple render views - for each valid | 623 // A RenderProcessHost may contain multiple render views - for each valid |
627 // render view, extract the url, and append it to the string, comma-separating | 624 // render view, extract the url, and append it to the string, comma-separating |
628 // the entries. | 625 // the entries. |
629 std::string url_list; | 626 std::string url_list; |
630 for (; !iter.IsAtEnd(); iter.Advance()) { | 627 |
631 const content::RenderWidgetHost* widget = iter.GetCurrentValue(); | 628 scoped_ptr<content::RenderWidgetHost::List> hosts = |
632 DCHECK(widget); | 629 content::RenderWidgetHost::GetRenderWidgetHosts(); |
633 if (!widget || !widget->IsRenderView()) | 630 for (content::RenderWidgetHost::List::const_iterator it = hosts->begin(); |
| 631 it != hosts->end(); |
| 632 ++it) { |
| 633 const content::RenderWidgetHost* widget = *it; |
| 634 if (widget->GetProcess()->GetID() != host->GetID()) |
| 635 continue; |
| 636 |
| 637 if (!widget->IsRenderView()) |
634 continue; | 638 continue; |
635 | 639 |
636 content::RenderViewHost* view = | 640 content::RenderViewHost* view = |
637 content::RenderViewHost::From( | 641 content::RenderViewHost::From( |
638 const_cast<content::RenderWidgetHost*>(widget)); | 642 const_cast<content::RenderWidgetHost*>(widget)); |
639 | 643 |
640 std::string url; | 644 std::string url; |
641 if (!MaybeGetURLFromRenderView(view, &url)) | 645 if (!MaybeGetURLFromRenderView(view, &url)) |
642 continue; | 646 continue; |
643 | 647 |
644 if (!url_list.empty()) | 648 if (!url_list.empty()) |
645 url_list += ", "; | 649 url_list += ", "; |
646 | 650 |
647 url_list += url; | 651 url_list += url; |
648 } | 652 } |
649 | 653 |
650 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); | 654 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); |
651 } | 655 } |
652 | 656 |
653 } // namespace performance_monitor | 657 } // namespace performance_monitor |
OLD | NEW |