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

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

Issue 13990005: [SPDY] Replace SpdyIOBuffer with new SpdyBuffer class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix missing include Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_read_queue_unittest.cc ('k') | net/spdy/spdy_session.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 (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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "net/base/io_buffer.h" 19 #include "net/base/io_buffer.h"
20 #include "net/base/load_states.h" 20 #include "net/base/load_states.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "net/base/net_export.h" 22 #include "net/base/net_export.h"
23 #include "net/base/request_priority.h" 23 #include "net/base/request_priority.h"
24 #include "net/socket/client_socket_handle.h" 24 #include "net/socket/client_socket_handle.h"
25 #include "net/socket/next_proto.h" 25 #include "net/socket/next_proto.h"
26 #include "net/socket/ssl_client_socket.h" 26 #include "net/socket/ssl_client_socket.h"
27 #include "net/socket/stream_socket.h" 27 #include "net/socket/stream_socket.h"
28 #include "net/spdy/buffered_spdy_framer.h" 28 #include "net/spdy/buffered_spdy_framer.h"
29 #include "net/spdy/spdy_buffer.h"
29 #include "net/spdy/spdy_credential_state.h" 30 #include "net/spdy/spdy_credential_state.h"
30 #include "net/spdy/spdy_header_block.h" 31 #include "net/spdy/spdy_header_block.h"
31 #include "net/spdy/spdy_io_buffer.h"
32 #include "net/spdy/spdy_protocol.h" 32 #include "net/spdy/spdy_protocol.h"
33 #include "net/spdy/spdy_session_pool.h" 33 #include "net/spdy/spdy_session_pool.h"
34 #include "net/spdy/spdy_write_queue.h" 34 #include "net/spdy/spdy_write_queue.h"
35 #include "net/ssl/ssl_client_cert_type.h" 35 #include "net/ssl/ssl_client_cert_type.h"
36 #include "net/ssl/ssl_config_service.h" 36 #include "net/ssl/ssl_config_service.h"
37 37
38 namespace net { 38 namespace net {
39 39
40 // This is somewhat arbitrary and not really fixed, but it will always work 40 // This is somewhat arbitrary and not really fixed, but it will always work
41 // reasonably with ethernet. Chop the world into 2-packet chunks. This is 41 // reasonably with ethernet. Chop the world into 2-packet chunks. This is
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // TODO(wtc): rename this function and the Net.SpdyIPPoolDomainMatch 239 // TODO(wtc): rename this function and the Net.SpdyIPPoolDomainMatch
240 // histogram because this function does more than verifying domain 240 // histogram because this function does more than verifying domain
241 // authentication now. 241 // authentication now.
242 bool VerifyDomainAuthentication(const std::string& domain); 242 bool VerifyDomainAuthentication(const std::string& domain);
243 243
244 // Pushes the given producer into the write queue for 244 // Pushes the given producer into the write queue for
245 // |stream|. |stream| is guaranteed to be activated before the 245 // |stream|. |stream| is guaranteed to be activated before the
246 // producer is used to produce its frame. 246 // producer is used to produce its frame.
247 void EnqueueStreamWrite(SpdyStream* stream, 247 void EnqueueStreamWrite(SpdyStream* stream,
248 SpdyFrameType frame_type, 248 SpdyFrameType frame_type,
249 scoped_ptr<SpdyFrameProducer> producer); 249 scoped_ptr<SpdyBufferProducer> producer);
250 250
251 // Creates and returns a SYN frame for |stream_id|. 251 // Creates and returns a SYN frame for |stream_id|.
252 scoped_ptr<SpdyFrame> CreateSynStream( 252 scoped_ptr<SpdyFrame> CreateSynStream(
253 SpdyStreamId stream_id, 253 SpdyStreamId stream_id,
254 RequestPriority priority, 254 RequestPriority priority,
255 uint8 credential_slot, 255 uint8 credential_slot,
256 SpdyControlFlags flags, 256 SpdyControlFlags flags,
257 const SpdyHeaderBlock& headers); 257 const SpdyHeaderBlock& headers);
258 258
259 // Tries to create a CREDENTIAL frame. If successful, fills in 259 // Tries to create a CREDENTIAL frame. If successful, fills in
260 // |credential_frame| and returns OK. Returns the error (guaranteed 260 // |credential_frame| and returns OK. Returns the error (guaranteed
261 // to not be ERR_IO_PENDING) otherwise. 261 // to not be ERR_IO_PENDING) otherwise.
262 int CreateCredentialFrame(const std::string& origin, 262 int CreateCredentialFrame(const std::string& origin,
263 SSLClientCertType type, 263 SSLClientCertType type,
264 const std::string& key, 264 const std::string& key,
265 const std::string& cert, 265 const std::string& cert,
266 RequestPriority priority, 266 RequestPriority priority,
267 scoped_ptr<SpdyFrame>* credential_frame); 267 scoped_ptr<SpdyFrame>* credential_frame);
268 268
269 // Creates and returns a HEADERS frame. 269 // Creates and returns a HEADERS frame.
270 scoped_ptr<SpdyFrame> CreateHeadersFrame(SpdyStreamId stream_id, 270 scoped_ptr<SpdyFrame> CreateHeadersFrame(SpdyStreamId stream_id,
271 const SpdyHeaderBlock& headers, 271 const SpdyHeaderBlock& headers,
272 SpdyControlFlags flags); 272 SpdyControlFlags flags);
273 273
274 // Creates and returns a data frame. May return NULL if stalled by 274 // Creates and returns a SpdyBuffer holding a data frame with the
275 // flow control. 275 // given data. May return NULL if stalled by flow control.
276 scoped_ptr<SpdyFrame> CreateDataFrame(SpdyStreamId stream_id, 276 scoped_ptr<SpdyBuffer> CreateDataBuffer(SpdyStreamId stream_id,
277 net::IOBuffer* data, 277 net::IOBuffer* data,
278 int len, 278 int len,
279 SpdyDataFlags flags); 279 SpdyDataFlags flags);
280 280
281 // Close a stream. 281 // Close a stream.
282 void CloseStream(SpdyStreamId stream_id, int status); 282 void CloseStream(SpdyStreamId stream_id, int status);
283 283
284 // Close a stream that has been created but is not yet active. 284 // Close a stream that has been created but is not yet active.
285 void CloseCreatedStream(SpdyStream* stream, int status); 285 void CloseCreatedStream(SpdyStream* stream, int status);
286 286
287 // Reset a stream by sending a RST_STREAM frame with given status code. 287 // Reset a stream by sending a RST_STREAM frame with given status code.
288 // Also closes the stream. Was not piggybacked to CloseStream since not 288 // Also closes the stream. Was not piggybacked to CloseStream since not
289 // all of the calls to CloseStream necessitate sending a RST_STREAM. 289 // all of the calls to CloseStream necessitate sending a RST_STREAM.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // Pushes the given frame with the given priority into the write 577 // Pushes the given frame with the given priority into the write
578 // queue for the session. 578 // queue for the session.
579 void EnqueueSessionWrite(RequestPriority priority, 579 void EnqueueSessionWrite(RequestPriority priority,
580 SpdyFrameType frame_type, 580 SpdyFrameType frame_type,
581 scoped_ptr<SpdyFrame> frame); 581 scoped_ptr<SpdyFrame> frame);
582 582
583 // Puts |producer| associated with |stream| onto the write queue 583 // Puts |producer| associated with |stream| onto the write queue
584 // with the given priority. 584 // with the given priority.
585 void EnqueueWrite(RequestPriority priority, 585 void EnqueueWrite(RequestPriority priority,
586 SpdyFrameType frame_type, 586 SpdyFrameType frame_type,
587 scoped_ptr<SpdyFrameProducer> producer, 587 scoped_ptr<SpdyBufferProducer> producer,
588 const scoped_refptr<SpdyStream>& stream); 588 const scoped_refptr<SpdyStream>& stream);
589 589
590 // Track active streams in the active stream list. 590 // Track active streams in the active stream list.
591 void ActivateStream(SpdyStream* stream); 591 void ActivateStream(SpdyStream* stream);
592 void DeleteStream(SpdyStreamId id, int status); 592 void DeleteStream(SpdyStreamId id, int status);
593 593
594 // Removes this session from the session pool. 594 // Removes this session from the session pool.
595 void RemoveFromPool(); 595 void RemoveFromPool();
596 596
597 // Check if we have a pending pushed-stream for this url 597 // Check if we have a pending pushed-stream for this url
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // Map of all the streams that have already started to be pushed by the 764 // Map of all the streams that have already started to be pushed by the
765 // server, but do not have consumers yet. 765 // server, but do not have consumers yet.
766 PushedStreamMap unclaimed_pushed_streams_; 766 PushedStreamMap unclaimed_pushed_streams_;
767 767
768 // Set of all created streams but that have not yet sent any frames. 768 // Set of all created streams but that have not yet sent any frames.
769 CreatedStreamSet created_streams_; 769 CreatedStreamSet created_streams_;
770 770
771 // The write queue. 771 // The write queue.
772 SpdyWriteQueue write_queue_; 772 SpdyWriteQueue write_queue_;
773 773
774 // The packet we are currently sending. 774 // Data for the frame we are currently sending.
775 bool write_pending_; // Will be true when a write is in progress. 775 // Whether we have a socket write pending completion.
776 SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. 776 bool write_pending_;
777 // The buffer we're currently writing.
778 scoped_ptr<SpdyBuffer> in_flight_write_;
779 // The type of the frame in |in_flight_write_|.
777 SpdyFrameType in_flight_write_frame_type_; 780 SpdyFrameType in_flight_write_frame_type_;
781 // The size of the frame in |in_flight_write_|.
782 size_t in_flight_write_frame_size_;
783 // The stream to notify when |in_flight_write_| has been written to
784 // the socket completely.
785 scoped_refptr<SpdyStream> in_flight_write_stream_;
778 786
779 // Flag if we have a pending message scheduled for WriteSocket. 787 // Flag if we have a pending message scheduled for WriteSocket.
780 bool delayed_write_pending_; 788 bool delayed_write_pending_;
781 789
782 // Flag if we're using an SSL connection for this SpdySession. 790 // Flag if we're using an SSL connection for this SpdySession.
783 bool is_secure_; 791 bool is_secure_;
784 792
785 // Certificate error code when using a secure connection. 793 // Certificate error code when using a secure connection.
786 int certificate_error_code_; 794 int certificate_error_code_;
787 795
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 // This SPDY proxy is allowed to push resources from origins that are 907 // This SPDY proxy is allowed to push resources from origins that are
900 // different from those of their associated streams. 908 // different from those of their associated streams.
901 HostPortPair trusted_spdy_proxy_; 909 HostPortPair trusted_spdy_proxy_;
902 910
903 TimeFunc time_func_; 911 TimeFunc time_func_;
904 }; 912 };
905 913
906 } // namespace net 914 } // namespace net
907 915
908 #endif // NET_SPDY_SPDY_SESSION_H_ 916 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_read_queue_unittest.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698