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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 protected: | 85 protected: |
86 virtual ~BufferedSpdyFramerVisitorInterface() {} | 86 virtual ~BufferedSpdyFramerVisitorInterface() {} |
87 | 87 |
88 private: | 88 private: |
89 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramerVisitorInterface); | 89 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramerVisitorInterface); |
90 }; | 90 }; |
91 | 91 |
92 class NET_EXPORT_PRIVATE BufferedSpdyFramer | 92 class NET_EXPORT_PRIVATE BufferedSpdyFramer |
93 : public SpdyFramerVisitorInterface { | 93 : public SpdyFramerVisitorInterface { |
94 public: | 94 public: |
95 explicit BufferedSpdyFramer(int version); | 95 BufferedSpdyFramer(int version, |
| 96 bool enable_compression); |
96 virtual ~BufferedSpdyFramer(); | 97 virtual ~BufferedSpdyFramer(); |
97 | 98 |
98 // Sets callbacks to be called from the buffered spdy framer. A visitor must | 99 // Sets callbacks to be called from the buffered spdy framer. A visitor must |
99 // be set, or else the framer will likely crash. It is acceptable for the | 100 // be set, or else the framer will likely crash. It is acceptable for the |
100 // visitor to do nothing. If this is called multiple times, only the last | 101 // visitor to do nothing. If this is called multiple times, only the last |
101 // visitor will be used. | 102 // visitor will be used. |
102 void set_visitor(BufferedSpdyFramerVisitorInterface* visitor); | 103 void set_visitor(BufferedSpdyFramerVisitorInterface* visitor); |
103 | 104 |
104 // SpdyFramerVisitorInterface | 105 // SpdyFramerVisitorInterface |
105 virtual void OnError(SpdyFramer* spdy_framer) OVERRIDE; | 106 virtual void OnError(SpdyFramer* spdy_framer) OVERRIDE; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SpdyStreamId stream_id, | 172 SpdyStreamId stream_id, |
172 uint32 delta_window_size) const; | 173 uint32 delta_window_size) const; |
173 SpdyCredentialControlFrame* CreateCredentialFrame( | 174 SpdyCredentialControlFrame* CreateCredentialFrame( |
174 const SpdyCredential& credential) const; | 175 const SpdyCredential& credential) const; |
175 SpdyDataFrame* CreateDataFrame(SpdyStreamId stream_id, | 176 SpdyDataFrame* CreateDataFrame(SpdyStreamId stream_id, |
176 const char* data, | 177 const char* data, |
177 uint32 len, | 178 uint32 len, |
178 SpdyDataFlags flags); | 179 SpdyDataFlags flags); |
179 SpdyPriority GetHighestPriority() const; | 180 SpdyPriority GetHighestPriority() const; |
180 bool IsCompressible(const SpdyFrame& frame) const; | 181 bool IsCompressible(const SpdyFrame& frame) const; |
181 // Specify if newly created SpdySessions should have compression enabled. | |
182 static void set_enable_compression_default(bool value); | |
183 | 182 |
184 int frames_received() const { return frames_received_; } | 183 int frames_received() const { return frames_received_; } |
185 | 184 |
186 private: | 185 private: |
187 // The size of the header_buffer_. | 186 // The size of the header_buffer_. |
188 enum { kHeaderBufferSize = 32 * 1024 }; | 187 enum { kHeaderBufferSize = 32 * 1024 }; |
189 | 188 |
190 void InitHeaderStreaming(SpdyStreamId stream_id); | 189 void InitHeaderStreaming(SpdyStreamId stream_id); |
191 | 190 |
192 SpdyFramer spdy_framer_; | 191 SpdyFramer spdy_framer_; |
(...skipping 18 matching lines...) Expand all Loading... |
211 bool unidirectional; | 210 bool unidirectional; |
212 }; | 211 }; |
213 scoped_ptr<ControlFrameFields> control_frame_fields_; | 212 scoped_ptr<ControlFrameFields> control_frame_fields_; |
214 | 213 |
215 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 214 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
216 }; | 215 }; |
217 | 216 |
218 } // namespace net | 217 } // namespace net |
219 | 218 |
220 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 219 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |