| OLD | NEW |
| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 432 } |
| 433 if (shutdown) { | 433 if (shutdown) { |
| 434 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id())); | 434 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id())); |
| 435 i = instances_.erase(i); | 435 i = instances_.erase(i); |
| 436 } else { | 436 } else { |
| 437 ++i; | 437 ++i; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 bool WorkerProcessHost::CanShutdown() { |
| 443 return instances_.empty(); |
| 444 } |
| 445 |
| 442 void WorkerProcessHost::UpdateTitle() { | 446 void WorkerProcessHost::UpdateTitle() { |
| 443 std::set<std::string> titles; | 447 std::set<std::string> titles; |
| 444 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { | 448 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { |
| 445 std::string title = | 449 std::string title = |
| 446 net::RegistryControlledDomainService::GetDomainAndRegistry(i->url()); | 450 net::RegistryControlledDomainService::GetDomainAndRegistry(i->url()); |
| 447 // Use the host name if the domain is empty, i.e. localhost or IP address. | 451 // Use the host name if the domain is empty, i.e. localhost or IP address. |
| 448 if (title.empty()) | 452 if (title.empty()) |
| 449 title = i->url().host(); | 453 title = i->url().host(); |
| 450 | 454 |
| 451 // Check if it's an extension-created worker, in which case we want to use | 455 // Check if it's an extension-created worker, in which case we want to use |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 688 } |
| 685 } | 689 } |
| 686 return false; | 690 return false; |
| 687 } | 691 } |
| 688 | 692 |
| 689 WorkerProcessHost::WorkerInstance::SenderInfo | 693 WorkerProcessHost::WorkerInstance::SenderInfo |
| 690 WorkerProcessHost::WorkerInstance::GetSender() const { | 694 WorkerProcessHost::WorkerInstance::GetSender() const { |
| 691 DCHECK(NumSenders() == 1); | 695 DCHECK(NumSenders() == 1); |
| 692 return *senders_.begin(); | 696 return *senders_.begin(); |
| 693 } | 697 } |
| OLD | NEW |