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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 81 // Returns the allocation size estimate in bytes. |
82 size_t GetAllocationSize() const; | 82 size_t GetAllocationSize() const; |
83 | 83 |
84 private: | 84 private: |
85 int BIORead(char* out, int len); | 85 int BIORead(char* out, int len); |
86 void HandleSocketReadResult(int result); | 86 void HandleSocketReadResult(int result); |
87 void OnSocketReadComplete(int result); | 87 void OnSocketReadComplete(int result); |
| 88 void OnSocketReadIfReadyComplete(int result); |
88 | 89 |
89 int BIOWrite(const char* in, int len); | 90 int BIOWrite(const char* in, int len); |
90 void SocketWrite(); | 91 void SocketWrite(); |
91 void HandleSocketWriteResult(int result); | 92 void HandleSocketWriteResult(int result); |
92 void OnSocketWriteComplete(int result); | 93 void OnSocketWriteComplete(int result); |
93 void CallOnReadReady(); | 94 void CallOnReadReady(); |
94 | 95 |
95 static SocketBIOAdapter* GetAdapter(BIO* bio); | 96 static SocketBIOAdapter* GetAdapter(BIO* bio); |
96 static int BIOReadWrapper(BIO* bio, char* out, int len); | 97 static int BIOReadWrapper(BIO* bio, char* out, int len); |
97 static int BIOWriteWrapper(BIO* bio, const char* in, int len); | 98 static int BIOWriteWrapper(BIO* bio, const char* in, int len); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Delegate* delegate_; | 137 Delegate* delegate_; |
137 | 138 |
138 base::WeakPtrFactory<SocketBIOAdapter> weak_factory_; | 139 base::WeakPtrFactory<SocketBIOAdapter> weak_factory_; |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(SocketBIOAdapter); | 141 DISALLOW_COPY_AND_ASSIGN(SocketBIOAdapter); |
141 }; | 142 }; |
142 | 143 |
143 } // namespace net | 144 } // namespace net |
144 | 145 |
145 #endif // NET_SOCKET_SOCKET_BIO_ADAPTER_H_ | 146 #endif // NET_SOCKET_SOCKET_BIO_ADAPTER_H_ |
OLD | NEW |