// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_MAIN_RESOURCE_HANDLE_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_MAIN_RESOURCE_HANDLE_H_ #include "base/memory/weak_ptr.h" #include "content/browser/service_worker/service_worker_accessed_callback.h" #include "content/common/content_export.h" #include "services/network/public/mojom/network_context.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h" namespace content { class ScopedServiceWorkerClient; class ServiceWorkerClient; class ServiceWorkerContextWrapper; // The lifetime of the ServiceWorkerMainResourceHandle: // 1) We create a ServiceWorkerMainResourceHandle without populating the // member service worker client. // // 2) If we pre-create a ServiceWorkerClient for this navigation, it // is passed to `set_service_worker_client()`. // // 3) When the navigation is ready to commit, the NavigationRequest will // call ScopedServiceWorkerClient::CommitResponse() to // - complete the initialization for the ServiceWorkerClient. // - take out the container info to be sent as part of navigation commit // IPC. // // 4) When the navigation finishes, the ServiceWorkerMainResourceHandle is // destroyed. The destructor of the ServiceWorkerMainResourceHandle destroys // the ScopedServiceWorkerClient which in turn leads to the destruction of an // unclaimed ServiceWorkerClient. class CONTENT_EXPORT ServiceWorkerMainResourceHandle { … }; } // namespace content #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_MAIN_RESOURCE_HANDLE_H_