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

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

Issue 2043863002: Use WeakPtrFactory in net::BidirectionalStream when posting task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Matt's comments Created 4 years, 6 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
« no previous file with comments | « no previous file | net/http/bidirectional_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef NET_HTTP_BIDIRECTIONAL_STREAM_H_
6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_ 6 #define NET_HTTP_BIDIRECTIONAL_STREAM_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h"
15 #include "net/http/bidirectional_stream_impl.h" 16 #include "net/http/bidirectional_stream_impl.h"
16 #include "net/http/http_stream_factory.h" 17 #include "net/http/http_stream_factory.h"
17 #include "net/log/net_log.h" 18 #include "net/log/net_log.h"
18 19
19 class GURL; 20 class GURL;
20 21
21 namespace net { 22 namespace net {
22 23
23 class HttpAuthController; 24 class HttpAuthController;
24 class HttpNetworkSession; 25 class HttpNetworkSession;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 const ProxyInfo& used_proxy_info, 210 const ProxyInfo& used_proxy_info,
210 HttpAuthController* auth_controller) override; 211 HttpAuthController* auth_controller) override;
211 void OnNeedsClientAuth(const SSLConfig& used_ssl_config, 212 void OnNeedsClientAuth(const SSLConfig& used_ssl_config,
212 SSLCertRequestInfo* cert_info) override; 213 SSLCertRequestInfo* cert_info) override;
213 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, 214 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
214 const SSLConfig& used_ssl_config, 215 const SSLConfig& used_ssl_config,
215 const ProxyInfo& used_proxy_info, 216 const ProxyInfo& used_proxy_info,
216 HttpStream* stream) override; 217 HttpStream* stream) override;
217 void OnQuicBroken() override; 218 void OnQuicBroken() override;
218 219
220 // Helper method to notify delegate if there is an error.
221 void NotifyFailed(int error);
222
219 // BidirectionalStreamRequestInfo used when requesting the stream. 223 // BidirectionalStreamRequestInfo used when requesting the stream.
220 std::unique_ptr<BidirectionalStreamRequestInfo> request_info_; 224 std::unique_ptr<BidirectionalStreamRequestInfo> request_info_;
221 const BoundNetLog net_log_; 225 const BoundNetLog net_log_;
222 226
223 HttpNetworkSession* session_; 227 HttpNetworkSession* session_;
224 228
225 bool send_request_headers_automatically_; 229 bool send_request_headers_automatically_;
226 // Whether request headers have been sent, as indicated in OnStreamReady() 230 // Whether request headers have been sent, as indicated in OnStreamReady()
227 // callback. 231 // callback.
228 bool request_headers_sent_; 232 bool request_headers_sent_;
(...skipping 10 matching lines...) Expand all
239 // non-NULL, if the |stream_request_| successfully finishes. 243 // non-NULL, if the |stream_request_| successfully finishes.
240 std::unique_ptr<BidirectionalStreamImpl> stream_impl_; 244 std::unique_ptr<BidirectionalStreamImpl> stream_impl_;
241 245
242 // Buffer used for reading. 246 // Buffer used for reading.
243 scoped_refptr<IOBuffer> read_buffer_; 247 scoped_refptr<IOBuffer> read_buffer_;
244 // List of buffers used for writing. 248 // List of buffers used for writing.
245 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_; 249 std::vector<scoped_refptr<IOBuffer>> write_buffer_list_;
246 // List of buffer length. 250 // List of buffer length.
247 std::vector<int> write_buffer_len_list_; 251 std::vector<int> write_buffer_len_list_;
248 252
253 base::WeakPtrFactory<BidirectionalStream> weak_factory_;
254
249 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); 255 DISALLOW_COPY_AND_ASSIGN(BidirectionalStream);
250 }; 256 };
251 257
252 } // namespace net 258 } // namespace net
253 259
254 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_ 260 #endif // NET_HTTP_BIDIRECTIONAL_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/bidirectional_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698