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

Side by Side Diff: chrome/browser/worker_host/worker_process_host.cc

Issue 580007: Changed CreateWorker to coalesce any matching queued shared workers when a (Closed)
Patch Set: Now supports multiple queued instances of one shared worker. Created 10 years, 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/worker_host/worker_process_host.h" 5 #include "chrome/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL( 163 ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL(
164 id(), instance.url()); 164 id(), instance.url());
165 165
166 instances_.push_back(instance); 166 instances_.push_back(instance);
167 Send(new WorkerProcessMsg_CreateWorker(instance.url(), 167 Send(new WorkerProcessMsg_CreateWorker(instance.url(),
168 instance.shared(), 168 instance.shared(),
169 instance.name(), 169 instance.name(),
170 instance.worker_route_id())); 170 instance.worker_route_id()));
171 171
172 UpdateTitle(); 172 UpdateTitle();
173 WorkerInstance::SenderInfo info = instances_.back().GetSender(); 173
174 info.first->Send(new ViewMsg_WorkerCreated(info.second)); 174 // Walk all pending senders and let them know the worker has been created
175 // (could be more than one in the case where we had to queue up worker
176 // creation because the worker process limit was reached).
177 for (WorkerInstance::SenderList::const_iterator i =
178 instance.senders().begin();
179 i != instance.senders().end(); ++i) {
180 i->first->Send(new ViewMsg_WorkerCreated(i->second));
181 }
175 } 182 }
176 183
177 bool WorkerProcessHost::FilterMessage(const IPC::Message& message, 184 bool WorkerProcessHost::FilterMessage(const IPC::Message& message,
178 IPC::Message::Sender* sender) { 185 IPC::Message::Sender* sender) {
179 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { 186 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) {
180 if (!i->closed() && i->HasSender(sender, message.routing_id())) { 187 if (!i->closed() && i->HasSender(sender, message.routing_id())) {
181 RelayMessage( 188 RelayMessage(
182 message, this, i->worker_route_id(), next_route_id_callback_.get()); 189 message, this, i->worker_route_id(), next_route_id_callback_.get());
183 return true; 190 return true;
184 } 191 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 544 }
538 } 545 }
539 return false; 546 return false;
540 } 547 }
541 548
542 WorkerProcessHost::WorkerInstance::SenderInfo 549 WorkerProcessHost::WorkerInstance::SenderInfo
543 WorkerProcessHost::WorkerInstance::GetSender() const { 550 WorkerProcessHost::WorkerInstance::GetSender() const {
544 DCHECK(NumSenders() == 1); 551 DCHECK(NumSenders() == 1);
545 return *senders_.begin(); 552 return *senders_.begin();
546 } 553 }
OLDNEW
« no previous file with comments | « chrome/browser/worker_host/worker_process_host.h ('k') | chrome/browser/worker_host/worker_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698