#include "content/browser/devtools/service_worker_devtools_manager.h"
#include <optional>
#include "base/containers/contains.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "content/browser/devtools/devtools_instrumentation.h"
#include "content/browser/devtools/protocol/network_handler.h"
#include "content/browser/devtools/protocol/page_handler.h"
#include "content/browser/devtools/service_worker_devtools_agent_host.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "ipc/ipc_listener.h"
#include "services/network/public/cpp/devtools_observer_util.h"
#include "services/network/public/mojom/devtools_observer.mojom.h"
namespace content {
ServiceWorkerDevToolsManager* ServiceWorkerDevToolsManager::GetInstance() { … }
ServiceWorkerDevToolsAgentHost*
ServiceWorkerDevToolsManager::GetDevToolsAgentHostForWorker(
int worker_process_id,
int worker_route_id) { … }
ServiceWorkerDevToolsAgentHost*
ServiceWorkerDevToolsManager::GetDevToolsAgentHostForNewInstallingWorker(
const ServiceWorkerContextWrapper* context_wrapper,
int64_t version_id) { … }
void ServiceWorkerDevToolsManager::AddAllAgentHosts(
ServiceWorkerDevToolsAgentHost::List* result) { … }
void ServiceWorkerDevToolsManager::AddAllAgentHostsForBrowserContext(
BrowserContext* browser_context,
ServiceWorkerDevToolsAgentHost::List* result) { … }
void ServiceWorkerDevToolsManager::WorkerMainScriptFetchingStarting(
scoped_refptr<ServiceWorkerContextWrapper> context_wrapper,
int64_t version_id,
const GURL& url,
const GURL& scope,
const GlobalRenderFrameHostId& requesting_frame_id,
scoped_refptr<DevToolsThrottleHandle> throttle_handle) { … }
void ServiceWorkerDevToolsManager::WorkerMainScriptFetchingFailed(
scoped_refptr<ServiceWorkerContextWrapper> context_wrapper,
int64_t version_id) { … }
void ServiceWorkerDevToolsManager::WorkerStarting(
int worker_process_id,
int worker_route_id,
scoped_refptr<ServiceWorkerContextWrapper> context_wrapper,
int64_t version_id,
const GURL& url,
const GURL& scope,
bool is_installed_version,
network::mojom::ClientSecurityStatePtr client_security_state,
mojo::PendingRemote<network::mojom::CrossOriginEmbedderPolicyReporter>
coep_reporter,
base::UnguessableToken* devtools_worker_token,
bool* pause_on_start) { … }
void ServiceWorkerDevToolsManager::WorkerReadyForInspection(
int worker_process_id,
int worker_route_id,
mojo::PendingRemote<blink::mojom::DevToolsAgent> agent_remote,
mojo::PendingReceiver<blink::mojom::DevToolsAgentHost> host_receiver) { … }
void ServiceWorkerDevToolsManager::WorkerVersionInstalled(int worker_process_id,
int worker_route_id) { … }
void ServiceWorkerDevToolsManager::WorkerVersionDoomed(
int worker_process_id,
int worker_route_id,
scoped_refptr<ServiceWorkerContextWrapper> context_wrapper,
int64_t version_id) { … }
void ServiceWorkerDevToolsManager::WorkerStopped(int worker_process_id,
int worker_route_id) { … }
void ServiceWorkerDevToolsManager::AgentHostDestroyed(
ServiceWorkerDevToolsAgentHost* agent_host) { … }
void ServiceWorkerDevToolsManager::AddObserver(Observer* observer) { … }
void ServiceWorkerDevToolsManager::RemoveObserver(Observer* observer) { … }
void ServiceWorkerDevToolsManager::set_debug_service_worker_on_start(
bool debug_on_start) { … }
ServiceWorkerDevToolsManager::ServiceWorkerDevToolsManager()
: … { … }
ServiceWorkerDevToolsManager::~ServiceWorkerDevToolsManager() = default;
void ServiceWorkerDevToolsManager::NavigationPreloadRequestSent(
int worker_process_id,
int worker_route_id,
const std::string& request_id,
const network::ResourceRequest& request) { … }
void ServiceWorkerDevToolsManager::NavigationPreloadResponseReceived(
int worker_process_id,
int worker_route_id,
const std::string& request_id,
const GURL& url,
const network::mojom::URLResponseHead& head) { … }
void ServiceWorkerDevToolsManager::NavigationPreloadCompleted(
int worker_process_id,
int worker_route_id,
const std::string& request_id,
const network::URLLoaderCompletionStatus& status) { … }
scoped_refptr<ServiceWorkerDevToolsAgentHost>
ServiceWorkerDevToolsManager::TakeStoppedHost(
const ServiceWorkerContextWrapper* context_wrapper,
int64_t version_id) { … }
scoped_refptr<ServiceWorkerDevToolsAgentHost>
ServiceWorkerDevToolsManager::TakeNewInstallingHost(
const ServiceWorkerContextWrapper* context_wrapper,
int64_t version_id) { … }
}