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

Side by Side Diff: net/spdy/spdy_framer_decoder_adapter.h

Issue 2558243002: Add Http2FrameDecoderAdapter. (Closed)
Patch Set: Created 4 years 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/spdy/spdy_framer.cc ('k') | net/spdy/spdy_framer_test.cc » ('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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_SPDY_FRAMER_DECODER_ADAPTER_H_ 5 #ifndef NET_SPDY_SPDY_FRAMER_DECODER_ADAPTER_H_
6 #define NET_SPDY_SPDY_FRAMER_DECODER_ADAPTER_H_ 6 #define NET_SPDY_SPDY_FRAMER_DECODER_ADAPTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Sets whether or not ProcessInput returns after finishing a frame, or 47 // Sets whether or not ProcessInput returns after finishing a frame, or
48 // continues processing additional frames. Normally ProcessInput processes 48 // continues processing additional frames. Normally ProcessInput processes
49 // all input, but this method enables the caller (and visitor) to work with 49 // all input, but this method enables the caller (and visitor) to work with
50 // a single frame at a time (or that portion of the frame which is provided 50 // a single frame at a time (or that portion of the frame which is provided
51 // as input). Reset() does not change the value of this flag. 51 // as input). Reset() does not change the value of this flag.
52 virtual void set_process_single_input_frame(bool v); 52 virtual void set_process_single_input_frame(bool v);
53 bool process_single_input_frame() const { 53 bool process_single_input_frame() const {
54 return process_single_input_frame_; 54 return process_single_input_frame_;
55 } 55 }
56 56
57 // Decode the |len| bytes of encoded HTTP/2 starting at |*data|. Returns the 57 // Decode the |len| bytes of encoded HTTP/2 starting at |*data|. Returns
58 // number of bytes consumed. It is safe to pass more bytes in than may be 58 // the number of bytes consumed. It is safe to pass more bytes in than
59 // consumed. 59 // may be consumed. Should process (or otherwise buffer) as much as
60 // available, unless process_single_input_frame is true.
60 virtual size_t ProcessInput(const char* data, size_t len) = 0; 61 virtual size_t ProcessInput(const char* data, size_t len) = 0;
61 62
62 // Reset the decoder (used just for tests at this time). 63 // Reset the decoder (used just for tests at this time).
63 virtual void Reset() = 0; 64 virtual void Reset() = 0;
64 65
65 // Current state of the decoder. 66 // Current state of the decoder.
66 virtual SpdyFramer::SpdyState state() const = 0; 67 virtual SpdyFramer::SpdyState state() const = 0;
67 68
68 // Current error code (NO_ERROR if state != ERROR). 69 // Current error code (NO_ERROR if state != ERROR).
69 virtual SpdyFramer::SpdyError error_code() const = 0; 70 virtual SpdyFramer::SpdyError error_code() const = 0;
70 71
71 // Did the most recently decoded frame header appear to be the start of an 72 // Has any frame header looked like the start of an HTTP/1.1 (or earlier)
72 // HTTP/1.1 (or earlier) response? Used to detect if a backend/server that 73 // response? Used to detect if a backend/server that we sent a request to
73 // we sent a request to, responded with an HTTP/1.1 response? 74 // has responded with an HTTP/1.1 (or earlier) response.
74 virtual bool probable_http_response() const = 0; 75 virtual bool probable_http_response() const = 0;
75 76
76 private: 77 private:
77 SpdyFramerVisitorInterface* visitor_ = nullptr; 78 SpdyFramerVisitorInterface* visitor_ = nullptr;
78 SpdyFramerDebugVisitorInterface* debug_visitor_ = nullptr; 79 SpdyFramerDebugVisitorInterface* debug_visitor_ = nullptr;
79 bool process_single_input_frame_ = false; 80 bool process_single_input_frame_ = false;
80 }; 81 };
81 82
82 // Create an instance of NestedSpdyFramerDecoder, which implements 83 // Create an instance of NestedSpdyFramerDecoder, which implements
83 // SpdyFramerDecoderAdapter, delegating to a SpdyFramer instance that will 84 // SpdyFramerDecoderAdapter, delegating to a SpdyFramer instance that will
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 SpdyFramer* framer() const { return framer_; } 153 SpdyFramer* framer() const { return framer_; }
153 154
154 private: 155 private:
155 SpdyFramerVisitorInterface* const visitor_; 156 SpdyFramerVisitorInterface* const visitor_;
156 SpdyFramer* const framer_; 157 SpdyFramer* const framer_;
157 }; 158 };
158 159
159 } // namespace net 160 } // namespace net
160 161
161 #endif // NET_SPDY_SPDY_FRAMER_DECODER_ADAPTER_H_ 162 #endif // NET_SPDY_SPDY_FRAMER_DECODER_ADAPTER_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698