| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SOCKET_SOCKET_BIO_ADAPTER_H_ | 5 #ifndef NET_SOCKET_SOCKET_BIO_ADAPTER_H_ |
| 6 #define NET_SOCKET_SOCKET_BIO_ADAPTER_H_ | 6 #define NET_SOCKET_SOCKET_BIO_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 int write_buffer_capacity, | 71 int write_buffer_capacity, |
| 72 Delegate* delegate); | 72 Delegate* delegate); |
| 73 ~SocketBIOAdapter(); | 73 ~SocketBIOAdapter(); |
| 74 | 74 |
| 75 BIO* bio() { return bio_.get(); } | 75 BIO* bio() { return bio_.get(); } |
| 76 | 76 |
| 77 // Returns true if any data has been read from the underlying StreamSocket, | 77 // Returns true if any data has been read from the underlying StreamSocket, |
| 78 // but not yet consumed by the BIO. | 78 // but not yet consumed by the BIO. |
| 79 bool HasPendingReadData(); | 79 bool HasPendingReadData(); |
| 80 | 80 |
| 81 // Returns the allocation size estimate in bytes. |
| 82 size_t GetAllocationSize() const; |
| 83 |
| 81 private: | 84 private: |
| 82 int BIORead(char* out, int len); | 85 int BIORead(char* out, int len); |
| 83 void HandleSocketReadResult(int result); | 86 void HandleSocketReadResult(int result); |
| 84 void OnSocketReadComplete(int result); | 87 void OnSocketReadComplete(int result); |
| 85 | 88 |
| 86 int BIOWrite(const char* in, int len); | 89 int BIOWrite(const char* in, int len); |
| 87 void SocketWrite(); | 90 void SocketWrite(); |
| 88 void HandleSocketWriteResult(int result); | 91 void HandleSocketWriteResult(int result); |
| 89 void OnSocketWriteComplete(int result); | 92 void OnSocketWriteComplete(int result); |
| 90 void CallOnReadReady(); | 93 void CallOnReadReady(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 Delegate* delegate_; | 136 Delegate* delegate_; |
| 134 | 137 |
| 135 base::WeakPtrFactory<SocketBIOAdapter> weak_factory_; | 138 base::WeakPtrFactory<SocketBIOAdapter> weak_factory_; |
| 136 | 139 |
| 137 DISALLOW_COPY_AND_ASSIGN(SocketBIOAdapter); | 140 DISALLOW_COPY_AND_ASSIGN(SocketBIOAdapter); |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 } // namespace net | 143 } // namespace net |
| 141 | 144 |
| 142 #endif // NET_SOCKET_SOCKET_BIO_ADAPTER_H_ | 145 #endif // NET_SOCKET_SOCKET_BIO_ADAPTER_H_ |
| OLD | NEW |