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

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

Issue 6341004: More net/ reordering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Window gyp dependency Created 9 years, 11 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/socket/ssl_client_socket_pool.cc ('k') | net/spdy/spdy_test_util.h » ('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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const BoundNetLog& net_log() const { return net_log_; } 193 const BoundNetLog& net_log() const { return net_log_; }
194 194
195 int GetPeerAddress(AddressList* address) const { 195 int GetPeerAddress(AddressList* address) const {
196 return connection_->socket()->GetPeerAddress(address); 196 return connection_->socket()->GetPeerAddress(address);
197 } 197 }
198 198
199 private: 199 private:
200 friend class base::RefCounted<SpdySession>; 200 friend class base::RefCounted<SpdySession>;
201 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); 201 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream);
202 202
203 enum State {
204 IDLE,
205 CONNECTING,
206 CONNECTED,
207 CLOSED
208 };
209
210 enum { kDefaultMaxConcurrentStreams = 10 };
211
212 struct PendingCreateStream { 203 struct PendingCreateStream {
213 const GURL* url;
214 RequestPriority priority;
215 scoped_refptr<SpdyStream>* spdy_stream;
216 const BoundNetLog* stream_net_log;
217 CompletionCallback* callback;
218
219 PendingCreateStream(const GURL& url, RequestPriority priority, 204 PendingCreateStream(const GURL& url, RequestPriority priority,
220 scoped_refptr<SpdyStream>* spdy_stream, 205 scoped_refptr<SpdyStream>* spdy_stream,
221 const BoundNetLog& stream_net_log, 206 const BoundNetLog& stream_net_log,
222 CompletionCallback* callback) 207 CompletionCallback* callback)
223 : url(&url), priority(priority), spdy_stream(spdy_stream), 208 : url(&url), priority(priority), spdy_stream(spdy_stream),
224 stream_net_log(&stream_net_log), callback(callback) { } 209 stream_net_log(&stream_net_log), callback(callback) { }
210
211 const GURL* url;
212 RequestPriority priority;
213 scoped_refptr<SpdyStream>* spdy_stream;
214 const BoundNetLog* stream_net_log;
215 CompletionCallback* callback;
225 }; 216 };
226 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > 217 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> >
227 PendingCreateStreamQueue; 218 PendingCreateStreamQueue;
228 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; 219 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap;
229 // Only HTTP push a stream. 220 // Only HTTP push a stream.
230 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; 221 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap;
231 typedef std::priority_queue<SpdyIOBuffer> OutputQueue; 222 typedef std::priority_queue<SpdyIOBuffer> OutputQueue;
232 223
233 struct CallbackResultPair { 224 struct CallbackResultPair {
234 CallbackResultPair() : callback(NULL), result(OK) {} 225 CallbackResultPair() : callback(NULL), result(OK) {}
235 CallbackResultPair(CompletionCallback* callback_in, int result_in) 226 CallbackResultPair(CompletionCallback* callback_in, int result_in)
236 : callback(callback_in), result(result_in) {} 227 : callback(callback_in), result(result_in) {}
237 228
238 CompletionCallback* callback; 229 CompletionCallback* callback;
239 int result; 230 int result;
240 }; 231 };
241 232
242 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> 233 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair>
243 PendingCallbackMap; 234 PendingCallbackMap;
244 235
236 enum State {
237 IDLE,
238 CONNECTING,
239 CONNECTED,
240 CLOSED
241 };
242
243 enum { kDefaultMaxConcurrentStreams = 10 };
244
245 virtual ~SpdySession(); 245 virtual ~SpdySession();
246 246
247 void ProcessPendingCreateStreams(); 247 void ProcessPendingCreateStreams();
248 int CreateStreamImpl( 248 int CreateStreamImpl(
249 const GURL& url, 249 const GURL& url,
250 RequestPriority priority, 250 RequestPriority priority,
251 scoped_refptr<SpdyStream>* spdy_stream, 251 scoped_refptr<SpdyStream>* spdy_stream,
252 const BoundNetLog& stream_net_log); 252 const BoundNetLog& stream_net_log);
253 253
254 // SpdyFramerVisitorInterface
255 virtual void OnError(spdy::SpdyFramer*);
256 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id,
257 const char* data,
258 size_t len);
259 virtual void OnControl(const spdy::SpdyControlFrame* frame);
260
261 // Control frame handlers. 254 // Control frame handlers.
262 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, 255 void OnSyn(const spdy::SpdySynStreamControlFrame& frame,
263 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 256 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
264 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, 257 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
265 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 258 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
266 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame, 259 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame,
267 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 260 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
268 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); 261 void OnRst(const spdy::SpdyRstStreamControlFrame& frame);
269 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); 262 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame);
270 void OnSettings(const spdy::SpdySettingsControlFrame& frame); 263 void OnSettings(const spdy::SpdySettingsControlFrame& frame);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 311
319 void RecordHistograms(); 312 void RecordHistograms();
320 313
321 // Closes all streams. Used as part of shutdown. 314 // Closes all streams. Used as part of shutdown.
322 void CloseAllStreams(net::Error status); 315 void CloseAllStreams(net::Error status);
323 316
324 // Invokes a user callback for stream creation. We provide this method so it 317 // Invokes a user callback for stream creation. We provide this method so it
325 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. 318 // can be deferred to the MessageLoop, so we avoid re-entrancy problems.
326 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); 319 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream);
327 320
321 // SpdyFramerVisitorInterface:
322 virtual void OnError(spdy::SpdyFramer*);
323 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id,
324 const char* data,
325 size_t len);
326 virtual void OnControl(const spdy::SpdyControlFrame* frame);
327
328 // Callbacks for the Spdy session. 328 // Callbacks for the Spdy session.
329 CompletionCallbackImpl<SpdySession> read_callback_; 329 CompletionCallbackImpl<SpdySession> read_callback_;
330 CompletionCallbackImpl<SpdySession> write_callback_; 330 CompletionCallbackImpl<SpdySession> write_callback_;
331 331
332 // Used for posting asynchronous IO tasks. We use this even though 332 // Used for posting asynchronous IO tasks. We use this even though
333 // SpdySession is refcounted because we don't need to keep the SpdySession 333 // SpdySession is refcounted because we don't need to keep the SpdySession
334 // alive if the last reference is within a RunnableMethod. Just revoke the 334 // alive if the last reference is within a RunnableMethod. Just revoke the
335 // method. 335 // method.
336 ScopedRunnableMethodFactory<SpdySession> method_factory_; 336 ScopedRunnableMethodFactory<SpdySession> method_factory_;
337 337
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 static size_t max_concurrent_stream_limit_; 432 static size_t max_concurrent_stream_limit_;
433 }; 433 };
434 434
435 class NetLogSpdySynParameter : public NetLog::EventParameters { 435 class NetLogSpdySynParameter : public NetLog::EventParameters {
436 public: 436 public:
437 NetLogSpdySynParameter(const linked_ptr<spdy::SpdyHeaderBlock>& headers, 437 NetLogSpdySynParameter(const linked_ptr<spdy::SpdyHeaderBlock>& headers,
438 spdy::SpdyControlFlags flags, 438 spdy::SpdyControlFlags flags,
439 spdy::SpdyStreamId id, 439 spdy::SpdyStreamId id,
440 spdy::SpdyStreamId associated_stream); 440 spdy::SpdyStreamId associated_stream);
441 441
442 virtual Value* ToValue() const;
443
444 const linked_ptr<spdy::SpdyHeaderBlock>& GetHeaders() const { 442 const linked_ptr<spdy::SpdyHeaderBlock>& GetHeaders() const {
445 return headers_; 443 return headers_;
446 } 444 }
447 445
446 virtual Value* ToValue() const;
447
448 private: 448 private:
449 virtual ~NetLogSpdySynParameter(); 449 virtual ~NetLogSpdySynParameter();
450 450
451 const linked_ptr<spdy::SpdyHeaderBlock> headers_; 451 const linked_ptr<spdy::SpdyHeaderBlock> headers_;
452 const spdy::SpdyControlFlags flags_; 452 const spdy::SpdyControlFlags flags_;
453 const spdy::SpdyStreamId id_; 453 const spdy::SpdyStreamId id_;
454 const spdy::SpdyStreamId associated_stream_; 454 const spdy::SpdyStreamId associated_stream_;
455 455
456 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); 456 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter);
457 }; 457 };
458 458
459 } // namespace net 459 } // namespace net
460 460
461 #endif // NET_SPDY_SPDY_SESSION_H_ 461 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | net/spdy/spdy_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698