| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Note that the Write() always returns synchronously. It will either buffer the | 32 // Note that the Write() always returns synchronously. It will either buffer the |
| 33 // entire input or return the most recently reported error. | 33 // entire input or return the most recently reported error. |
| 34 // | 34 // |
| 35 // There are no bounds on the local buffer size. Use carefully. | 35 // There are no bounds on the local buffer size. Use carefully. |
| 36 class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket { | 36 class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket { |
| 37 public: | 37 public: |
| 38 explicit BufferedWriteStreamSocket(scoped_ptr<StreamSocket> socket_to_wrap); | 38 explicit BufferedWriteStreamSocket(scoped_ptr<StreamSocket> socket_to_wrap); |
| 39 virtual ~BufferedWriteStreamSocket(); | 39 virtual ~BufferedWriteStreamSocket(); |
| 40 | 40 |
| 41 // Socket interface | 41 // Socket interface |
| 42 virtual int Read(IOBuffer* buf, int buf_len, | 42 virtual int Read(IOBuffer* buf, |
| 43 int buf_len, |
| 43 const CompletionCallback& callback) OVERRIDE; | 44 const CompletionCallback& callback) OVERRIDE; |
| 44 virtual int Write(IOBuffer* buf, int buf_len, | 45 virtual int Write(IOBuffer* buf, |
| 46 int buf_len, |
| 45 const CompletionCallback& callback) OVERRIDE; | 47 const CompletionCallback& callback) OVERRIDE; |
| 46 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; | 48 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; |
| 47 virtual int SetSendBufferSize(int32 size) OVERRIDE; | 49 virtual int SetSendBufferSize(int32 size) OVERRIDE; |
| 48 | 50 |
| 49 // StreamSocket interface | 51 // StreamSocket interface |
| 50 virtual int Connect(const CompletionCallback& callback) OVERRIDE; | 52 virtual int Connect(const CompletionCallback& callback) OVERRIDE; |
| 51 virtual void Disconnect() OVERRIDE; | 53 virtual void Disconnect() OVERRIDE; |
| 52 virtual bool IsConnected() const OVERRIDE; | 54 virtual bool IsConnected() const OVERRIDE; |
| 53 virtual bool IsConnectedAndIdle() const OVERRIDE; | 55 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 54 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; | 56 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 int error_; | 76 int error_; |
| 75 | 77 |
| 76 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; | 78 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(BufferedWriteStreamSocket); | 80 DISALLOW_COPY_AND_ASSIGN(BufferedWriteStreamSocket); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace net | 83 } // namespace net |
| 82 | 84 |
| 83 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 85 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
| OLD | NEW |