| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // Cancels any pending stream creation request. May be called | 184 // Cancels any pending stream creation request. May be called |
| 185 // repeatedly. | 185 // repeatedly. |
| 186 void CancelRequest(); | 186 void CancelRequest(); |
| 187 | 187 |
| 188 // Transfers the created stream (guaranteed to not be NULL) to the | 188 // Transfers the created stream (guaranteed to not be NULL) to the |
| 189 // caller. Must be called at most once after StartRequest() returns | 189 // caller. Must be called at most once after StartRequest() returns |
| 190 // OK or |callback| is called with OK. The caller must immediately | 190 // OK or |callback| is called with OK. The caller must immediately |
| 191 // set a delegate for the returned stream (except for test code). | 191 // set a delegate for the returned stream (except for test code). |
| 192 base::WeakPtr<SpdyStream> ReleaseStream(); | 192 base::WeakPtr<SpdyStream> ReleaseStream(); |
| 193 | 193 |
| 194 // Returns the estimate of dynamically allocated memory in bytes. |
| 195 size_t EstimateMemoryUsage() const; |
| 196 |
| 194 private: | 197 private: |
| 195 friend class SpdySession; | 198 friend class SpdySession; |
| 196 | 199 |
| 197 // Called by |session_| when the stream attempt has finished | 200 // Called by |session_| when the stream attempt has finished |
| 198 // successfully. | 201 // successfully. |
| 199 void OnRequestCompleteSuccess(const base::WeakPtr<SpdyStream>& stream); | 202 void OnRequestCompleteSuccess(const base::WeakPtr<SpdyStream>& stream); |
| 200 | 203 |
| 201 // Called by |session_| when the stream attempt has finished with an | 204 // Called by |session_| when the stream attempt has finished with an |
| 202 // error. Also called with ERR_ABORTED if |session_| is destroyed | 205 // error. Also called with ERR_ABORTED if |session_| is destroyed |
| 203 // while the stream attempt is still pending. | 206 // while the stream attempt is still pending. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // Must be used only by |pool_|. | 561 // Must be used only by |pool_|. |
| 559 base::WeakPtr<SpdySession> GetWeakPtr(); | 562 base::WeakPtr<SpdySession> GetWeakPtr(); |
| 560 | 563 |
| 561 // HigherLayeredPool implementation: | 564 // HigherLayeredPool implementation: |
| 562 bool CloseOneIdleConnection() override; | 565 bool CloseOneIdleConnection() override; |
| 563 | 566 |
| 564 // Dumps memory allocation stats to |stats|. Sets |*is_session_active| to | 567 // Dumps memory allocation stats to |stats|. Sets |*is_session_active| to |
| 565 // indicate whether session is active. | 568 // indicate whether session is active. |
| 566 // |stats| can be assumed as being default initialized upon entry. | 569 // |stats| can be assumed as being default initialized upon entry. |
| 567 // Implementation overrides fields in |stats|. | 570 // Implementation overrides fields in |stats|. |
| 568 void DumpMemoryStats(StreamSocket::SocketMemoryStats* stats, | 571 // Returns the estimate of dynamically allocated memory in bytes, which |
| 569 bool* is_session_active) const; | 572 // includes the size attributed to the underlying socket. |
| 573 size_t DumpMemoryStats(StreamSocket::SocketMemoryStats* stats, |
| 574 bool* is_session_active) const; |
| 570 | 575 |
| 571 private: | 576 private: |
| 572 friend class test::SpdyStreamTest; | 577 friend class test::SpdyStreamTest; |
| 573 friend class base::RefCounted<SpdySession>; | 578 friend class base::RefCounted<SpdySession>; |
| 574 friend class HttpNetworkTransactionTest; | 579 friend class HttpNetworkTransactionTest; |
| 575 friend class HttpProxyClientSocketPoolTest; | 580 friend class HttpProxyClientSocketPoolTest; |
| 576 friend class SpdyHttpStreamTest; | 581 friend class SpdyHttpStreamTest; |
| 577 friend class SpdyNetworkTransactionTest; | 582 friend class SpdyNetworkTransactionTest; |
| 578 friend class SpdyProxyClientSocketTest; | 583 friend class SpdyProxyClientSocketTest; |
| 579 friend class SpdySessionTest; | 584 friend class SpdySessionTest; |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 // Used for posting asynchronous IO tasks. We use this even though | 1216 // Used for posting asynchronous IO tasks. We use this even though |
| 1212 // SpdySession is refcounted because we don't need to keep the SpdySession | 1217 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1213 // alive if the last reference is within a RunnableMethod. Just revoke the | 1218 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1214 // method. | 1219 // method. |
| 1215 base::WeakPtrFactory<SpdySession> weak_factory_; | 1220 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1216 }; | 1221 }; |
| 1217 | 1222 |
| 1218 } // namespace net | 1223 } // namespace net |
| 1219 | 1224 |
| 1220 #endif // NET_SPDY_SPDY_SESSION_H_ | 1225 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |