| Index: net/spdy/bidirectional_spdy_stream.h
|
| diff --git a/net/spdy/bidirectional_spdy_stream.h b/net/spdy/bidirectional_spdy_stream.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e325855b266a5b7c7a6fa2fbc1355875f51a5d79
|
| --- /dev/null
|
| +++ b/net/spdy/bidirectional_spdy_stream.h
|
| @@ -0,0 +1,84 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef NET_SPDY_BIDIRECTIONAL_SPDY_STREAM_H_
|
| +#define NET_SPDY_BIDIRECTIONAL_SPDY_STREAM_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "net/http/bidirectional_stream.h"
|
| +#include "net/http/http_request_info.h"
|
| +#include "net/spdy/spdy_read_queue.h"
|
| +#include "net/spdy/spdy_session.h"
|
| +#include "net/spdy/spdy_stream.h"
|
| +
|
| +namespace net {
|
| +
|
| +struct HttpRequestInfo;
|
| +class IOBuffer;
|
| +
|
| +class NET_EXPORT_PRIVATE BidirectionalSpdyStream : public BidirectionalStream,
|
| + public SpdyStream::Delegate {
|
| + public:
|
| + BidirectionalSpdyStream(const base::WeakPtr<SpdySession>& spdy_session);
|
| + ~BidirectionalSpdyStream() override;
|
| +
|
| + // BidirectionalStream implementation:
|
| +
|
| + void Start(const HttpRequestInfo* request_info,
|
| + RequestPriority priority,
|
| + const BoundNetLog& net_log,
|
| + BidirectionalStream::Delegate* delegate) override;
|
| +
|
| + int ReadData(IOBuffer* buf, int buf_len) override;
|
| +
|
| + void SendData(IOBuffer* data, int length, bool end_stream) override;
|
| +
|
| + // SpdyStream::Delegate implementation:
|
| +
|
| + void OnRequestHeadersSent() override;
|
| +
|
| + SpdyResponseHeadersStatus OnResponseHeadersUpdated(
|
| + const SpdyHeaderBlock& response_headers) override;
|
| +
|
| + void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override;
|
| +
|
| + void OnDataSent() override;
|
| +
|
| + void OnTrailers(const SpdyHeaderBlock& trailers) override;
|
| +
|
| + void OnClose(int status) override;
|
| +
|
| + private:
|
| + void SendRequestHeaders();
|
| + void OnStreamInitialized(int rv);
|
| + void ScheduleBufferedReadCallback();
|
| + void DoBufferedReadCallback();
|
| + bool ShouldWaitForMoreBufferedData() const;
|
| +
|
| + const base::WeakPtr<SpdySession> spdy_session_;
|
| + bool stream_closed_;
|
| + int closed_stream_status_;
|
| + bool buffered_read_callback_pending_;
|
| + bool more_read_data_pending_;
|
| +
|
| + const HttpRequestInfo* request_info_;
|
| + // Buffers the data as it arrives asynchronously from the stream.
|
| + SpdyReadQueue data_queue_;
|
| + // User provided buffer for ReadData() response.
|
| + scoped_refptr<IOBuffer> user_buffer_;
|
| + int user_buffer_len_;
|
| +
|
| + BidirectionalStream::Delegate* delegate_;
|
| + SpdyStreamRequest stream_request_;
|
| + base::WeakPtr<SpdyStream> stream_;
|
| +
|
| + base::WeakPtrFactory<BidirectionalSpdyStream> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BidirectionalSpdyStream);
|
| +};
|
| +
|
| +} // namespace net
|
| +
|
| +#endif // NET_SPDY_BIDIRECTIONAL_SPDY_STREAM_H_
|
|
|