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

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 2958753003: Revert "Create ServiceWorkerProviderHost before starting worker" (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index c7fac32149dee12aa482657a72ffebe954546add..b47f556b5b51924ddf4fa340799cb22980e6c55d 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -201,21 +201,6 @@ void OnEventDispatcherConnectionError(
}
}
-mojom::ServiceWorkerProviderInfoForStartWorkerPtr
-CompleteProviderHostPreparation(
- ServiceWorkerVersion* version,
- std::unique_ptr<ServiceWorkerProviderHost> provider_host,
- base::WeakPtr<ServiceWorkerContextCore> context,
- int process_id) {
- // Caller should ensure |context| is alive when completing StartWorker
- // preparation.
- DCHECK(context);
- auto info =
- provider_host->CompleteStartWorkerPreparation(process_id, version);
- context->AddProviderHost(std::move(provider_host));
- return info;
-}
-
} // namespace
constexpr base::TimeDelta ServiceWorkerVersion::kTimeoutTimerDelay;
@@ -855,9 +840,6 @@ ServiceWorkerVersion::PendingRequest::~PendingRequest() {}
void ServiceWorkerVersion::OnThreadStarted() {
DCHECK_EQ(EmbeddedWorkerStatus::STARTING, running_status());
- DCHECK(provider_host_);
- provider_host_->SetReadyToSendMessagesToWorker(
- embedded_worker()->thread_id());
// Activate ping/pong now that JavaScript execution will start.
ping_controller_->Activate();
}
@@ -1476,10 +1458,6 @@ void ServiceWorkerVersion::StartWorkerInternal() {
StartTimeoutTimer();
- std::unique_ptr<ServiceWorkerProviderHost> pending_provider_host =
- ServiceWorkerProviderHost::PreCreateForController(context());
- provider_host_ = pending_provider_host->AsWeakPtr();
-
auto params = base::MakeUnique<EmbeddedWorkerStartParams>();
params->service_worker_version_id = version_id_;
params->scope = scope_;
@@ -1488,12 +1466,7 @@ void ServiceWorkerVersion::StartWorkerInternal() {
params->pause_after_download = pause_after_download_;
embedded_worker_->Start(
- std::move(params),
- // Unretained is used here because the callback will be owned by
- // |embedded_worker_| whose owner is |this|.
- base::BindOnce(&CompleteProviderHostPreparation, base::Unretained(this),
- base::Passed(&pending_provider_host), context()),
- mojo::MakeRequest(&event_dispatcher_),
+ std::move(params), mojo::MakeRequest(&event_dispatcher_),
base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated,
weak_factory_.GetWeakPtr()));
event_dispatcher_.set_connection_error_handler(base::Bind(

Powered by Google App Engine
This is Rietveld 408576698