| OLD | NEW | 
|---|
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 223         : url(&url), priority(priority), spdy_stream(spdy_stream), | 223         : url(&url), priority(priority), spdy_stream(spdy_stream), | 
| 224           stream_net_log(&stream_net_log), callback(callback) { } | 224           stream_net_log(&stream_net_log), callback(callback) { } | 
| 225   }; | 225   }; | 
| 226   typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > | 226   typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > | 
| 227       PendingCreateStreamQueue; | 227       PendingCreateStreamQueue; | 
| 228   typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; | 228   typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; | 
| 229   // Only HTTP push a stream. | 229   // Only HTTP push a stream. | 
| 230   typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; | 230   typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; | 
| 231   typedef std::priority_queue<SpdyIOBuffer> OutputQueue; | 231   typedef std::priority_queue<SpdyIOBuffer> OutputQueue; | 
| 232 | 232 | 
|  | 233   struct CallbackResultPair { | 
|  | 234     CallbackResultPair() : callback(NULL), result(OK) {} | 
|  | 235     CallbackResultPair(CompletionCallback* callback_in, int result_in) | 
|  | 236         : callback(callback_in), result(result_in) {} | 
|  | 237 | 
|  | 238     CompletionCallback* callback; | 
|  | 239     int result; | 
|  | 240   }; | 
|  | 241 | 
|  | 242   typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> | 
|  | 243       PendingCallbackMap; | 
|  | 244 | 
| 233   virtual ~SpdySession(); | 245   virtual ~SpdySession(); | 
| 234 | 246 | 
| 235   void ProcessPendingCreateStreams(); | 247   void ProcessPendingCreateStreams(); | 
| 236   int CreateStreamImpl( | 248   int CreateStreamImpl( | 
| 237       const GURL& url, | 249       const GURL& url, | 
| 238       RequestPriority priority, | 250       RequestPriority priority, | 
| 239       scoped_refptr<SpdyStream>* spdy_stream, | 251       scoped_refptr<SpdyStream>* spdy_stream, | 
| 240       const BoundNetLog& stream_net_log); | 252       const BoundNetLog& stream_net_log); | 
| 241 | 253 | 
| 242   // SpdyFramerVisitorInterface | 254   // SpdyFramerVisitorInterface | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 302   bool Respond(const spdy::SpdyHeaderBlock& headers, | 314   bool Respond(const spdy::SpdyHeaderBlock& headers, | 
| 303                const scoped_refptr<SpdyStream> stream); | 315                const scoped_refptr<SpdyStream> stream); | 
| 304 | 316 | 
| 305   void RecordHistograms(); | 317   void RecordHistograms(); | 
| 306 | 318 | 
| 307   // Closes all streams.  Used as part of shutdown. | 319   // Closes all streams.  Used as part of shutdown. | 
| 308   void CloseAllStreams(net::Error status); | 320   void CloseAllStreams(net::Error status); | 
| 309 | 321 | 
| 310   // Invokes a user callback for stream creation.  We provide this method so it | 322   // Invokes a user callback for stream creation.  We provide this method so it | 
| 311   // can be deferred to the MessageLoop, so we avoid re-entrancy problems. | 323   // can be deferred to the MessageLoop, so we avoid re-entrancy problems. | 
| 312   void InvokeUserStreamCreationCallback(CompletionCallback* callback, int rv); | 324   void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); | 
| 313 | 325 | 
| 314   // Callbacks for the Spdy session. | 326   // Callbacks for the Spdy session. | 
| 315   CompletionCallbackImpl<SpdySession> read_callback_; | 327   CompletionCallbackImpl<SpdySession> read_callback_; | 
| 316   CompletionCallbackImpl<SpdySession> write_callback_; | 328   CompletionCallbackImpl<SpdySession> write_callback_; | 
| 317 | 329 | 
| 318   // Used for posting asynchronous IO tasks.  We use this even though | 330   // Used for posting asynchronous IO tasks.  We use this even though | 
| 319   // SpdySession is refcounted because we don't need to keep the SpdySession | 331   // SpdySession is refcounted because we don't need to keep the SpdySession | 
| 320   // alive if the last reference is within a RunnableMethod.  Just revoke the | 332   // alive if the last reference is within a RunnableMethod.  Just revoke the | 
| 321   // method. | 333   // method. | 
| 322   ScopedRunnableMethodFactory<SpdySession> method_factory_; | 334   ScopedRunnableMethodFactory<SpdySession> method_factory_; | 
| 323 | 335 | 
|  | 336   // Map of the SpdyStreams for which we have a pending Task to invoke a | 
|  | 337   // callback.  This is necessary since, before we invoke said callback, it's | 
|  | 338   // possible that the request is cancelled. | 
|  | 339   PendingCallbackMap pending_callback_map_; | 
|  | 340 | 
| 324   // The domain this session is connected to. | 341   // The domain this session is connected to. | 
| 325   const HostPortProxyPair host_port_proxy_pair_; | 342   const HostPortProxyPair host_port_proxy_pair_; | 
| 326 | 343 | 
| 327   // |spdy_session_pool_| owns us, therefore its lifetime must exceed ours.  We | 344   // |spdy_session_pool_| owns us, therefore its lifetime must exceed ours.  We | 
| 328   // set this to NULL after we are removed from the pool. | 345   // set this to NULL after we are removed from the pool. | 
| 329   SpdySessionPool* spdy_session_pool_; | 346   SpdySessionPool* spdy_session_pool_; | 
| 330   SpdySettingsStorage* const spdy_settings_; | 347   SpdySettingsStorage* const spdy_settings_; | 
| 331 | 348 | 
| 332   // The socket handle for this session. | 349   // The socket handle for this session. | 
| 333   scoped_ptr<ClientSocketHandle> connection_; | 350   scoped_ptr<ClientSocketHandle> connection_; | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 429   const linked_ptr<spdy::SpdyHeaderBlock> headers_; | 446   const linked_ptr<spdy::SpdyHeaderBlock> headers_; | 
| 430   const spdy::SpdyControlFlags flags_; | 447   const spdy::SpdyControlFlags flags_; | 
| 431   const spdy::SpdyStreamId id_; | 448   const spdy::SpdyStreamId id_; | 
| 432 | 449 | 
| 433   DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 450   DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 
| 434 }; | 451 }; | 
| 435 | 452 | 
| 436 }  // namespace net | 453 }  // namespace net | 
| 437 | 454 | 
| 438 #endif  // NET_SPDY_SPDY_SESSION_H_ | 455 #endif  // NET_SPDY_SPDY_SESSION_H_ | 
| OLD | NEW | 
|---|