OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ | |
6 #define NET_SOCKET_BUFFERED_WRITE_STREAM_SOCKET_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "net/base/net_log.h" | |
11 #include "net/socket/stream_socket.h" | |
12 | |
13 namespace base { | |
14 class TimeDelta; | |
15 } | |
16 | |
17 namespace net { | |
18 | |
19 class AddressList; | |
20 class GrowableIOBuffer; | |
21 class IPEndPoint; | |
22 | |
23 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.
| |
24 public: | |
25 BufferedWriteStreamSocket(StreamSocket* socket_to_wrap); | |
26 virtual ~BufferedWriteStreamSocket(); | |
27 | |
28 // Socket interface | |
29 virtual int Read(IOBuffer* buf, int buf_len, | |
30 const CompletionCallback& callback) OVERRIDE; | |
31 virtual int Write(IOBuffer* buf, int buf_len, | |
32 const CompletionCallback& callback) OVERRIDE; | |
33 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | |
34 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | |
35 | |
36 // StreamSocket interface | |
37 virtual int Connect(const CompletionCallback& callback) OVERRIDE; | |
38 virtual void Disconnect() OVERRIDE; | |
39 virtual bool IsConnected() const OVERRIDE; | |
40 virtual bool IsConnectedAndIdle() const OVERRIDE; | |
41 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; | |
42 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | |
43 virtual const BoundNetLog& NetLog() const OVERRIDE; | |
44 virtual void SetSubresourceSpeculation() OVERRIDE; | |
45 virtual void SetOmniboxSpeculation() OVERRIDE; | |
46 virtual bool WasEverUsed() const OVERRIDE; | |
47 virtual bool UsingTCPFastOpen() const OVERRIDE; | |
48 virtual int64 NumBytesRead() const OVERRIDE; | |
49 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | |
50 | |
51 private: | |
52 void DoDelayedWrite(); | |
53 void OnIOComplete(int result); | |
54 | |
55 scoped_ptr<StreamSocket> wrapped_socket_; | |
56 scoped_refptr<GrowableIOBuffer> io_buffer_; | |
57 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_; | |
58 bool pending_callback_; | |
59 int error_; | |
60 }; | |
61 | |
62 } // namespace net | |
63 | |
64 #endif // NET_SOCKET_STREAM_SOCKET_H_ | |
OLD | NEW |