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

Side by Side Diff: net/spdy/spdy_session.h

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // If more than this many bytes have been read or more than that many 76 // If more than this many bytes have been read or more than that many
77 // milliseconds have passed, return ERR_IO_PENDING from ReadLoop. 77 // milliseconds have passed, return ERR_IO_PENDING from ReadLoop.
78 const int kYieldAfterBytesRead = 32 * 1024; 78 const int kYieldAfterBytesRead = 32 * 1024;
79 const int kYieldAfterDurationMilliseconds = 20; 79 const int kYieldAfterDurationMilliseconds = 20;
80 80
81 // First and last valid stream IDs. As we always act as the client, 81 // First and last valid stream IDs. As we always act as the client,
82 // start at 1 for the first stream id. 82 // start at 1 for the first stream id.
83 const SpdyStreamId kFirstStreamId = 1; 83 const SpdyStreamId kFirstStreamId = 1;
84 const SpdyStreamId kLastStreamId = 0x7fffffff; 84 const SpdyStreamId kLastStreamId = 0x7fffffff;
85 85
86 class BoundNetLog; 86 class NetLogWithSource;
87 struct LoadTimingInfo; 87 struct LoadTimingInfo;
88 class ProxyDelegate; 88 class ProxyDelegate;
89 class SpdyStream; 89 class SpdyStream;
90 class SSLInfo; 90 class SSLInfo;
91 class TransportSecurityState; 91 class TransportSecurityState;
92 92
93 // NOTE: There's an enum of the same name (also with numeric suffixes) 93 // NOTE: There's an enum of the same name (also with numeric suffixes)
94 // in histograms.xml. Be sure to add new values there also. 94 // in histograms.xml. Be sure to add new values there also.
95 enum SpdyProtocolErrorDetails { 95 enum SpdyProtocolErrorDetails {
96 // SpdyFramer::SpdyError mappings. 96 // SpdyFramer::SpdyError mappings.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // 171 //
172 // If OK is returned, must not be called again without 172 // If OK is returned, must not be called again without
173 // ReleaseStream() being called first. If ERR_IO_PENDING is 173 // ReleaseStream() being called first. If ERR_IO_PENDING is
174 // returned, must not be called again without CancelRequest() or 174 // returned, must not be called again without CancelRequest() or
175 // ReleaseStream() being called first. Otherwise, in case of an 175 // ReleaseStream() being called first. Otherwise, in case of an
176 // immediate error, this may be called again. 176 // immediate error, this may be called again.
177 int StartRequest(SpdyStreamType type, 177 int StartRequest(SpdyStreamType type,
178 const base::WeakPtr<SpdySession>& session, 178 const base::WeakPtr<SpdySession>& session,
179 const GURL& url, 179 const GURL& url,
180 RequestPriority priority, 180 RequestPriority priority,
181 const BoundNetLog& net_log, 181 const NetLogWithSource& net_log,
182 const CompletionCallback& callback); 182 const CompletionCallback& callback);
183 183
184 // Cancels any pending stream creation request. May be called 184 // Cancels any pending stream creation request. May be called
185 // repeatedly. 185 // repeatedly.
186 void CancelRequest(); 186 void CancelRequest();
187 187
188 // Transfers the created stream (guaranteed to not be NULL) to the 188 // Transfers the created stream (guaranteed to not be NULL) to the
189 // caller. Must be called at most once after StartRequest() returns 189 // caller. Must be called at most once after StartRequest() returns
190 // OK or |callback| is called with OK. The caller must immediately 190 // OK or |callback| is called with OK. The caller must immediately
191 // set a delegate for the returned stream (except for test code). 191 // set a delegate for the returned stream (except for test code).
192 base::WeakPtr<SpdyStream> ReleaseStream(); 192 base::WeakPtr<SpdyStream> ReleaseStream();
193 193
194 private: 194 private:
195 friend class SpdySession; 195 friend class SpdySession;
196 196
197 // Called by |session_| when the stream attempt has finished 197 // Called by |session_| when the stream attempt has finished
198 // successfully. 198 // successfully.
199 void OnRequestCompleteSuccess(const base::WeakPtr<SpdyStream>& stream); 199 void OnRequestCompleteSuccess(const base::WeakPtr<SpdyStream>& stream);
200 200
201 // Called by |session_| when the stream attempt has finished with an 201 // Called by |session_| when the stream attempt has finished with an
202 // error. Also called with ERR_ABORTED if |session_| is destroyed 202 // error. Also called with ERR_ABORTED if |session_| is destroyed
203 // while the stream attempt is still pending. 203 // while the stream attempt is still pending.
204 void OnRequestCompleteFailure(int rv); 204 void OnRequestCompleteFailure(int rv);
205 205
206 // Accessors called by |session_|. 206 // Accessors called by |session_|.
207 SpdyStreamType type() const { return type_; } 207 SpdyStreamType type() const { return type_; }
208 const GURL& url() const { return url_; } 208 const GURL& url() const { return url_; }
209 RequestPriority priority() const { return priority_; } 209 RequestPriority priority() const { return priority_; }
210 const BoundNetLog& net_log() const { return net_log_; } 210 const NetLogWithSource& net_log() const { return net_log_; }
211 211
212 void Reset(); 212 void Reset();
213 213
214 SpdyStreamType type_; 214 SpdyStreamType type_;
215 base::WeakPtr<SpdySession> session_; 215 base::WeakPtr<SpdySession> session_;
216 base::WeakPtr<SpdyStream> stream_; 216 base::WeakPtr<SpdyStream> stream_;
217 GURL url_; 217 GURL url_;
218 RequestPriority priority_; 218 RequestPriority priority_;
219 BoundNetLog net_log_; 219 NetLogWithSource net_log_;
220 CompletionCallback callback_; 220 CompletionCallback callback_;
221 221
222 base::WeakPtrFactory<SpdyStreamRequest> weak_ptr_factory_; 222 base::WeakPtrFactory<SpdyStreamRequest> weak_ptr_factory_;
223 223
224 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest); 224 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest);
225 }; 225 };
226 226
227 class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface, 227 class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
228 public SpdyFramerDebugVisitorInterface, 228 public SpdyFramerDebugVisitorInterface,
229 public HigherLayeredPool { 229 public HigherLayeredPool {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return spdy_session_key_; 315 return spdy_session_key_;
316 } 316 }
317 // Get a pushed stream for a given |url|. If the server initiates a 317 // Get a pushed stream for a given |url|. If the server initiates a
318 // stream, it might already exist for a given path. The server 318 // stream, it might already exist for a given path. The server
319 // might also not have initiated the stream yet, but indicated it 319 // might also not have initiated the stream yet, but indicated it
320 // will via X-Associated-Content. Returns OK if a stream was found 320 // will via X-Associated-Content. Returns OK if a stream was found
321 // and put into |spdy_stream|, or if one was not found but it is 321 // and put into |spdy_stream|, or if one was not found but it is
322 // okay to create a new stream (in which case |spdy_stream| is 322 // okay to create a new stream (in which case |spdy_stream| is
323 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and 323 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and
324 // resets |spdy_stream|. 324 // resets |spdy_stream|.
325 int GetPushStream( 325 int GetPushStream(const GURL& url,
326 const GURL& url, 326 base::WeakPtr<SpdyStream>* spdy_stream,
327 base::WeakPtr<SpdyStream>* spdy_stream, 327 const NetLogWithSource& stream_net_log);
328 const BoundNetLog& stream_net_log);
329 328
330 // Initialize the session with the given connection. |is_secure| 329 // Initialize the session with the given connection. |is_secure|
331 // must indicate whether |connection| uses an SSL socket or not; it 330 // must indicate whether |connection| uses an SSL socket or not; it
332 // is usually true, but it can be false for testing or when SPDY is 331 // is usually true, but it can be false for testing or when SPDY is
333 // configured to work with non-secure sockets. 332 // configured to work with non-secure sockets.
334 // 333 //
335 // |pool| is the SpdySessionPool that owns us. Its lifetime must 334 // |pool| is the SpdySessionPool that owns us. Its lifetime must
336 // strictly be greater than |this|. 335 // strictly be greater than |this|.
337 // 336 //
338 // |certificate_error_code| must either be OK or less than 337 // |certificate_error_code| must either be OK or less than
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 510
512 // Returns the current |stream_initial_send_window_size_|. 511 // Returns the current |stream_initial_send_window_size_|.
513 int32_t stream_initial_send_window_size() const { 512 int32_t stream_initial_send_window_size() const {
514 return stream_initial_send_window_size_; 513 return stream_initial_send_window_size_;
515 } 514 }
516 515
517 // Returns true if no stream in the session can send data due to 516 // Returns true if no stream in the session can send data due to
518 // session flow control. 517 // session flow control.
519 bool IsSendStalled() const { return session_send_window_size_ == 0; } 518 bool IsSendStalled() const { return session_send_window_size_ == 0; }
520 519
521 const BoundNetLog& net_log() const { return net_log_; } 520 const NetLogWithSource& net_log() const { return net_log_; }
522 521
523 int GetPeerAddress(IPEndPoint* address) const; 522 int GetPeerAddress(IPEndPoint* address) const;
524 int GetLocalAddress(IPEndPoint* address) const; 523 int GetLocalAddress(IPEndPoint* address) const;
525 524
526 // Adds |alias| to set of aliases associated with this session. 525 // Adds |alias| to set of aliases associated with this session.
527 void AddPooledAlias(const SpdySessionKey& alias_key); 526 void AddPooledAlias(const SpdySessionKey& alias_key);
528 527
529 // Returns the set of aliases associated with this session. 528 // Returns the set of aliases associated with this session.
530 const std::set<SpdySessionKey>& pooled_aliases() const { 529 const std::set<SpdySessionKey>& pooled_aliases() const {
531 return pooled_aliases_; 530 return pooled_aliases_;
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 // plans to add a command line switch that would cause a SETTINGS 1162 // plans to add a command line switch that would cause a SETTINGS
1164 // frame with window size announcement to be sent on startup. Newly 1163 // frame with window size announcement to be sent on startup. Newly
1165 // created streams will use this value for the initial receive 1164 // created streams will use this value for the initial receive
1166 // window size. 1165 // window size.
1167 int32_t stream_max_recv_window_size_; 1166 int32_t stream_max_recv_window_size_;
1168 1167
1169 // A queue of stream IDs that have been send-stalled at some point 1168 // A queue of stream IDs that have been send-stalled at some point
1170 // in the past. 1169 // in the past.
1171 std::deque<SpdyStreamId> stream_send_unstall_queue_[NUM_PRIORITIES]; 1170 std::deque<SpdyStreamId> stream_send_unstall_queue_[NUM_PRIORITIES];
1172 1171
1173 BoundNetLog net_log_; 1172 NetLogWithSource net_log_;
1174 1173
1175 // Outside of tests, these should always be true. 1174 // Outside of tests, these should always be true.
1176 bool verify_domain_authentication_; 1175 bool verify_domain_authentication_;
1177 bool enable_sending_initial_data_; 1176 bool enable_sending_initial_data_;
1178 bool enable_ping_based_connection_checking_; 1177 bool enable_ping_based_connection_checking_;
1179 1178
1180 // |connection_at_risk_of_loss_time_| is an optimization to avoid sending 1179 // |connection_at_risk_of_loss_time_| is an optimization to avoid sending
1181 // wasteful preface pings (when we just got some data). 1180 // wasteful preface pings (when we just got some data).
1182 // 1181 //
1183 // If it is zero (the most conservative figure), then we always send the 1182 // If it is zero (the most conservative figure), then we always send the
(...skipping 27 matching lines...) Expand all
1211 // Used for posting asynchronous IO tasks. We use this even though 1210 // Used for posting asynchronous IO tasks. We use this even though
1212 // SpdySession is refcounted because we don't need to keep the SpdySession 1211 // SpdySession is refcounted because we don't need to keep the SpdySession
1213 // alive if the last reference is within a RunnableMethod. Just revoke the 1212 // alive if the last reference is within a RunnableMethod. Just revoke the
1214 // method. 1213 // method.
1215 base::WeakPtrFactory<SpdySession> weak_factory_; 1214 base::WeakPtrFactory<SpdySession> weak_factory_;
1216 }; 1215 };
1217 1216
1218 } // namespace net 1217 } // namespace net
1219 1218
1220 #endif // NET_SPDY_SPDY_SESSION_H_ 1219 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698