Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/browser/extensions/api/processes/processes_api.cc

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Windows compile error. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // The tabs list only makes sense for render processes, so if we don't find 105 // The tabs list only makes sense for render processes, so if we don't find
106 // one, just return the empty list. 106 // one, just return the empty list.
107 content::RenderProcessHost* rph = 107 content::RenderProcessHost* rph =
108 content::RenderProcessHost::FromID(process_id); 108 content::RenderProcessHost::FromID(process_id);
109 if (rph == NULL) 109 if (rph == NULL)
110 return tabs_list; 110 return tabs_list;
111 111
112 int tab_id = -1; 112 int tab_id = -1;
113 // We need to loop through all the RVHs to ensure we collect the set of all 113 // We need to loop through all the RVHs to ensure we collect the set of all
114 // tabs using this renderer process. 114 // tabs using this renderer process.
115 content::RenderProcessHost::RenderWidgetHostsIterator iter( 115 content::RenderWidgetHost::List widgets =
116 rph->GetRenderWidgetHostsIterator()); 116 content::RenderWidgetHost::GetRenderWidgetHosts();
117 for (; !iter.IsAtEnd(); iter.Advance()) { 117 for (content::RenderWidgetHost::List::const_iterator it = widgets.begin();
jam 2013/06/12 19:59:59 ditto
nasko 2013/06/12 21:18:59 Done.
118 const content::RenderWidgetHost* widget = iter.GetCurrentValue(); 118 it != widgets.end(); ++it) {
119 DCHECK(widget); 119 const content::RenderWidgetHost* widget = *it;
120 if (!widget || !widget->IsRenderView()) 120 if (widget->GetProcess()->GetID() != process_id)
121 continue;
122 if (!widget->IsRenderView())
121 continue; 123 continue;
122 124
123 content::RenderViewHost* host = content::RenderViewHost::From( 125 content::RenderViewHost* host = content::RenderViewHost::From(
124 const_cast<content::RenderWidgetHost*>(widget)); 126 const_cast<content::RenderWidgetHost*>(widget));
125 content::WebContents* contents = 127 content::WebContents* contents =
126 content::WebContents::FromRenderViewHost(host); 128 content::WebContents::FromRenderViewHost(host);
127 if (contents) { 129 if (contents) {
128 tab_id = ExtensionTabUtil::GetTabId(contents); 130 tab_id = ExtensionTabUtil::GetTabId(contents);
129 if (tab_id != -1) 131 if (tab_id != -1)
130 tabs_list->Append(Value::CreateIntegerValue(tab_id)); 132 tabs_list->Append(Value::CreateIntegerValue(tab_id));
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 773
772 SetResult(processes); 774 SetResult(processes);
773 SendResponse(true); 775 SendResponse(true);
774 776
775 // Balance the AddRef in the RunImpl. 777 // Balance the AddRef in the RunImpl.
776 Release(); 778 Release();
777 #endif // defined(ENABLE_TASK_MANAGER) 779 #endif // defined(ENABLE_TASK_MANAGER)
778 } 780 }
779 781
780 } // namespace extensions 782 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698