#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/loader/fetch/response_body_loader.h"
#include <algorithm>
#include <utility>
#include "base/auto_reset.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "services/network/public/cpp/features.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/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/back_forward_cache_loader_helper.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_context.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.h"
#include "third_party/blink/renderer/platform/wtf/deque.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink {
class ResponseBodyLoader::DelegatingBytesConsumer final
: public BytesConsumer,
public BytesConsumer::Client { … };
class ResponseBodyLoader::Buffer final
: public GarbageCollected<ResponseBodyLoader::Buffer> { … };
ResponseBodyLoader::ResponseBodyLoader(
BytesConsumer& bytes_consumer,
ResponseBodyLoaderClient& client,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
BackForwardCacheLoaderHelper* back_forward_cache_loader_helper)
: … { … }
mojo::ScopedDataPipeConsumerHandle ResponseBodyLoader::DrainAsDataPipe(
ResponseBodyLoaderClient** client) { … }
BytesConsumer& ResponseBodyLoader::DrainAsBytesConsumer() { … }
void ResponseBodyLoader::DidReceiveData(base::span<const char> data) { … }
void ResponseBodyLoader::DidReceiveDecodedData(
const String& data,
std::unique_ptr<ParkableStringImpl::SecureDigest> digest) { … }
void ResponseBodyLoader::DidFinishLoadingBody() { … }
void ResponseBodyLoader::DidFailLoadingBody() { … }
void ResponseBodyLoader::DidCancelLoadingBody() { … }
void ResponseBodyLoader::EvictFromBackForwardCache(
mojom::blink::RendererEvictionReason reason) { … }
void ResponseBodyLoader::DidBufferLoadWhileInBackForwardCache(
size_t num_bytes) { … }
void ResponseBodyLoader::Start() { … }
void ResponseBodyLoader::Abort() { … }
void ResponseBodyLoader::Suspend(LoaderFreezeMode mode) { … }
void ResponseBodyLoader::EvictFromBackForwardCacheIfDrainedAsBytesConsumer() { … }
void ResponseBodyLoader::Resume() { … }
void ResponseBodyLoader::OnStateChange() { … }
void ResponseBodyLoader::Trace(Visitor* visitor) const { … }
}