Chromium Code Reviews| 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/extensions/api/processes/processes_api.h" | 5 #include "chrome/browser/extensions/api/processes/processes_api.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 return tabs_list; | 112 return tabs_list; |
| 113 | 113 |
| 114 int tab_id = -1; | 114 int tab_id = -1; |
| 115 // We need to loop through all the RVHs to ensure we collect the set of all | 115 // We need to loop through all the RVHs to ensure we collect the set of all |
| 116 // tabs using this renderer process. | 116 // tabs using this renderer process. |
| 117 scoped_ptr<content::RenderWidgetHostIterator> widgets( | 117 scoped_ptr<content::RenderWidgetHostIterator> widgets( |
| 118 content::RenderWidgetHost::GetRenderWidgetHosts()); | 118 content::RenderWidgetHost::GetRenderWidgetHosts()); |
| 119 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { | 119 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
| 120 if (widget->GetProcess()->GetID() != process_id) | 120 if (widget->GetProcess()->GetID() != process_id) |
| 121 continue; | 121 continue; |
| 122 if (!widget->IsRenderView()) | |
|
sky
2015/10/26 21:07:38
How come this is safe? If widget is not a RenderVi
Avi (use Gerrit)
2015/10/26 23:20:14
If widget isn't a RVH then the RenderViewHost* |ho
sky
2015/10/27 13:12:33
Ok, I missed that. I looked at the existing code w
| |
| 123 continue; | |
| 124 | 122 |
| 125 content::RenderViewHost* host = content::RenderViewHost::From(widget); | 123 content::RenderViewHost* host = content::RenderViewHost::From(widget); |
| 126 content::WebContents* contents = | 124 content::WebContents* contents = |
| 127 content::WebContents::FromRenderViewHost(host); | 125 content::WebContents::FromRenderViewHost(host); |
| 128 if (contents) { | 126 if (contents) { |
| 129 tab_id = ExtensionTabUtil::GetTabId(contents); | 127 tab_id = ExtensionTabUtil::GetTabId(contents); |
| 130 if (tab_id != -1) | 128 if (tab_id != -1) |
| 131 tabs_list->Append(new base::FundamentalValue(tab_id)); | 129 tabs_list->Append(new base::FundamentalValue(tab_id)); |
| 132 } | 130 } |
| 133 } | 131 } |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 | 770 |
| 773 SetResult(processes); | 771 SetResult(processes); |
| 774 SendResponse(true); | 772 SendResponse(true); |
| 775 | 773 |
| 776 // Balance the AddRef in the RunAsync. | 774 // Balance the AddRef in the RunAsync. |
| 777 Release(); | 775 Release(); |
| 778 #endif // defined(ENABLE_TASK_MANAGER) | 776 #endif // defined(ENABLE_TASK_MANAGER) |
| 779 } | 777 } |
| 780 | 778 |
| 781 } // namespace extensions | 779 } // namespace extensions |
| OLD | NEW |