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 content::RenderWidgetHost::List widgets = |
631 const content::RenderWidgetHost* widget = iter.GetCurrentValue(); | 628 content::RenderWidgetHost::GetRenderWidgetHosts(); |
632 DCHECK(widget); | 629 for (content::RenderWidgetHost::List::const_iterator it = widgets.begin(); |
633 if (!widget || !widget->IsRenderView()) | 630 it != widgets.end(); ++it) { |
jam
2013/06/12 19:59:59
ditto
nasko
2013/06/12 21:18:59
Done.
| |
631 const content::RenderWidgetHost* widget = *it; | |
632 if (widget->GetProcess()->GetID() != host->GetID()) | |
633 continue; | |
634 | |
635 if (!widget->IsRenderView()) | |
634 continue; | 636 continue; |
635 | 637 |
636 content::RenderViewHost* view = | 638 content::RenderViewHost* view = |
637 content::RenderViewHost::From( | 639 content::RenderViewHost::From( |
638 const_cast<content::RenderWidgetHost*>(widget)); | 640 const_cast<content::RenderWidgetHost*>(widget)); |
639 | 641 |
640 std::string url; | 642 std::string url; |
641 if (!MaybeGetURLFromRenderView(view, &url)) | 643 if (!MaybeGetURLFromRenderView(view, &url)) |
642 continue; | 644 continue; |
643 | 645 |
644 if (!url_list.empty()) | 646 if (!url_list.empty()) |
645 url_list += ", "; | 647 url_list += ", "; |
646 | 648 |
647 url_list += url; | 649 url_list += url; |
648 } | 650 } |
649 | 651 |
650 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); | 652 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); |
651 } | 653 } |
652 | 654 |
653 } // namespace performance_monitor | 655 } // namespace performance_monitor |
OLD | NEW |