#include "net/http/http_cache_writers.h"
#include <algorithm>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache_transaction.h"
#include "net/http/http_response_info.h"
#include "net/http/http_status_code.h"
#include "net/http/partial_data.h"
namespace net {
namespace {
bool IsValidResponseForWriter(bool is_partial,
const HttpResponseInfo* response_info) { … }
}
HttpCache::Writers::TransactionInfo::TransactionInfo(PartialData* partial_data,
const bool is_truncated,
HttpResponseInfo info)
: … { … }
HttpCache::Writers::TransactionInfo::~TransactionInfo() = default;
HttpCache::Writers::TransactionInfo::TransactionInfo(const TransactionInfo&) =
default;
HttpCache::Writers::Writers(HttpCache* cache,
scoped_refptr<HttpCache::ActiveEntry> entry)
: … { … }
HttpCache::Writers::~Writers() = default;
int HttpCache::Writers::Read(scoped_refptr<IOBuffer> buf,
int buf_len,
CompletionOnceCallback callback,
Transaction* transaction) { … }
bool HttpCache::Writers::StopCaching(bool keep_entry) { … }
void HttpCache::Writers::AddTransaction(
Transaction* transaction,
ParallelWritingPattern initial_writing_pattern,
RequestPriority priority,
const TransactionInfo& info) { … }
void HttpCache::Writers::SetNetworkTransaction(
Transaction* transaction,
std::unique_ptr<HttpTransaction> network_transaction) { … }
void HttpCache::Writers::ResetNetworkTransaction() { … }
void HttpCache::Writers::RemoveTransaction(Transaction* transaction,
bool success) { … }
void HttpCache::Writers::EraseTransaction(Transaction* transaction,
int result) { … }
HttpCache::Writers::TransactionMap::iterator
HttpCache::Writers::EraseTransaction(TransactionMap::iterator it, int result) { … }
void HttpCache::Writers::UpdatePriority() { … }
void HttpCache::Writers::CloseConnectionOnDestruction() { … }
bool HttpCache::Writers::ContainsOnlyIdleWriters() const { … }
bool HttpCache::Writers::CanAddWriters(ParallelWritingPattern* reason) { … }
void HttpCache::Writers::ProcessFailure(int error) { … }
void HttpCache::Writers::TruncateEntry() { … }
bool HttpCache::Writers::ShouldTruncate() { … }
LoadState HttpCache::Writers::GetLoadState() const { … }
HttpCache::Writers::WaitingForRead::WaitingForRead(
scoped_refptr<IOBuffer> buf,
int len,
CompletionOnceCallback consumer_callback)
: … { … }
HttpCache::Writers::WaitingForRead::~WaitingForRead() = default;
HttpCache::Writers::WaitingForRead::WaitingForRead(WaitingForRead&&) = default;
int HttpCache::Writers::DoLoop(int result) { … }
int HttpCache::Writers::DoNetworkRead() { … }
int HttpCache::Writers::DoNetworkReadComplete(int result) { … }
void HttpCache::Writers::OnNetworkReadFailure(int result) { … }
int HttpCache::Writers::DoCacheWriteData(int num_bytes) { … }
int HttpCache::Writers::DoCacheWriteDataComplete(int result) { … }
void HttpCache::Writers::OnDataReceived(int result) { … }
void HttpCache::Writers::OnCacheWriteFailure() { … }
void HttpCache::Writers::CompleteWaitingForReadTransactions(int result) { … }
void HttpCache::Writers::RemoveIdleWriters(int result) { … }
void HttpCache::Writers::SetCacheCallback(bool success,
const TransactionSet& make_readers) { … }
void HttpCache::Writers::OnIOComplete(int result) { … }
}