Commit 67859011 authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

service worker: Remove EmbeddedWorkerRegistry::Shutdown().

Part of an effort to remove EmbeddedWorkerRegistry which shouldn't be
needed since mojofication. Shutdown() sent a Stop IPC on each worker
when the registry is destructed, which happens only during browser
shutdown or a fatal error with the service worker system. The Stop IPC
is not needed since ServiceWorkerContext is also destroyed in this
case, which means all hosts are destroyed and the Mojo connection to the
workers are destroyed. The workers in the renderer processes
detect the destroyed connection and terminate.

I thought this might affect the ServiceWorker.WorkerStopped UMA,
but it shouldn't because the registry is refcounted and owned by
EmbeddedWorkerInstances, so it doesn't destruct until those are
already destructed, so no host is alive to record the UMA.

Bug: 931084
Change-Id: Id8c92f59e6602e7d95bf876858f4b771bed19636
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1504472Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637985}
parent aed534e9
...@@ -43,12 +43,6 @@ std::unique_ptr<EmbeddedWorkerInstance> EmbeddedWorkerRegistry::CreateWorker( ...@@ -43,12 +43,6 @@ std::unique_ptr<EmbeddedWorkerInstance> EmbeddedWorkerRegistry::CreateWorker(
return worker; return worker;
} }
void EmbeddedWorkerRegistry::Shutdown() {
for (auto it = worker_map_.begin(); it != worker_map_.end(); ++it) {
it->second->Stop();
}
}
bool EmbeddedWorkerRegistry::OnWorkerStarted(int process_id, bool EmbeddedWorkerRegistry::OnWorkerStarted(int process_id,
int embedded_worker_id) { int embedded_worker_id) {
if (!base::ContainsKey(worker_process_map_, process_id) || if (!base::ContainsKey(worker_process_map_, process_id) ||
...@@ -80,9 +74,7 @@ EmbeddedWorkerRegistry::EmbeddedWorkerRegistry( ...@@ -80,9 +74,7 @@ EmbeddedWorkerRegistry::EmbeddedWorkerRegistry(
initial_embedded_worker_id_(initial_embedded_worker_id) { initial_embedded_worker_id_(initial_embedded_worker_id) {
} }
EmbeddedWorkerRegistry::~EmbeddedWorkerRegistry() { EmbeddedWorkerRegistry::~EmbeddedWorkerRegistry() = default;
Shutdown();
}
void EmbeddedWorkerRegistry::BindWorkerToProcess(int process_id, void EmbeddedWorkerRegistry::BindWorkerToProcess(int process_id,
int embedded_worker_id) { int embedded_worker_id) {
......
...@@ -46,9 +46,6 @@ class CONTENT_EXPORT EmbeddedWorkerRegistry ...@@ -46,9 +46,6 @@ class CONTENT_EXPORT EmbeddedWorkerRegistry
std::unique_ptr<EmbeddedWorkerInstance> CreateWorker( std::unique_ptr<EmbeddedWorkerInstance> CreateWorker(
ServiceWorkerVersion* owner_version); ServiceWorkerVersion* owner_version);
// Stop all running workers, even if they're handling events.
void Shutdown();
// Called by EmbeddedWorkerInstance when it starts or stops. This registry // Called by EmbeddedWorkerInstance when it starts or stops. This registry
// keeps track of running workers. // keeps track of running workers.
bool OnWorkerStarted(int process_id, int embedded_worker_id); bool OnWorkerStarted(int process_id, int embedded_worker_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment