#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.h"
#include <stddef.h>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_request_headers.h"
#include "services/network/public/cpp/cors/cors.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
#include "third_party/blink/public/platform/web_network_state_notifier.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_response.h"
#include "third_party/blink/public/web/web_associated_url_loader.h"
#include "third_party/blink/renderer/platform/media/cache_util.h"
#include "third_party/blink/renderer/platform/media/resource_fetch_context.h"
#include "third_party/blink/renderer/platform/media/url_index.h"
namespace blink {
const int kLoaderFailedRetryDelayMs = …;
const int kAdditionalDelayPerRetryMs = …;
const int kLoaderPartialRetryDelayMs = …;
const int kHttpOK = …;
const int kHttpPartialContent = …;
const int kHttpRangeNotSatisfiable = …;
ResourceMultiBufferDataProvider::ResourceMultiBufferDataProvider(
UrlData* url_data,
MultiBufferBlockId pos,
bool is_client_audio_element,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
ResourceMultiBufferDataProvider::~ResourceMultiBufferDataProvider() = default;
void ResourceMultiBufferDataProvider::Start() { … }
MultiBufferBlockId ResourceMultiBufferDataProvider::Tell() const { … }
bool ResourceMultiBufferDataProvider::Available() const { … }
int64_t ResourceMultiBufferDataProvider::AvailableBytes() const { … }
scoped_refptr<media::DataBuffer> ResourceMultiBufferDataProvider::Read() { … }
void ResourceMultiBufferDataProvider::SetDeferred(bool deferred) { … }
bool ResourceMultiBufferDataProvider::WillFollowRedirect(
const WebURL& new_url,
const WebURLResponse& redirect_response) { … }
void ResourceMultiBufferDataProvider::DidSendData(
uint64_t bytes_sent,
uint64_t total_bytes_to_be_sent) { … }
void ResourceMultiBufferDataProvider::DidReceiveResponse(
const WebURLResponse& response) { … }
void ResourceMultiBufferDataProvider::DidReceiveData(const char* data,
int data_length) { … }
void ResourceMultiBufferDataProvider::DidDownloadData(uint64_t dataLength) { … }
void ResourceMultiBufferDataProvider::DidFinishLoading() { … }
void ResourceMultiBufferDataProvider::DidFail(const WebURLError& error) { … }
bool ResourceMultiBufferDataProvider::ParseContentRange(
const std::string& content_range_str,
int64_t* first_byte_position,
int64_t* last_byte_position,
int64_t* instance_size) { … }
void ResourceMultiBufferDataProvider::Terminate() { … }
int64_t ResourceMultiBufferDataProvider::byte_pos() const { … }
int64_t ResourceMultiBufferDataProvider::block_size() const { … }
bool ResourceMultiBufferDataProvider::VerifyPartialResponse(
const WebURLResponse& response,
const scoped_refptr<UrlData>& url_data) { … }
}