OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/task.h" | |
20 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
21 #include "net/base/load_states.h" | 20 #include "net/base/load_states.h" |
22 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
23 #include "net/base/net_log.h" | 22 #include "net/base/net_log.h" |
24 #include "net/base/request_priority.h" | 23 #include "net/base/request_priority.h" |
25 #include "net/base/ssl_config_service.h" | 24 #include "net/base/ssl_config_service.h" |
26 #include "net/base/upload_data_stream.h" | 25 #include "net/base/upload_data_stream.h" |
27 #include "net/socket/client_socket_handle.h" | 26 #include "net/socket/client_socket_handle.h" |
28 #include "net/socket/stream_socket.h" | 27 #include "net/socket/stream_socket.h" |
29 #include "net/spdy/spdy_framer.h" | 28 #include "net/spdy/spdy_framer.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 OldCompletionCallback* callback; | 254 OldCompletionCallback* callback; |
256 }; | 255 }; |
257 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > | 256 typedef std::queue<PendingCreateStream, std::list< PendingCreateStream> > |
258 PendingCreateStreamQueue; | 257 PendingCreateStreamQueue; |
259 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; | 258 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; |
260 // Only HTTP push a stream. | 259 // Only HTTP push a stream. |
261 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; | 260 typedef std::map<std::string, scoped_refptr<SpdyStream> > PushedStreamMap; |
262 typedef std::priority_queue<SpdyIOBuffer> OutputQueue; | 261 typedef std::priority_queue<SpdyIOBuffer> OutputQueue; |
263 | 262 |
264 struct CallbackResultPair { | 263 struct CallbackResultPair { |
265 CallbackResultPair() : callback(NULL), result(OK) {} | 264 CallbackResultPair() : result(OK) {} |
266 CallbackResultPair(OldCompletionCallback* callback_in, int result_in) | 265 CallbackResultPair(OldCompletionCallback* callback_in, int result_in) |
267 : callback(callback_in), result(result_in) {} | 266 : callback(callback_in), result(result_in) {} |
268 | 267 |
269 OldCompletionCallback* callback; | 268 OldCompletionCallback* callback; |
270 int result; | 269 int result; |
271 }; | 270 }; |
272 | 271 |
273 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> | 272 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> |
274 PendingCallbackMap; | 273 PendingCallbackMap; |
275 | 274 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 int64 pings_in_flight() const { return pings_in_flight_; } | 423 int64 pings_in_flight() const { return pings_in_flight_; } |
425 | 424 |
426 uint32 next_ping_id() const { return next_ping_id_; } | 425 uint32 next_ping_id() const { return next_ping_id_; } |
427 | 426 |
428 base::TimeTicks received_data_time() const { return received_data_time_; } | 427 base::TimeTicks received_data_time() const { return received_data_time_; } |
429 | 428 |
430 bool trailing_ping_pending() const { return trailing_ping_pending_; } | 429 bool trailing_ping_pending() const { return trailing_ping_pending_; } |
431 | 430 |
432 bool check_ping_status_pending() const { return check_ping_status_pending_; } | 431 bool check_ping_status_pending() const { return check_ping_status_pending_; } |
433 | 432 |
434 // Callbacks for the Spdy session. | |
435 OldCompletionCallbackImpl<SpdySession> read_callback_; | |
436 OldCompletionCallbackImpl<SpdySession> write_callback_; | |
437 | |
438 // Used for posting asynchronous IO tasks. We use this even though | 433 // Used for posting asynchronous IO tasks. We use this even though |
439 // SpdySession is refcounted because we don't need to keep the SpdySession | 434 // SpdySession is refcounted because we don't need to keep the SpdySession |
440 // alive if the last reference is within a RunnableMethod. Just revoke the | 435 // alive if the last reference is within a RunnableMethod. Just revoke the |
441 // method. | 436 // method. |
442 ScopedRunnableMethodFactory<SpdySession> method_factory_; | 437 base::WeakPtrFactory<SpdySession> weak_factory_; |
443 | 438 |
444 // Map of the SpdyStreams for which we have a pending Task to invoke a | 439 // Map of the SpdyStreams for which we have a pending Task to invoke a |
445 // callback. This is necessary since, before we invoke said callback, it's | 440 // callback. This is necessary since, before we invoke said callback, it's |
446 // possible that the request is cancelled. | 441 // possible that the request is cancelled. |
447 PendingCallbackMap pending_callback_map_; | 442 PendingCallbackMap pending_callback_map_; |
448 | 443 |
449 // The domain this session is connected to. | 444 // The domain this session is connected to. |
450 const HostPortProxyPair host_port_proxy_pair_; | 445 const HostPortProxyPair host_port_proxy_pair_; |
451 | 446 |
452 // |spdy_session_pool_| owns us, therefore its lifetime must exceed ours. We | 447 // |spdy_session_pool_| owns us, therefore its lifetime must exceed ours. We |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 const spdy::SpdyControlFlags flags_; | 612 const spdy::SpdyControlFlags flags_; |
618 const spdy::SpdyStreamId id_; | 613 const spdy::SpdyStreamId id_; |
619 const spdy::SpdyStreamId associated_stream_; | 614 const spdy::SpdyStreamId associated_stream_; |
620 | 615 |
621 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 616 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); |
622 }; | 617 }; |
623 | 618 |
624 } // namespace net | 619 } // namespace net |
625 | 620 |
626 #endif // NET_SPDY_SPDY_SESSION_H_ | 621 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |