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

Side by Side Diff: content/browser/worker_host/worker_service_impl.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 "content/browser/worker_host/worker_service_impl.h" 5 #include "content/browser/worker_host/worker_service_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 &WorkerPrioritySetter::GatherVisibleIDsAndUpdateWorkerPriorities, 103 &WorkerPrioritySetter::GatherVisibleIDsAndUpdateWorkerPriorities,
104 this)); 104 this));
105 } 105 }
106 106
107 void WorkerPrioritySetter::GatherVisibleIDsAndUpdateWorkerPriorities() { 107 void WorkerPrioritySetter::GatherVisibleIDsAndUpdateWorkerPriorities() {
108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
109 std::set<std::pair<int, int> >* visible_renderer_ids = 109 std::set<std::pair<int, int> >* visible_renderer_ids =
110 new std::set<std::pair<int, int> >(); 110 new std::set<std::pair<int, int> >();
111 111
112 // Gather up all the visible renderer process/view pairs 112 // Gather up all the visible renderer process/view pairs
113 for (RenderProcessHost::iterator it = 113 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts();
114 RenderProcessHost::AllHostsIterator(); 114 for (RenderWidgetHost::List::const_iterator it = widgets.begin();
jam 2013/06/12 19:59:59 since this is a vector, for (size_t i = 0; i < wi
nasko 2013/06/12 21:18:59 Done.
115 !it.IsAtEnd(); it.Advance()) { 115 it != widgets.end(); ++it) {
116 RenderProcessHost* render_process_host = it.GetCurrentValue(); 116 const RenderWidgetHost* widget = *it;
117 if (render_process_host->VisibleWidgetCount()) { 117 if (widget->GetProcess()->VisibleWidgetCount() == 0)
118 for (RenderProcessHost::RenderWidgetHostsIterator rit = 118 continue;
119 render_process_host->GetRenderWidgetHostsIterator(); !rit.IsAtEnd(); 119
120 rit.Advance()) { 120 RenderWidgetHostView* render_view = widget->GetView();
121 RenderWidgetHost* render_widget = 121 if (render_view && render_view->IsShowing()) {
122 render_process_host->GetRenderWidgetHostByID(rit.GetCurrentKey()); 122 visible_renderer_ids->insert(
123 if (render_widget) { 123 std::pair<int, int>(widget->GetProcess()->GetID(),
124 RenderWidgetHostView* render_view = render_widget->GetView(); 124 widget->GetRoutingID()));
125 if (render_view && render_view->IsShowing()) {
126 visible_renderer_ids->insert(
127 std::pair<int, int>(render_process_host->GetID(),
128 render_widget->GetRoutingID()));
129 }
130 }
131 }
132 } 125 }
133 } 126 }
134 127
135 BrowserThread::PostTask( 128 BrowserThread::PostTask(
136 BrowserThread::IO, FROM_HERE, 129 BrowserThread::IO, FROM_HERE,
137 base::Bind(&WorkerPrioritySetter::UpdateWorkerPrioritiesFromVisibleSet, 130 base::Bind(&WorkerPrioritySetter::UpdateWorkerPrioritiesFromVisibleSet,
138 this, base::Owned(visible_renderer_ids))); 131 this, base::Owned(visible_renderer_ids)));
139 } 132 }
140 133
141 void WorkerPrioritySetter::UpdateWorkerPrioritiesFromVisibleSet( 134 void WorkerPrioritySetter::UpdateWorkerPrioritiesFromVisibleSet(
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 return instance; 718 return instance;
726 719
727 // No existing pending worker - create a new one. 720 // No existing pending worker - create a new one.
728 WorkerProcessHost::WorkerInstance pending( 721 WorkerProcessHost::WorkerInstance pending(
729 url, true, name, resource_context, partition); 722 url, true, name, resource_context, partition);
730 pending_shared_workers_.push_back(pending); 723 pending_shared_workers_.push_back(pending);
731 return &pending_shared_workers_.back(); 724 return &pending_shared_workers_.back();
732 } 725 }
733 726
734 } // namespace content 727 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698