chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client.h"

#include <iterator>

#include "base/containers/queue.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/system/data_pipe_drainer.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "services/network/public/mojom/early_hints.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/navigation/renderer_eviction_reason.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h"
#include "third_party/blink/renderer/platform/back_forward_cache_utils.h"
#include "third_party/blink/renderer/platform/loader/fetch/loader_freeze_mode.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/resource_request_sender.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"

namespace blink {
namespace {

constexpr base::TimeDelta kGracePeriodToFinishLoadingWhileInBackForwardCache =;

}  // namespace

class MojoURLLoaderClient::DeferredMessage {};

class MojoURLLoaderClient::DeferredOnReceiveResponse final
    : public DeferredMessage {};

class MojoURLLoaderClient::DeferredOnReceiveRedirect final
    : public DeferredMessage {};

class MojoURLLoaderClient::DeferredOnUploadProgress final
    : public DeferredMessage {};


class MojoURLLoaderClient::DeferredOnComplete final : public DeferredMessage {};

class MojoURLLoaderClient::BodyBuffer final
    : public mojo::DataPipeDrainer::Client {};

MojoURLLoaderClient::MojoURLLoaderClient(
    ResourceRequestSender* resource_request_sender,
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    bool bypass_redirect_checks,
    const GURL& request_url,
    base::OnceCallback<void(mojom::blink::RendererEvictionReason)>
        evict_from_bfcache_callback,
    base::RepeatingCallback<void(size_t)>
        did_buffer_load_while_in_bfcache_callback)
    :{}

MojoURLLoaderClient::~MojoURLLoaderClient() = default;

void MojoURLLoaderClient::Freeze(LoaderFreezeMode mode) {}

void MojoURLLoaderClient::OnReceiveEarlyHints(
    network::mojom::EarlyHintsPtr early_hints) {}

void MojoURLLoaderClient::OnReceiveResponse(
    network::mojom::URLResponseHeadPtr response_head,
    mojo::ScopedDataPipeConsumerHandle body,
    std::optional<mojo_base::BigBuffer> cached_metadata) {}

void MojoURLLoaderClient::EvictFromBackForwardCache(
    mojom::blink::RendererEvictionReason reason) {}

void MojoURLLoaderClient::DidBufferLoadWhileInBackForwardCache(
    size_t num_bytes) {}

bool MojoURLLoaderClient::CanContinueBufferingWhileInBackForwardCache() {}

void MojoURLLoaderClient::EvictFromBackForwardCacheDueToTimeout() {}

void MojoURLLoaderClient::StopBackForwardCacheEvictionTimer() {}

void MojoURLLoaderClient::OnReceiveRedirect(
    const net::RedirectInfo& redirect_info,
    network::mojom::URLResponseHeadPtr response_head) {}

void MojoURLLoaderClient::OnUploadProgress(
    int64_t current_position,
    int64_t total_size,
    OnUploadProgressCallback ack_callback) {}

void MojoURLLoaderClient::OnTransferSizeUpdated(int32_t transfer_size_diff) {}

void MojoURLLoaderClient::OnComplete(
    const network::URLLoaderCompletionStatus& status) {}

bool MojoURLLoaderClient::NeedsStoringMessage() const {}

void MojoURLLoaderClient::StoreAndDispatch(
    std::unique_ptr<DeferredMessage> message) {}

void MojoURLLoaderClient::OnConnectionClosed() {}

void MojoURLLoaderClient::FlushDeferredMessages() {}

}  // namespace blink