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

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

Issue 15701009: [SPDY] Add a SpdyStreamType enum and use it for SpdyStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CHECK -> DCHECK Created 7 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 | Annotate | Revision Log
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>
(...skipping 14 matching lines...) Expand all
25 #include "net/socket/client_socket_pool.h" 25 #include "net/socket/client_socket_pool.h"
26 #include "net/socket/next_proto.h" 26 #include "net/socket/next_proto.h"
27 #include "net/socket/ssl_client_socket.h" 27 #include "net/socket/ssl_client_socket.h"
28 #include "net/socket/stream_socket.h" 28 #include "net/socket/stream_socket.h"
29 #include "net/spdy/buffered_spdy_framer.h" 29 #include "net/spdy/buffered_spdy_framer.h"
30 #include "net/spdy/spdy_buffer.h" 30 #include "net/spdy/spdy_buffer.h"
31 #include "net/spdy/spdy_credential_state.h" 31 #include "net/spdy/spdy_credential_state.h"
32 #include "net/spdy/spdy_header_block.h" 32 #include "net/spdy/spdy_header_block.h"
33 #include "net/spdy/spdy_protocol.h" 33 #include "net/spdy/spdy_protocol.h"
34 #include "net/spdy/spdy_session_pool.h" 34 #include "net/spdy/spdy_session_pool.h"
35 #include "net/spdy/spdy_stream.h"
35 #include "net/spdy/spdy_write_queue.h" 36 #include "net/spdy/spdy_write_queue.h"
36 #include "net/ssl/ssl_client_cert_type.h" 37 #include "net/ssl/ssl_client_cert_type.h"
37 #include "net/ssl/ssl_config_service.h" 38 #include "net/ssl/ssl_config_service.h"
38 39
39 namespace net { 40 namespace net {
40 41
41 // This is somewhat arbitrary and not really fixed, but it will always work 42 // This is somewhat arbitrary and not really fixed, but it will always work
42 // reasonably with ethernet. Chop the world into 2-packet chunks. This is 43 // reasonably with ethernet. Chop the world into 2-packet chunks. This is
43 // somewhat arbitrary, but is reasonably small and ensures that we elicit 44 // somewhat arbitrary, but is reasonably small and ensures that we elicit
44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). 45 // ACKs quickly from TCP (because TCP tries to only ACK every other packet).
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // then when the stream is created, |callback| will be called, at 123 // then when the stream is created, |callback| will be called, at
123 // which point ReleaseStream() may be called. Otherwise, the stream 124 // which point ReleaseStream() may be called. Otherwise, the stream
124 // is not created, an error is returned, and ReleaseStream() may not 125 // is not created, an error is returned, and ReleaseStream() may not
125 // be called. 126 // be called.
126 // 127 //
127 // If OK is returned, must not be called again without 128 // If OK is returned, must not be called again without
128 // ReleaseStream() being called first. If ERR_IO_PENDING is 129 // ReleaseStream() being called first. If ERR_IO_PENDING is
129 // returned, must not be called again without CancelRequest() or 130 // returned, must not be called again without CancelRequest() or
130 // ReleaseStream() being called first. Otherwise, in case of an 131 // ReleaseStream() being called first. Otherwise, in case of an
131 // immediate error, this may be called again. 132 // immediate error, this may be called again.
132 int StartRequest(const scoped_refptr<SpdySession>& session, 133 int StartRequest(SpdyStreamType type,
134 const scoped_refptr<SpdySession>& session,
133 const GURL& url, 135 const GURL& url,
134 RequestPriority priority, 136 RequestPriority priority,
135 const BoundNetLog& net_log, 137 const BoundNetLog& net_log,
136 const CompletionCallback& callback); 138 const CompletionCallback& callback);
137 139
138 // Cancels any pending stream creation request. May be called 140 // Cancels any pending stream creation request. May be called
139 // repeatedly. 141 // repeatedly.
140 void CancelRequest(); 142 void CancelRequest();
141 143
142 // Transfers the created stream (guaranteed to not be NULL) to the 144 // Transfers the created stream (guaranteed to not be NULL) to the
143 // caller. Must be called at most once after StartRequest() returns 145 // caller. Must be called at most once after StartRequest() returns
144 // OK or |callback| is called with OK. The caller must immediately 146 // OK or |callback| is called with OK. The caller must immediately
145 // set a delegate for the returned stream (except for test code). 147 // set a delegate for the returned stream (except for test code).
146 base::WeakPtr<SpdyStream> ReleaseStream(); 148 base::WeakPtr<SpdyStream> ReleaseStream();
147 149
148 private: 150 private:
149 friend class SpdySession; 151 friend class SpdySession;
150 152
151 // Called by |session_| when the stream attempt has finished 153 // Called by |session_| when the stream attempt has finished
152 // successfully. 154 // successfully.
153 void OnRequestCompleteSuccess(base::WeakPtr<SpdyStream>* stream); 155 void OnRequestCompleteSuccess(base::WeakPtr<SpdyStream>* stream);
154 156
155 // Called by |session_| when the stream attempt has finished with an 157 // Called by |session_| when the stream attempt has finished with an
156 // error. Also called with ERR_ABORTED if |session_| is destroyed 158 // error. Also called with ERR_ABORTED if |session_| is destroyed
157 // while the stream attempt is still pending. 159 // while the stream attempt is still pending.
158 void OnRequestCompleteFailure(int rv); 160 void OnRequestCompleteFailure(int rv);
159 161
160 // Accessors called by |session_|. 162 // Accessors called by |session_|.
163 SpdyStreamType type() const { return type_; }
161 const GURL& url() const { return url_; } 164 const GURL& url() const { return url_; }
162 RequestPriority priority() const { return priority_; } 165 RequestPriority priority() const { return priority_; }
163 const BoundNetLog& net_log() const { return net_log_; } 166 const BoundNetLog& net_log() const { return net_log_; }
164 167
165 void Reset(); 168 void Reset();
166 169
170 SpdyStreamType type_;
167 scoped_refptr<SpdySession> session_; 171 scoped_refptr<SpdySession> session_;
168 base::WeakPtr<SpdyStream> stream_; 172 base::WeakPtr<SpdyStream> stream_;
169 GURL url_; 173 GURL url_;
170 RequestPriority priority_; 174 RequestPriority priority_;
171 BoundNetLog net_log_; 175 BoundNetLog net_log_;
172 CompletionCallback callback_; 176 CompletionCallback callback_;
173 177
174 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest); 178 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest);
175 }; 179 };
176 180
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 // This SPDY proxy is allowed to push resources from origins that are 984 // This SPDY proxy is allowed to push resources from origins that are
981 // different from those of their associated streams. 985 // different from those of their associated streams.
982 HostPortPair trusted_spdy_proxy_; 986 HostPortPair trusted_spdy_proxy_;
983 987
984 TimeFunc time_func_; 988 TimeFunc time_func_;
985 }; 989 };
986 990
987 } // namespace net 991 } // namespace net
988 992
989 #endif // NET_SPDY_SPDY_SESSION_H_ 993 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698