// Copyright 2017 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_INSTALLED_SCRIPTS_SENDER_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INSTALLED_SCRIPTS_SENDER_H_ #include "base/containers/queue.h" #include "base/functional/callback_forward.h" #include "base/memory/raw_ptr.h" #include "content/browser/service_worker/service_worker_installed_script_reader.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/system/data_pipe.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom.h" namespace content { class ServiceWorkerVersion; // ServiceWorkerInstalledScriptsSender serves the service worker's installed // scripts from ServiceWorkerStorage to the renderer through Mojo data pipes. // ServiceWorkerInstalledScriptsSender is owned by ServiceWorkerVersion. It is // created for worker startup and lives as long as the worker is running. // // SWInstalledScriptsSender has three phases. // 1. The sender sends all installed scripts to the renderer without any // requests from the renderer. This initial phase is called "streaming". // |state_| is kSendingScripts. When all installed scripts are sent, moves to // the phase 2. // 2. The sender is idle. |state_| is kIdle. If the renderer calls // RequestInstalledScript, moves to the phase 3. // 3. The sender sends requested scripts. |state_| is kSendingScripts. When all // the requested scripts are sent, returns to the phase 2. class CONTENT_EXPORT ServiceWorkerInstalledScriptsSender : public blink::mojom::ServiceWorkerInstalledScriptsManagerHost, public ServiceWorkerInstalledScriptReader::Client { … }; } // namespace content #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_INSTALLED_SCRIPTS_SENDER_H_