OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_FLIP_FLIP_SESSION_H_ | 5 #ifndef NET_FLIP_FLIP_SESSION_H_ |
6 #define NET_FLIP_FLIP_SESSION_H_ | 6 #define NET_FLIP_FLIP_SESSION_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // will always be called at the end of the request and signals to the | 83 // will always be called at the end of the request and signals to the |
84 // delegate that the delegate can be torn down. No further callbacks to the | 84 // delegate that the delegate can be torn down. No further callbacks to the |
85 // delegate will be made after this call. | 85 // delegate will be made after this call. |
86 // |status| is an error code or OK. | 86 // |status| is an error code or OK. |
87 virtual void OnClose(int status) = 0; | 87 virtual void OnClose(int status) = 0; |
88 }; | 88 }; |
89 | 89 |
90 class FlipSession : public base::RefCounted<FlipSession>, | 90 class FlipSession : public base::RefCounted<FlipSession>, |
91 public flip::FlipFramerVisitorInterface { | 91 public flip::FlipFramerVisitorInterface { |
92 public: | 92 public: |
93 virtual ~FlipSession(); | |
94 | |
95 // Get the domain for this FlipSession. | 93 // Get the domain for this FlipSession. |
96 const std::string& domain() const { return domain_; } | 94 const std::string& domain() const { return domain_; } |
97 | 95 |
98 // Connect the FLIP Socket. | 96 // Connect the FLIP Socket. |
99 // Returns net::Error::OK on success. | 97 // Returns net::Error::OK on success. |
100 // Note that this call does not wait for the connect to complete. Callers can | 98 // Note that this call does not wait for the connect to complete. Callers can |
101 // immediately start using the FlipSession while it connects. | 99 // immediately start using the FlipSession while it connects. |
102 net::Error Connect(const std::string& group_name, | 100 net::Error Connect(const std::string& group_name, |
103 const HostResolver::RequestInfo& host, int priority); | 101 const HostResolver::RequestInfo& host, int priority); |
104 | 102 |
(...skipping 26 matching lines...) Expand all Loading... |
131 // |host| is the hostname that this session connects to. | 129 // |host| is the hostname that this session connects to. |
132 FlipSession(std::string host, HttpNetworkSession* session); | 130 FlipSession(std::string host, HttpNetworkSession* session); |
133 | 131 |
134 // Closes all open streams. Used as part of shutdown. | 132 // Closes all open streams. Used as part of shutdown. |
135 void CloseAllStreams(net::Error code); | 133 void CloseAllStreams(net::Error code); |
136 | 134 |
137 // Enable or disable SSL. This is only to be used for testing. | 135 // Enable or disable SSL. This is only to be used for testing. |
138 static void SetSSLMode(bool enable) { use_ssl_ = enable; } | 136 static void SetSSLMode(bool enable) { use_ssl_ = enable; } |
139 | 137 |
140 private: | 138 private: |
| 139 friend class base::RefCounted<FlipSession>; |
| 140 virtual ~FlipSession(); |
| 141 |
141 // FlipFramerVisitorInterface | 142 // FlipFramerVisitorInterface |
142 virtual void OnError(flip::FlipFramer*); | 143 virtual void OnError(flip::FlipFramer*); |
143 virtual void OnStreamFrameData(flip::FlipStreamId stream_id, | 144 virtual void OnStreamFrameData(flip::FlipStreamId stream_id, |
144 const char* data, | 145 const char* data, |
145 size_t len); | 146 size_t len); |
146 virtual void OnControl(const flip::FlipControlFrame* frame); | 147 virtual void OnControl(const flip::FlipControlFrame* frame); |
147 virtual void OnLameDuck(); | 148 virtual void OnLameDuck(); |
148 | 149 |
149 // Control frame handlers. | 150 // Control frame handlers. |
150 void OnSyn(const flip::FlipSynStreamControlFrame* frame, | 151 void OnSyn(const flip::FlipSynStreamControlFrame* frame, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 228 |
228 // Flip Frame state. | 229 // Flip Frame state. |
229 flip::FlipFramer flip_framer_; | 230 flip::FlipFramer flip_framer_; |
230 | 231 |
231 static bool use_ssl_; | 232 static bool use_ssl_; |
232 }; | 233 }; |
233 | 234 |
234 } // namespace net | 235 } // namespace net |
235 | 236 |
236 #endif // NET_FLIP_FLIP_SESSION_H_ | 237 #endif // NET_FLIP_FLIP_SESSION_H_ |
OLD | NEW |