Chromium Code Reviews| Index: net/socket/buffered_write_stream_socket.h |
| diff --git a/net/socket/buffered_write_stream_socket.h b/net/socket/buffered_write_stream_socket.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9a01a357070d60be05b27c788666691171af3ff4 |
| --- /dev/null |
| +++ b/net/socket/buffered_write_stream_socket.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ |
| +#define NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ |
| +#pragma once |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "net/base/net_log.h" |
| +#include "net/socket/stream_socket.h" |
| + |
| +namespace base { |
| +class TimeDelta; |
| +} |
| + |
| +namespace net { |
| + |
| +class AddressList; |
| +class GrowableIOBuffer; |
| +class IPEndPoint; |
| + |
| +class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket { |
|
mmenke
2012/02/24 16:36:39
Think think class warrants a short description.
James Simonsen
2012/02/24 23:58:51
Done.
|
| + public: |
| + BufferedWriteStreamSocket(StreamSocket* socket_to_wrap); |
| + virtual ~BufferedWriteStreamSocket(); |
| + |
| + // Socket interface |
| + virtual int Read(IOBuffer* buf, int buf_len, |
| + const CompletionCallback& callback) OVERRIDE; |
| + virtual int Write(IOBuffer* buf, int buf_len, |
| + const CompletionCallback& callback) OVERRIDE; |
| + virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| + virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| + |
| + // StreamSocket interface |
| + virtual int Connect(const CompletionCallback& callback) OVERRIDE; |
| + virtual void Disconnect() OVERRIDE; |
| + virtual bool IsConnected() const OVERRIDE; |
| + virtual bool IsConnectedAndIdle() const OVERRIDE; |
| + virtual int GetPeerAddress(AddressList* address) const OVERRIDE; |
| + virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
| + virtual const BoundNetLog& NetLog() const OVERRIDE; |
| + virtual void SetSubresourceSpeculation() OVERRIDE; |
| + virtual void SetOmniboxSpeculation() OVERRIDE; |
| + virtual bool WasEverUsed() const OVERRIDE; |
| + virtual bool UsingTCPFastOpen() const OVERRIDE; |
| + virtual int64 NumBytesRead() const OVERRIDE; |
| + virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| + |
| + private: |
| + void DoDelayedWrite(); |
| + void OnIOComplete(int result); |
| + |
| + scoped_ptr<StreamSocket> wrapped_socket_; |
| + scoped_refptr<GrowableIOBuffer> io_buffer_; |
| + base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; |
| + bool pending_callback_; |
| + int error_; |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_SOCKET_STREAM_SOCKET_H_ |