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

Side by Side Diff: net/quic/quic_headers_stream.cc

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_headers_stream.h ('k') | net/quic/quic_http_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "net/quic/quic_headers_stream.h" 5 #include "net/quic/quic_headers_stream.h"
6 6
7 #include "net/quic/quic_session.h" 7 #include "net/quic/quic_session.h"
8 8
9 using base::StringPiece; 9 using base::StringPiece;
10 10
11 namespace net { 11 namespace net {
12 12
13 namespace { 13 namespace {
14 14
15 const QuicStreamId kInvalidStreamId = 0; 15 const QuicStreamId kInvalidStreamId = 0;
16 16
17 } // namespace 17 } // namespace
18 18
19 // A SpdyFramer visitor which passed SYN_STREAM and SYN_REPLY frames to 19 // A SpdyFramer visitor which passed SYN_STREAM and SYN_REPLY frames to
20 // the QuicDataStream, and closes the connection if any unexpected frames 20 // the QuicDataStream, and closes the connection if any unexpected frames
21 // are received. 21 // are received.
22 class QuicHeadersStream::SpdyFramerVisitor 22 class QuicHeadersStream::SpdyFramerVisitor
23 : public SpdyFramerVisitorInterface, 23 : public SpdyFramerVisitorInterface,
24 public SpdyFramerDebugVisitorInterface { 24 public SpdyFramerDebugVisitorInterface {
25 public: 25 public:
26 explicit SpdyFramerVisitor(QuicHeadersStream* stream) : stream_(stream) {} 26 explicit SpdyFramerVisitor(QuicHeadersStream* stream) : stream_(stream) {}
27 27
28 // SpdyFramerVisitorInterface implementation 28 // SpdyFramerVisitorInterface implementation
29 virtual void OnSynStream(SpdyStreamId stream_id, 29 void OnSynStream(SpdyStreamId stream_id,
30 SpdyStreamId associated_stream_id, 30 SpdyStreamId associated_stream_id,
31 SpdyPriority priority, 31 SpdyPriority priority,
32 bool fin, 32 bool fin,
33 bool unidirectional) override { 33 bool unidirectional) override {
34 if (!stream_->IsConnected()) { 34 if (!stream_->IsConnected()) {
35 return; 35 return;
36 } 36 }
37 37
38 if (associated_stream_id != 0) { 38 if (associated_stream_id != 0) {
39 CloseConnection("associated_stream_id != 0"); 39 CloseConnection("associated_stream_id != 0");
40 return; 40 return;
41 } 41 }
42 42
43 if (unidirectional != 0) { 43 if (unidirectional != 0) {
44 CloseConnection("unidirectional != 0"); 44 CloseConnection("unidirectional != 0");
45 return; 45 return;
46 } 46 }
47 47
48 stream_->OnSynStream(stream_id, priority, fin); 48 stream_->OnSynStream(stream_id, priority, fin);
49 } 49 }
50 50
51 virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override { 51 void OnSynReply(SpdyStreamId stream_id, bool fin) override {
52 if (!stream_->IsConnected()) { 52 if (!stream_->IsConnected()) {
53 return; 53 return;
54 } 54 }
55 55
56 stream_->OnSynReply(stream_id, fin); 56 stream_->OnSynReply(stream_id, fin);
57 } 57 }
58 58
59 virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, 59 bool OnControlFrameHeaderData(SpdyStreamId stream_id,
60 const char* header_data, 60 const char* header_data,
61 size_t len) override { 61 size_t len) override {
62 if (!stream_->IsConnected()) { 62 if (!stream_->IsConnected()) {
63 return false; 63 return false;
64 } 64 }
65 stream_->OnControlFrameHeaderData(stream_id, header_data, len); 65 stream_->OnControlFrameHeaderData(stream_id, header_data, len);
66 return true; 66 return true;
67 } 67 }
68 68
69 virtual void OnStreamFrameData(SpdyStreamId stream_id, 69 void OnStreamFrameData(SpdyStreamId stream_id,
70 const char* data, 70 const char* data,
71 size_t len, 71 size_t len,
72 bool fin) override { 72 bool fin) override {
73 if (fin && len == 0) { 73 if (fin && len == 0) {
74 // The framer invokes OnStreamFrameData with zero-length data and 74 // The framer invokes OnStreamFrameData with zero-length data and
75 // fin = true after processing a SYN_STREAM or SYN_REPLY frame 75 // fin = true after processing a SYN_STREAM or SYN_REPLY frame
76 // that had the fin bit set. 76 // that had the fin bit set.
77 return; 77 return;
78 } 78 }
79 CloseConnection("SPDY DATA frame received."); 79 CloseConnection("SPDY DATA frame received.");
80 } 80 }
81 81
82 virtual void OnError(SpdyFramer* framer) override { 82 void OnError(SpdyFramer* framer) override {
83 CloseConnection("SPDY framing error."); 83 CloseConnection("SPDY framing error.");
84 } 84 }
85 85
86 virtual void OnDataFrameHeader(SpdyStreamId stream_id, 86 void OnDataFrameHeader(SpdyStreamId stream_id,
87 size_t length, 87 size_t length,
88 bool fin) override { 88 bool fin) override {
89 CloseConnection("SPDY DATA frame received."); 89 CloseConnection("SPDY DATA frame received.");
90 } 90 }
91 91
92 virtual void OnRstStream(SpdyStreamId stream_id, 92 void OnRstStream(SpdyStreamId stream_id,
93 SpdyRstStreamStatus status) override { 93 SpdyRstStreamStatus status) override {
94 CloseConnection("SPDY RST_STREAM frame received."); 94 CloseConnection("SPDY RST_STREAM frame received.");
95 } 95 }
96 96
97 virtual void OnSetting(SpdySettingsIds id, 97 void OnSetting(SpdySettingsIds id, uint8 flags, uint32 value) override {
98 uint8 flags,
99 uint32 value) override {
100 CloseConnection("SPDY SETTINGS frame received."); 98 CloseConnection("SPDY SETTINGS frame received.");
101 } 99 }
102 100
103 virtual void OnSettingsAck() override { 101 void OnSettingsAck() override {
104 CloseConnection("SPDY SETTINGS frame received."); 102 CloseConnection("SPDY SETTINGS frame received.");
105 } 103 }
106 104
107 virtual void OnSettingsEnd() override { 105 void OnSettingsEnd() override {
108 CloseConnection("SPDY SETTINGS frame received."); 106 CloseConnection("SPDY SETTINGS frame received.");
109 } 107 }
110 108
111 virtual void OnPing(SpdyPingId unique_id, bool is_ack) override { 109 void OnPing(SpdyPingId unique_id, bool is_ack) override {
112 CloseConnection("SPDY PING frame received."); 110 CloseConnection("SPDY PING frame received.");
113 } 111 }
114 112
115 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, 113 void OnGoAway(SpdyStreamId last_accepted_stream_id,
116 SpdyGoAwayStatus status) override { 114 SpdyGoAwayStatus status) override {
117 CloseConnection("SPDY GOAWAY frame received."); 115 CloseConnection("SPDY GOAWAY frame received.");
118 } 116 }
119 117
120 virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override { 118 void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override {
121 CloseConnection("SPDY HEADERS frame received."); 119 CloseConnection("SPDY HEADERS frame received.");
122 } 120 }
123 121
124 virtual void OnWindowUpdate(SpdyStreamId stream_id, 122 void OnWindowUpdate(SpdyStreamId stream_id,
125 uint32 delta_window_size) override { 123 uint32 delta_window_size) override {
126 CloseConnection("SPDY WINDOW_UPDATE frame received."); 124 CloseConnection("SPDY WINDOW_UPDATE frame received.");
127 } 125 }
128 126
129 virtual void OnPushPromise(SpdyStreamId stream_id, 127 void OnPushPromise(SpdyStreamId stream_id,
130 SpdyStreamId promised_stream_id, 128 SpdyStreamId promised_stream_id,
131 bool end) override { 129 bool end) override {
132 LOG(DFATAL) << "PUSH_PROMISE frame received from a SPDY/3 framer"; 130 LOG(DFATAL) << "PUSH_PROMISE frame received from a SPDY/3 framer";
133 CloseConnection("SPDY PUSH_PROMISE frame received."); 131 CloseConnection("SPDY PUSH_PROMISE frame received.");
134 } 132 }
135 133
136 virtual void OnContinuation(SpdyStreamId stream_id, bool end) override { 134 void OnContinuation(SpdyStreamId stream_id, bool end) override {
137 CloseConnection("SPDY CONTINUATION frame received."); 135 CloseConnection("SPDY CONTINUATION frame received.");
138 } 136 }
139 137
140 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { 138 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override {
141 CloseConnection("SPDY unknown frame received."); 139 CloseConnection("SPDY unknown frame received.");
142 return false; 140 return false;
143 } 141 }
144 142
145 // SpdyFramerDebugVisitorInterface implementation 143 // SpdyFramerDebugVisitorInterface implementation
146 virtual void OnSendCompressedFrame(SpdyStreamId stream_id, 144 void OnSendCompressedFrame(SpdyStreamId stream_id,
147 SpdyFrameType type, 145 SpdyFrameType type,
148 size_t payload_len, 146 size_t payload_len,
149 size_t frame_len) override {} 147 size_t frame_len) override {}
150 148
151 virtual void OnReceiveCompressedFrame(SpdyStreamId stream_id, 149 void OnReceiveCompressedFrame(SpdyStreamId stream_id,
152 SpdyFrameType type, 150 SpdyFrameType type,
153 size_t frame_len) override { 151 size_t frame_len) override {
154 if (stream_->IsConnected()) { 152 if (stream_->IsConnected()) {
155 stream_->OnCompressedFrameSize(frame_len); 153 stream_->OnCompressedFrameSize(frame_len);
156 } 154 }
157 } 155 }
158 156
159 private: 157 private:
160 void CloseConnection(const string& details) { 158 void CloseConnection(const string& details) {
161 if (stream_->IsConnected()) { 159 if (stream_->IsConnected()) {
162 stream_->CloseConnectionWithDetails( 160 stream_->CloseConnectionWithDetails(
163 QUIC_INVALID_HEADERS_STREAM_DATA, details); 161 QUIC_INVALID_HEADERS_STREAM_DATA, details);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 DCHECK_EQ(kInvalidStreamId, stream_id_); 265 DCHECK_EQ(kInvalidStreamId, stream_id_);
268 DCHECK_EQ(0u, frame_len_); 266 DCHECK_EQ(0u, frame_len_);
269 frame_len_ = frame_len; 267 frame_len_ = frame_len;
270 } 268 }
271 269
272 bool QuicHeadersStream::IsConnected() { 270 bool QuicHeadersStream::IsConnected() {
273 return session()->connection()->connected(); 271 return session()->connection()->connected();
274 } 272 }
275 273
276 } // namespace net 274 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream.h ('k') | net/quic/quic_http_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698