Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: net/socket/buffered_write_stream_socket.h

Issue 275953002: Remove HTTP pipelining support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix line endings Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/net.gypi ('k') | net/socket/buffered_write_stream_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "net/base/net_log.h"
12 #include "net/socket/stream_socket.h"
13
14 namespace base {
15 class TimeDelta;
16 }
17
18 namespace net {
19
20 class AddressList;
21 class GrowableIOBuffer;
22 class IPEndPoint;
23
24 // A StreamSocket decorator. All functions are passed through to the wrapped
25 // socket, except for Write().
26 //
27 // Writes are buffered locally so that multiple Write()s to this class are
28 // issued as only one Write() to the wrapped socket. This is useful to force
29 // multiple requests to be issued in a single packet, as is needed to trigger
30 // edge cases in HTTP pipelining.
31 //
32 // Note that the Write() always returns synchronously. It will either buffer the
33 // entire input or return the most recently reported error.
34 //
35 // There are no bounds on the local buffer size. Use carefully.
36 class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket {
37 public:
38 explicit BufferedWriteStreamSocket(scoped_ptr<StreamSocket> socket_to_wrap);
39 virtual ~BufferedWriteStreamSocket();
40
41 // Socket interface
42 virtual int Read(IOBuffer* buf, int buf_len,
43 const CompletionCallback& callback) OVERRIDE;
44 virtual int Write(IOBuffer* buf, int buf_len,
45 const CompletionCallback& callback) OVERRIDE;
46 virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
47 virtual int SetSendBufferSize(int32 size) OVERRIDE;
48
49 // StreamSocket interface
50 virtual int Connect(const CompletionCallback& callback) OVERRIDE;
51 virtual void Disconnect() OVERRIDE;
52 virtual bool IsConnected() const OVERRIDE;
53 virtual bool IsConnectedAndIdle() const OVERRIDE;
54 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
55 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
56 virtual const BoundNetLog& NetLog() const OVERRIDE;
57 virtual void SetSubresourceSpeculation() OVERRIDE;
58 virtual void SetOmniboxSpeculation() OVERRIDE;
59 virtual bool WasEverUsed() const OVERRIDE;
60 virtual bool UsingTCPFastOpen() const OVERRIDE;
61 virtual bool WasNpnNegotiated() const OVERRIDE;
62 virtual NextProto GetNegotiatedProtocol() const OVERRIDE;
63 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
64
65 private:
66 void DoDelayedWrite();
67 void OnIOComplete(int result);
68
69 scoped_ptr<StreamSocket> wrapped_socket_;
70 scoped_refptr<GrowableIOBuffer> io_buffer_;
71 scoped_refptr<GrowableIOBuffer> backup_buffer_;
72 bool callback_pending_;
73 bool wrapped_write_in_progress_;
74 int error_;
75
76 base::WeakPtrFactory<BufferedWriteStreamSocket> weak_factory_;
77
78 DISALLOW_COPY_AND_ASSIGN(BufferedWriteStreamSocket);
79 };
80
81 } // namespace net
82
83 #endif // NET_SOCKET_STREAM_SOCKET_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/socket/buffered_write_stream_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698