Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: net/http/bidirectional_stream_impl.h

Issue 1812823010: Rename net::BidirectionalStream*Job to net::BidirectionalStream*Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ 5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_
6 #define NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/socket/next_proto.h" 13 #include "net/socket/next_proto.h"
14 14
15 namespace base { 15 namespace base {
16 class Timer; 16 class Timer;
17 } // namespace base 17 } // namespace base
18 18
19 namespace net { 19 namespace net {
20 20
21 class BoundNetLog; 21 class BoundNetLog;
22 class IOBuffer; 22 class IOBuffer;
23 class SpdyHeaderBlock; 23 class SpdyHeaderBlock;
24 struct BidirectionalStreamRequestInfo; 24 struct BidirectionalStreamRequestInfo;
25 25
26 // Exposes an interface to do HTTP/2 bidirectional streaming. 26 // Exposes an interface to do HTTP/2 bidirectional streaming.
27 // Note that only one ReadData or SendData should be in flight until the 27 // Note that only one ReadData or SendData should be in flight until the
28 // operation completes synchronously or asynchronously. 28 // operation completes synchronously or asynchronously.
29 // BidirectionalStreamJob once created by HttpStreamFactoryImpl should be owned 29 // BidirectionalStreamImpl once created by HttpStreamFactoryImpl should be owned
30 // by BidirectionalStream. 30 // by BidirectionalStream.
31 class NET_EXPORT_PRIVATE BidirectionalStreamJob { 31 class NET_EXPORT_PRIVATE BidirectionalStreamImpl {
mef 2016/03/21 22:00:43 Maybe call it BidirectionalStreamBaseImpl as this
32 public: 32 public:
33 // Delegate to handle BidirectionalStreamJob events. 33 // Delegate to handle BidirectionalStreamImpl events.
34 class NET_EXPORT_PRIVATE Delegate { 34 class NET_EXPORT_PRIVATE Delegate {
35 public: 35 public:
36 Delegate(); 36 Delegate();
37 37
38 // Called when the request headers have been sent. 38 // Called when the request headers have been sent.
39 // The delegate may call BidirectionalStreamJob::ReadData to start reading, 39 // The delegate may call BidirectionalStreamImpl::ReadData to start reading,
40 // call BidirectionalStreamJob::SendData to send data, 40 // call BidirectionalStreamImpl::SendData to send data,
41 // or call BidirectionalStreamJob::Cancel to cancel the stream. 41 // or call BidirectionalStreamImpl::Cancel to cancel the stream.
42 // The delegate should not call BidirectionalStreamJob::Cancel 42 // The delegate should not call BidirectionalStreamImpl::Cancel
43 // during this callback. 43 // during this callback.
44 virtual void OnHeadersSent() = 0; 44 virtual void OnHeadersSent() = 0;
45 45
46 // Called when response headers are received. 46 // Called when response headers are received.
47 // This is called at most once for the lifetime of a stream. 47 // This is called at most once for the lifetime of a stream.
48 // The delegate may call BidirectionalStreamJob::ReadData to start 48 // The delegate may call BidirectionalStreamImpl::ReadData to start
49 // reading, call BidirectionalStreamJob::SendData to send data, 49 // reading, call BidirectionalStreamImpl::SendData to send data,
50 // or call BidirectionalStreamJob::Cancel to cancel the stream. 50 // or call BidirectionalStreamImpl::Cancel to cancel the stream.
51 virtual void OnHeadersReceived(const SpdyHeaderBlock& response_headers) = 0; 51 virtual void OnHeadersReceived(const SpdyHeaderBlock& response_headers) = 0;
52 52
53 // Called when read is completed asynchronously. |bytes_read| specifies how 53 // Called when read is completed asynchronously. |bytes_read| specifies how
54 // much data is available. 54 // much data is available.
55 // The delegate may call BidirectionalStreamJob::ReadData to continue 55 // The delegate may call BidirectionalStreamImpl::ReadData to continue
56 // reading, call BidirectionalStreamJob::SendData to send data, 56 // reading, call BidirectionalStreamImpl::SendData to send data,
57 // or call BidirectionalStreamJob::Cancel to cancel the stream. 57 // or call BidirectionalStreamImpl::Cancel to cancel the stream.
58 virtual void OnDataRead(int bytes_read) = 0; 58 virtual void OnDataRead(int bytes_read) = 0;
59 59
60 // Called when the entire buffer passed through SendData is sent. 60 // Called when the entire buffer passed through SendData is sent.
61 // The delegate may call BidirectionalStreamJob::ReadData to continue 61 // The delegate may call BidirectionalStreamImpl::ReadData to continue
62 // reading, or call BidirectionalStreamJob::SendData to send data. 62 // reading, or call BidirectionalStreamImpl::SendData to send data.
63 // The delegate should not call BidirectionalStreamJob::Cancel 63 // The delegate should not call BidirectionalStreamImpl::Cancel
64 // during this callback. 64 // during this callback.
65 virtual void OnDataSent() = 0; 65 virtual void OnDataSent() = 0;
66 66
67 // Called when trailers are received. This is called as soon as trailers 67 // Called when trailers are received. This is called as soon as trailers
68 // are received, which can happen before a read completes. 68 // are received, which can happen before a read completes.
69 // The delegate is able to continue reading if there is no pending read and 69 // The delegate is able to continue reading if there is no pending read and
70 // EOF has not been received, or to send data if there is no pending send. 70 // EOF has not been received, or to send data if there is no pending send.
71 virtual void OnTrailersReceived(const SpdyHeaderBlock& trailers) = 0; 71 virtual void OnTrailersReceived(const SpdyHeaderBlock& trailers) = 0;
72 72
73 // Called when an error occurred. 73 // Called when an error occurred.
74 // No other delegate functions will be called after this. 74 // No other delegate functions will be called after this.
75 virtual void OnFailed(int status) = 0; 75 virtual void OnFailed(int status) = 0;
76 76
77 protected: 77 protected:
78 virtual ~Delegate(); 78 virtual ~Delegate();
79 79
80 private: 80 private:
81 DISALLOW_COPY_AND_ASSIGN(Delegate); 81 DISALLOW_COPY_AND_ASSIGN(Delegate);
82 }; 82 };
83 83
84 BidirectionalStreamJob(); 84 BidirectionalStreamImpl();
85 85
86 // |this| should not be destroyed during Delegate::OnHeadersSent or 86 // |this| should not be destroyed during Delegate::OnHeadersSent or
87 // Delegate::OnDataSent. 87 // Delegate::OnDataSent.
88 virtual ~BidirectionalStreamJob(); 88 virtual ~BidirectionalStreamImpl();
89 89
90 // Starts the BidirectionalStreamJob and sends request headers. 90 // Starts the BidirectionalStreamImpl and sends request headers.
91 virtual void Start(const BidirectionalStreamRequestInfo* request_info, 91 virtual void Start(const BidirectionalStreamRequestInfo* request_info,
92 const BoundNetLog& net_log, 92 const BoundNetLog& net_log,
93 BidirectionalStreamJob::Delegate* delegate, 93 BidirectionalStreamImpl::Delegate* delegate,
94 scoped_ptr<base::Timer> timer) = 0; 94 scoped_ptr<base::Timer> timer) = 0;
95 95
96 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read, 96 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read,
97 // ERR_IO_PENDING if the read is to be completed asynchronously, or an error 97 // ERR_IO_PENDING if the read is to be completed asynchronously, or an error
98 // code if any error occurred. If returns 0, there is no more data to read. 98 // code if any error occurred. If returns 0, there is no more data to read.
99 // This should not be called before Delegate::OnHeadersReceived is invoked, 99 // This should not be called before Delegate::OnHeadersReceived is invoked,
100 // and should not be called again unless it returns with number greater than 100 // and should not be called again unless it returns with number greater than
101 // 0 or until Delegate::OnDataRead is invoked. 101 // 0 or until Delegate::OnDataRead is invoked.
102 virtual int ReadData(IOBuffer* buf, int buf_len) = 0; 102 virtual int ReadData(IOBuffer* buf, int buf_len) = 0;
103 103
(...skipping 16 matching lines...) Expand all
120 // frame headers, after SSL decryption and not including proxy overhead. 120 // frame headers, after SSL decryption and not including proxy overhead.
121 virtual int64_t GetTotalReceivedBytes() const = 0; 121 virtual int64_t GetTotalReceivedBytes() const = 0;
122 122
123 // Total number of bytes sent over the network of SPDY frames associated with 123 // Total number of bytes sent over the network of SPDY frames associated with
124 // this stream, including the size of frame headers, before SSL encryption and 124 // this stream, including the size of frame headers, before SSL encryption and
125 // not including proxy overhead. Note that some SPDY frames such as pings are 125 // not including proxy overhead. Note that some SPDY frames such as pings are
126 // not associated with any stream, and are not included in this value. 126 // not associated with any stream, and are not included in this value.
127 virtual int64_t GetTotalSentBytes() const = 0; 127 virtual int64_t GetTotalSentBytes() const = 0;
128 128
129 private: 129 private:
130 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamJob); 130 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl);
131 }; 131 };
132 132
133 } // namespace net 133 } // namespace net
134 134
135 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ 135 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698