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

Side by Side Diff: net/quic/quic_reliable_client_stream.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/quic/quic_received_packet_manager_test.cc ('k') | net/quic/quic_reliable_client_stream.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 // NOTE: This code is not shared between Google and Chrome.
6
7 #ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
8 #define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
9
10 #include "net/base/ip_endpoint.h"
11 #include "net/base/upload_data_stream.h"
12 #include "net/http/http_request_info.h"
13 #include "net/http/http_response_info.h"
14 #include "net/http/http_stream.h"
15 #include "net/quic/quic_data_stream.h"
16
17 namespace net {
18
19 class QuicClientSession;
20
21 // A client-initiated ReliableQuicStream. Instances of this class
22 // are owned by the QuicClientSession which created them.
23 class NET_EXPORT_PRIVATE QuicReliableClientStream : public QuicDataStream {
24 public:
25 // Delegate handles protocol specific behavior of a quic stream.
26 class NET_EXPORT_PRIVATE Delegate {
27 public:
28 Delegate() {}
29
30 // Called when data is received.
31 // Returns network error code. OK when it successfully receives data.
32 virtual int OnDataReceived(const char* data, int length) = 0;
33
34 // Called when the stream is closed by the peer.
35 virtual void OnClose(QuicErrorCode error) = 0;
36
37 // Called when the stream is closed because of an error.
38 virtual void OnError(int error) = 0;
39
40 // Returns true if sending of headers has completed.
41 virtual bool HasSendHeadersComplete() = 0;
42
43 protected:
44 virtual ~Delegate() {}
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(Delegate);
48 };
49
50 QuicReliableClientStream(QuicStreamId id,
51 QuicSession* session,
52 const BoundNetLog& net_log);
53
54 ~QuicReliableClientStream() override;
55
56 // QuicDataStream
57 uint32 ProcessData(const char* data, uint32 data_len) override;
58 void OnClose() override;
59 void OnCanWrite() override;
60 QuicPriority EffectivePriority() const override;
61
62 // While the server's set_priority shouldn't be called externally, the creator
63 // of client-side streams should be able to set the priority.
64 using QuicDataStream::set_priority;
65
66 int WriteStreamData(base::StringPiece data,
67 bool fin,
68 const CompletionCallback& callback);
69 // Set new |delegate|. |delegate| must not be NULL.
70 // If this stream has already received data, OnDataReceived() will be
71 // called on the delegate.
72 void SetDelegate(Delegate* delegate);
73 Delegate* GetDelegate() { return delegate_; }
74 void OnError(int error);
75
76 // Returns true if the stream can possible write data. (The socket may
77 // turn out to be write blocked, of course). If the stream can not write,
78 // this method returns false, and |callback| will be invoked when
79 // it becomes writable.
80 bool CanWrite(const CompletionCallback& callback);
81
82 const BoundNetLog& net_log() const { return net_log_; }
83
84 using QuicDataStream::HasBufferedData;
85
86 private:
87 BoundNetLog net_log_;
88 Delegate* delegate_;
89
90 CompletionCallback callback_;
91
92 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream);
93 };
94
95 } // namespace net
96
97 #endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_received_packet_manager_test.cc ('k') | net/quic/quic_reliable_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698