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