#include "content/common/service_worker/race_network_request_url_loader_client.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "content/common/features.h"
#include "content/common/service_worker/service_worker_resource_loader.h"
#include "content/public/common/content_features.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/cpp/system/handle_signals_state.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/header_util.h"
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
namespace content {
namespace {
const char kMainResourceHistogramLoadTiming[] = …;
const char kSubresourceHistogramLoadTiming[] = …;
}
ServiceWorkerRaceNetworkRequestURLLoaderClient::
ServiceWorkerRaceNetworkRequestURLLoaderClient(
const network::ResourceRequest& request,
base::WeakPtr<ServiceWorkerResourceLoader> owner,
mojo::PendingRemote<network::mojom::URLLoaderClient> forwarding_client)
: … { … }
ServiceWorkerRaceNetworkRequestURLLoaderClient::
~ServiceWorkerRaceNetworkRequestURLLoaderClient() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnUploadProgress(
int64_t current_position,
int64_t total_size,
OnUploadProgressCallback ack_callback) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnTransferSizeUpdated(
int32_t transfer_size_diff) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnReceiveResponse(
network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body,
std::optional<mojo_base::BigBuffer> cached_metadata) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnReceiveRedirect(
const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnComplete(
const network::URLLoaderCompletionStatus& status) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::Bind(
mojo::PendingRemote<network::mojom::URLLoaderClient>* remote) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::CommitResponse() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::MaybeCommitResponse() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::MaybeCompleteResponse() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::CompleteResponse() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::
CommitAndCompleteResponseIfDataTransferFinished() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::OnDataTransferComplete() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::WatchDataUpdate() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::Read(
MojoResult result,
const mojo::HandleSignalsState& state) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::TwoPhaseWrite(
MojoResult result,
const mojo::HandleSignalsState& state) { … }
bool ServiceWorkerRaceNetworkRequestURLLoaderClient::IsReadyToHandleReadWrite(
MojoResult result) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::RecordMojoResultForWrite(
MojoResult result) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::CompleteReadData(
uint32_t num_bytes_to_consume) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::Abort() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::SetFetchHandlerEndTiming(
base::TimeTicks fetch_handler_end_time,
bool is_fallback) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::
MaybeRecordResponseReceivedToFetchHandlerEndTiming() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::
MaybeRecordResponseReceivedToFetchHandlerEndTiming(
base::TimeTicks fetch_handler_end_time,
bool is_fallback) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::
RecordResponseReceivedToFetchHandlerEndTiming() { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::
RecordMojoResultForDataTransfer(MojoResult result,
const std::string& suffix) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::TransitionState(
State new_state) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::DrainData(
mojo::ScopedDataPipeConsumerHandle source) { … }
void ServiceWorkerRaceNetworkRequestURLLoaderClient::CancelWriteData(
FetchResponseFrom commit_responsibility) { … }
ServiceWorkerRaceNetworkRequestURLLoaderClient::MojoResultForUMA
ServiceWorkerRaceNetworkRequestURLLoaderClient::ConvertMojoResultForUMA(
MojoResult mojo_result) { … }
net::NetworkTrafficAnnotationTag
ServiceWorkerRaceNetworkRequestURLLoaderClient::NetworkTrafficAnnotationTag() { … }
}