#include "net/spdy/spdy_stream.h"
#include <algorithm>
#include <limits>
#include <string_view>
#include <utility>
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "base/values.h"
#include "net/base/load_timing_info.h"
#include "net/http/http_status_code.h"
#include "net/log/net_log.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_event_type.h"
#include "net/spdy/spdy_buffer_producer.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_log_util.h"
#include "net/spdy/spdy_session.h"
namespace net {
namespace {
base::Value::Dict NetLogSpdyStreamErrorParams(spdy::SpdyStreamId stream_id,
int net_error,
std::string_view description) { … }
base::Value::Dict NetLogSpdyStreamWindowUpdateParams(
spdy::SpdyStreamId stream_id,
int32_t delta,
int32_t window_size) { … }
base::Value::Dict NetLogSpdyDataParams(spdy::SpdyStreamId stream_id,
int size,
bool fin) { … }
}
class SpdyStream::HeadersBufferProducer : public SpdyBufferProducer { … };
SpdyStream::SpdyStream(SpdyStreamType type,
const base::WeakPtr<SpdySession>& session,
const GURL& url,
RequestPriority priority,
int32_t initial_send_window_size,
int32_t max_recv_window_size,
const NetLogWithSource& net_log,
const NetworkTrafficAnnotationTag& traffic_annotation,
bool detect_broken_connection)
: … { … }
SpdyStream::~SpdyStream() { … }
void SpdyStream::SetDelegate(Delegate* delegate) { … }
std::unique_ptr<spdy::SpdySerializedFrame> SpdyStream::ProduceHeadersFrame() { … }
void SpdyStream::DetachDelegate() { … }
void SpdyStream::SetPriority(RequestPriority priority) { … }
bool SpdyStream::AdjustSendWindowSize(int32_t delta_window_size) { … }
void SpdyStream::OnWriteBufferConsumed(
size_t frame_payload_size,
size_t consume_size,
SpdyBuffer::ConsumeSource consume_source) { … }
void SpdyStream::IncreaseSendWindowSize(int32_t delta_window_size) { … }
void SpdyStream::DecreaseSendWindowSize(int32_t delta_window_size) { … }
void SpdyStream::OnReadBufferConsumed(
size_t consume_size,
SpdyBuffer::ConsumeSource consume_source) { … }
void SpdyStream::IncreaseRecvWindowSize(int32_t delta_window_size) { … }
void SpdyStream::DecreaseRecvWindowSize(int32_t delta_window_size) { … }
int SpdyStream::GetPeerAddress(IPEndPoint* address) const { … }
int SpdyStream::GetLocalAddress(IPEndPoint* address) const { … }
bool SpdyStream::WasEverUsed() const { … }
base::Time SpdyStream::GetRequestTime() const { … }
void SpdyStream::SetRequestTime(base::Time t) { … }
void SpdyStream::OnHeadersReceived(
const quiche::HttpHeaderBlock& response_headers,
base::Time response_time,
base::TimeTicks recv_first_byte_time) { … }
void SpdyStream::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) { … }
void SpdyStream::OnPaddingConsumed(size_t len) { … }
void SpdyStream::OnFrameWriteComplete(spdy::SpdyFrameType frame_type,
size_t frame_size) { … }
int SpdyStream::OnHeadersSent() { … }
int SpdyStream::OnDataSent(size_t frame_size) { … }
void SpdyStream::LogStreamError(int error, std::string_view description) { … }
void SpdyStream::OnClose(int status) { … }
void SpdyStream::Cancel(int error) { … }
void SpdyStream::Close() { … }
base::WeakPtr<SpdyStream> SpdyStream::GetWeakPtr() { … }
int SpdyStream::SendRequestHeaders(quiche::HttpHeaderBlock request_headers,
SpdySendStatus send_status) { … }
void SpdyStream::SendData(IOBuffer* data,
int length,
SpdySendStatus send_status) { … }
bool SpdyStream::GetSSLInfo(SSLInfo* ssl_info) const { … }
NextProto SpdyStream::GetNegotiatedProtocol() const { … }
SpdyStream::ShouldRequeueStream SpdyStream::PossiblyResumeIfSendStalled() { … }
bool SpdyStream::IsClosed() const { … }
bool SpdyStream::IsLocallyClosed() const { … }
bool SpdyStream::IsIdle() const { … }
bool SpdyStream::IsOpen() const { … }
bool SpdyStream::IsReservedRemote() const { … }
void SpdyStream::AddRawReceivedBytes(size_t received_bytes) { … }
void SpdyStream::AddRawSentBytes(size_t sent_bytes) { … }
bool SpdyStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { … }
void SpdyStream::QueueNextDataFrame() { … }
void SpdyStream::OnEarlyHintsReceived(
const quiche::HttpHeaderBlock& response_headers,
base::TimeTicks recv_first_byte_time) { … }
void SpdyStream::SaveResponseHeaders(
const quiche::HttpHeaderBlock& response_headers,
int status) { … }
#define STATE_CASE …
std::string SpdyStream::DescribeState(State state) { … }
#undef STATE_CASE
}