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

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

Issue 3020032: Implement server push protocol 2. (Closed)
Patch Set: nits. Created 10 years, 4 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 | « net/spdy/spdy_protocol.h ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <list> 10 #include <list>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 scoped_refptr<SpdyStream>* spdy_stream, 181 scoped_refptr<SpdyStream>* spdy_stream,
182 const BoundNetLog& stream_net_log, 182 const BoundNetLog& stream_net_log,
183 CompletionCallback* callback) 183 CompletionCallback* callback)
184 : url(&url), priority(priority), spdy_stream(spdy_stream), 184 : url(&url), priority(priority), spdy_stream(spdy_stream),
185 stream_net_log(&stream_net_log), callback(callback) { } 185 stream_net_log(&stream_net_log), callback(callback) { }
186 }; 186 };
187 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > 187 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> >
188 PendingCreateStreamQueue; 188 PendingCreateStreamQueue;
189 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; 189 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap;
190 // Only HTTP push a stream. 190 // Only HTTP push a stream.
191 typedef std::list<scoped_refptr<SpdyStream> > ActivePushedStreamList; 191 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap;
192 typedef std::map<std::string, scoped_refptr<SpdyStream> > PendingStreamMap;
193 typedef std::priority_queue<SpdyIOBuffer> OutputQueue; 192 typedef std::priority_queue<SpdyIOBuffer> OutputQueue;
194 193
195 virtual ~SpdySession(); 194 virtual ~SpdySession();
196 195
197 void ProcessPendingCreateStreams(); 196 void ProcessPendingCreateStreams();
198 int CreateStreamImpl( 197 int CreateStreamImpl(
199 const GURL& url, 198 const GURL& url,
200 RequestPriority priority, 199 RequestPriority priority,
201 scoped_refptr<SpdyStream>* spdy_stream, 200 scoped_refptr<SpdyStream>* spdy_stream,
202 const BoundNetLog& stream_net_log); 201 const BoundNetLog& stream_net_log);
203 202
204 // SpdyFramerVisitorInterface 203 // SpdyFramerVisitorInterface
205 virtual void OnError(spdy::SpdyFramer*); 204 virtual void OnError(spdy::SpdyFramer*);
206 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, 205 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id,
207 const char* data, 206 const char* data,
208 size_t len); 207 size_t len);
209 virtual void OnControl(const spdy::SpdyControlFrame* frame); 208 virtual void OnControl(const spdy::SpdyControlFrame* frame);
210 209
211 // Control frame handlers. 210 // Control frame handlers.
212 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, 211 void OnSyn(const spdy::SpdySynStreamControlFrame& frame,
213 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 212 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
214 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, 213 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
215 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 214 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
216 void OnFin(const spdy::SpdyRstStreamControlFrame& frame); 215 void OnRst(const spdy::SpdyRstStreamControlFrame& frame);
217 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); 216 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame);
218 void OnSettings(const spdy::SpdySettingsControlFrame& frame); 217 void OnSettings(const spdy::SpdySettingsControlFrame& frame);
219 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); 218 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame);
220 219
221 // IO Callbacks 220 // IO Callbacks
222 void OnTCPConnect(int result); 221 void OnTCPConnect(int result);
223 void OnSSLConnect(int result); 222 void OnSSLConnect(int result);
224 void OnReadComplete(int result); 223 void OnReadComplete(int result);
225 void OnWriteComplete(int result); 224 void OnWriteComplete(int result);
226 225
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 302
304 // Map from stream id to all active streams. Streams are active in the sense 303 // Map from stream id to all active streams. Streams are active in the sense
305 // that they have a consumer (typically SpdyNetworkTransaction and regardless 304 // that they have a consumer (typically SpdyNetworkTransaction and regardless
306 // of whether or not there is currently any ongoing IO [might be waiting for 305 // of whether or not there is currently any ongoing IO [might be waiting for
307 // the server to start pushing the stream]) or there are still network events 306 // the server to start pushing the stream]) or there are still network events
308 // incoming even though the consumer has already gone away (cancellation). 307 // incoming even though the consumer has already gone away (cancellation).
309 // TODO(willchan): Perhaps we should separate out cancelled streams and move 308 // TODO(willchan): Perhaps we should separate out cancelled streams and move
310 // them into a separate ActiveStreamMap, and not deliver network events to 309 // them into a separate ActiveStreamMap, and not deliver network events to
311 // them? 310 // them?
312 ActiveStreamMap active_streams_; 311 ActiveStreamMap active_streams_;
313 // List of all the streams that have already started to be pushed by the 312 // Map of all the streams that have already started to be pushed by the
314 // server, but do not have consumers yet. 313 // server, but do not have consumers yet.
315 ActivePushedStreamList pushed_streams_; 314 PushedStreamMap unclaimed_pushed_streams_;
316 // List of streams declared in X-Associated-Content headers, but do not have
317 // consumers yet.
318 // The key is a string representing the path of the URI being pushed.
319 PendingStreamMap pending_streams_;
320 315
321 // As we gather data to be sent, we put it into the output queue. 316 // As we gather data to be sent, we put it into the output queue.
322 OutputQueue queue_; 317 OutputQueue queue_;
323 318
324 // The packet we are currently sending. 319 // The packet we are currently sending.
325 bool write_pending_; // Will be true when a write is in progress. 320 bool write_pending_; // Will be true when a write is in progress.
326 SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. 321 SpdyIOBuffer in_flight_write_; // This is the write buffer in progress.
327 322
328 // Flag if we have a pending message scheduled for WriteSocket. 323 // Flag if we have a pending message scheduled for WriteSocket.
329 bool delayed_write_pending_; 324 bool delayed_write_pending_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 360
366 BoundNetLog net_log_; 361 BoundNetLog net_log_;
367 362
368 static bool use_ssl_; 363 static bool use_ssl_;
369 static bool use_flow_control_; 364 static bool use_flow_control_;
370 }; 365 };
371 366
372 } // namespace net 367 } // namespace net
373 368
374 #endif // NET_SPDY_SPDY_SESSION_H_ 369 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_protocol.h ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698