OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
6 #define NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 6 #define NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | |
13 | 12 |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
16 #include "net/spdy/header_coalescer.h" | 15 #include "net/spdy/header_coalescer.h" |
| 16 #include "net/spdy/platform/api/spdy_string.h" |
17 #include "net/spdy/platform/api/spdy_string_piece.h" | 17 #include "net/spdy/platform/api/spdy_string_piece.h" |
18 #include "net/spdy/spdy_alt_svc_wire_format.h" | 18 #include "net/spdy/spdy_alt_svc_wire_format.h" |
19 #include "net/spdy/spdy_framer.h" | 19 #include "net/spdy/spdy_framer.h" |
20 #include "net/spdy/spdy_header_block.h" | 20 #include "net/spdy/spdy_header_block.h" |
21 #include "net/spdy/spdy_protocol.h" | 21 #include "net/spdy/spdy_protocol.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class NET_EXPORT_PRIVATE BufferedSpdyFramerVisitorInterface { | 25 class NET_EXPORT_PRIVATE BufferedSpdyFramerVisitorInterface { |
26 public: | 26 public: |
27 BufferedSpdyFramerVisitorInterface() {} | 27 BufferedSpdyFramerVisitorInterface() {} |
28 | 28 |
29 // Called if an error is detected in the SpdySerializedFrame protocol. | 29 // Called if an error is detected in the SpdySerializedFrame protocol. |
30 virtual void OnError(SpdyFramer::SpdyFramerError spdy_framer_error) = 0; | 30 virtual void OnError(SpdyFramer::SpdyFramerError spdy_framer_error) = 0; |
31 | 31 |
32 // Called if an error is detected in a HTTP2 stream. | 32 // Called if an error is detected in a HTTP2 stream. |
33 virtual void OnStreamError(SpdyStreamId stream_id, | 33 virtual void OnStreamError(SpdyStreamId stream_id, |
34 const std::string& description) = 0; | 34 const SpdyString& description) = 0; |
35 | 35 |
36 // Called after all the header data for HEADERS control frame is received. | 36 // Called after all the header data for HEADERS control frame is received. |
37 virtual void OnHeaders(SpdyStreamId stream_id, | 37 virtual void OnHeaders(SpdyStreamId stream_id, |
38 bool has_priority, | 38 bool has_priority, |
39 int weight, | 39 int weight, |
40 SpdyStreamId parent_stream_id, | 40 SpdyStreamId parent_stream_id, |
41 bool exclusive, | 41 bool exclusive, |
42 bool fin, | 42 bool fin, |
43 SpdyHeaderBlock headers) = 0; | 43 SpdyHeaderBlock headers) = 0; |
44 | 44 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 bool exclusive; | 254 bool exclusive; |
255 bool fin; | 255 bool fin; |
256 bool unidirectional; | 256 bool unidirectional; |
257 }; | 257 }; |
258 std::unique_ptr<ControlFrameFields> control_frame_fields_; | 258 std::unique_ptr<ControlFrameFields> control_frame_fields_; |
259 | 259 |
260 // Collection of fields of a GOAWAY frame that this class needs to buffer. | 260 // Collection of fields of a GOAWAY frame that this class needs to buffer. |
261 struct GoAwayFields { | 261 struct GoAwayFields { |
262 SpdyStreamId last_accepted_stream_id; | 262 SpdyStreamId last_accepted_stream_id; |
263 SpdyErrorCode error_code; | 263 SpdyErrorCode error_code; |
264 std::string debug_data; | 264 SpdyString debug_data; |
265 | 265 |
266 // Returns the estimate of dynamically allocated memory in bytes. | 266 // Returns the estimate of dynamically allocated memory in bytes. |
267 size_t EstimateMemoryUsage() const; | 267 size_t EstimateMemoryUsage() const; |
268 }; | 268 }; |
269 std::unique_ptr<GoAwayFields> goaway_fields_; | 269 std::unique_ptr<GoAwayFields> goaway_fields_; |
270 | 270 |
271 std::unique_ptr<HeaderCoalescer> coalescer_; | 271 std::unique_ptr<HeaderCoalescer> coalescer_; |
272 | 272 |
273 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 273 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
274 }; | 274 }; |
275 | 275 |
276 } // namespace net | 276 } // namespace net |
277 | 277 |
278 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 278 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |