| 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_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ | 5 #ifndef NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ |
| 6 #define NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ | 6 #define NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
| 10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // issued as only one Write() to the wrapped socket. This is useful to force | 26 // issued as only one Write() to the wrapped socket. This is useful to force |
| 27 // multiple requests to be issued in a single packet, as is needed to trigger | 27 // multiple requests to be issued in a single packet, as is needed to trigger |
| 28 // edge cases in HTTP pipelining. | 28 // edge cases in HTTP pipelining. |
| 29 // | 29 // |
| 30 // Note that the Write() always returns synchronously. It will either buffer the | 30 // Note that the Write() always returns synchronously. It will either buffer the |
| 31 // entire input or return the most recently reported error. | 31 // entire input or return the most recently reported error. |
| 32 // | 32 // |
| 33 // There are no bounds on the local buffer size. Use carefully. | 33 // There are no bounds on the local buffer size. Use carefully. |
| 34 class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket { | 34 class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket { |
| 35 public: | 35 public: |
| 36 BufferedWriteStreamSocket(StreamSocket* socket_to_wrap); | 36 explicit BufferedWriteStreamSocket(StreamSocket* socket_to_wrap); |
| 37 virtual ~BufferedWriteStreamSocket(); | 37 virtual ~BufferedWriteStreamSocket(); |
| 38 | 38 |
| 39 // Socket interface | 39 // Socket interface |
| 40 virtual int Read(IOBuffer* buf, int buf_len, | 40 virtual int Read(IOBuffer* buf, int buf_len, |
| 41 const CompletionCallback& callback) OVERRIDE; | 41 const CompletionCallback& callback) OVERRIDE; |
| 42 virtual int Write(IOBuffer* buf, int buf_len, | 42 virtual int Write(IOBuffer* buf, int buf_len, |
| 43 const CompletionCallback& callback) OVERRIDE; | 43 const CompletionCallback& callback) OVERRIDE; |
| 44 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 44 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 45 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 45 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 46 | 46 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 scoped_refptr<GrowableIOBuffer> backup_buffer_; | 71 scoped_refptr<GrowableIOBuffer> backup_buffer_; |
| 72 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; | 72 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; |
| 73 bool callback_pending_; | 73 bool callback_pending_; |
| 74 bool wrapped_write_in_progress_; | 74 bool wrapped_write_in_progress_; |
| 75 int error_; | 75 int error_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace net | 78 } // namespace net |
| 79 | 79 |
| 80 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 80 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
| OLD | NEW |