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

Side by Side Diff: net/quic/chromium/bidirectional_stream_quic_impl.h

Issue 2334943002: Add a new QuicChromiumClientSession::Handle class (Closed)
Patch Set: Not copyable Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 5 #ifndef NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
6 #define NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 6 #define NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 12 matching lines...) Expand all
23 class Timer; 23 class Timer;
24 } // namespace base 24 } // namespace base
25 25
26 namespace net { 26 namespace net {
27 27
28 struct BidirectionalStreamRequestInfo; 28 struct BidirectionalStreamRequestInfo;
29 class IOBuffer; 29 class IOBuffer;
30 30
31 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl 31 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl
32 : public BidirectionalStreamImpl, 32 : public BidirectionalStreamImpl,
33 public QuicChromiumClientStream::Delegate, 33 public QuicChromiumClientStream::Delegate {
34 public QuicChromiumClientSession::Observer {
35 public: 34 public:
36 explicit BidirectionalStreamQuicImpl( 35 explicit BidirectionalStreamQuicImpl(
37 const base::WeakPtr<QuicChromiumClientSession>& session); 36 std::unique_ptr<QuicChromiumClientSession::Handle> session);
38 37
39 ~BidirectionalStreamQuicImpl() override; 38 ~BidirectionalStreamQuicImpl() override;
40 39
41 // BidirectionalStreamImpl implementation: 40 // BidirectionalStreamImpl implementation:
42 void Start(const BidirectionalStreamRequestInfo* request_info, 41 void Start(const BidirectionalStreamRequestInfo* request_info,
43 const NetLogWithSource& net_log, 42 const NetLogWithSource& net_log,
44 bool send_request_headers_automatically, 43 bool send_request_headers_automatically,
45 BidirectionalStreamImpl::Delegate* delegate, 44 BidirectionalStreamImpl::Delegate* delegate,
46 std::unique_ptr<base::Timer> timer) override; 45 std::unique_ptr<base::Timer> timer) override;
47 void SendRequestHeaders() override; 46 void SendRequestHeaders() override;
(...skipping 10 matching lines...) Expand all
58 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; 57 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
59 58
60 private: 59 private:
61 // QuicChromiumClientStream::Delegate implementation: 60 // QuicChromiumClientStream::Delegate implementation:
62 void OnHeadersAvailable(const SpdyHeaderBlock& headers, 61 void OnHeadersAvailable(const SpdyHeaderBlock& headers,
63 size_t frame_len) override; 62 size_t frame_len) override;
64 void OnDataAvailable() override; 63 void OnDataAvailable() override;
65 void OnClose() override; 64 void OnClose() override;
66 void OnError(int error) override; 65 void OnError(int error) override;
67 66
68 // QuicChromiumClientSession::Observer implementation:
69 void OnCryptoHandshakeConfirmed() override;
70 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override;
71 void OnSessionClosed(int error, bool port_migration_detected) override;
72
73 void OnStreamReady(int rv); 67 void OnStreamReady(int rv);
74 void OnSendDataComplete(int rv); 68 void OnSendDataComplete(int rv);
75 void OnReadDataComplete(int rv); 69 void OnReadDataComplete(int rv);
76 70
77 // Notifies the delegate of an error. 71 // Notifies the delegate of an error.
78 void NotifyError(int error); 72 void NotifyError(int error);
79 // Notifies the delegate that the stream is ready. 73 // Notifies the delegate that the stream is ready.
80 void NotifyStreamReady(); 74 void NotifyStreamReady();
81 // Resets the stream and ensures that |delegate_| won't be called back. 75 // Resets the stream and ensures that |delegate_| won't be called back.
82 void ResetStream(); 76 void ResetStream();
83 77
84 base::WeakPtr<QuicChromiumClientSession> session_; 78 std::unique_ptr<QuicChromiumClientSession::Handle> session_;
xunjieli 2017/05/05 14:10:01 I guess this can be "const std::unique_ptr<>" ?
Ryan Hamilton 2017/05/05 17:32:47 Done. (I don't think I've ever seen a const std::u
xunjieli 2017/05/05 17:52:13 https://cs.chromium.org/search/?q=const+std::uniqu
Ryan Hamilton 2017/05/05 18:27:38 Learn something new every day! :) Though I think
85 bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
86 std::unique_ptr<QuicChromiumClientSession::StreamRequest> stream_request_;
87 QuicChromiumClientStream* stream_; // Non-owning. 79 QuicChromiumClientStream* stream_; // Non-owning.
88 80
89 const BidirectionalStreamRequestInfo* request_info_; 81 const BidirectionalStreamRequestInfo* request_info_;
90 BidirectionalStreamImpl::Delegate* delegate_; 82 BidirectionalStreamImpl::Delegate* delegate_;
91 // Saves the response status if the stream is explicitly closed via OnError 83 // Saves the response status if the stream is explicitly closed via OnError
92 // or OnClose with an error. Once all buffered data has been returned, this 84 // or OnClose with an error. Once all buffered data has been returned, this
93 // will be used as the final response. 85 // will be used as the final response.
94 int response_status_; 86 int response_status_;
95 87
96 // The protocol that is negotiated. 88 // The protocol that is negotiated.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bool send_request_headers_automatically_; 121 bool send_request_headers_automatically_;
130 122
131 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; 123 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_;
132 124
133 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); 125 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl);
134 }; 126 };
135 127
136 } // namespace net 128 } // namespace net
137 129
138 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ 130 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/chromium/bidirectional_stream_quic_impl.cc » ('j') | net/quic/chromium/quic_chromium_client_session.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698