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

Unified Diff: net/spdy/spdy_framer.h

Issue 2566513004: This change removes SpdyFramer::set_enable_compression() in favor of a constructor parameter. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_frame_builder_test.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer.h
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 17202c0f3e3db06a74a92e0d43e2a629ed1b1821..79f66a53be9c63a3ec8406b432995292a48991ab 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -319,6 +319,11 @@ class NET_EXPORT_PRIVATE SpdyFramer {
LAST_ERROR, // Must be the last entry in the enum.
};
+ enum CompressionOption {
+ ENABLE_COMPRESSION,
+ DISABLE_COMPRESSION,
+ };
+
// Typedef for a function used to create SpdyFramerDecoderAdapter's.
// Defined in support of evaluating an alternate HTTP/2 decoder.
typedef std::unique_ptr<SpdyFramerDecoderAdapter> (*DecoderAdapterFactoryFn)(
@@ -338,12 +343,12 @@ class NET_EXPORT_PRIVATE SpdyFramer {
// Retrieve serialized length of SpdyHeaderBlock.
static size_t GetSerializedLength(const SpdyHeaderBlock* headers);
- SpdyFramer();
+ explicit SpdyFramer(CompressionOption option);
// Used recursively from the above constructor in order to support
// instantiating a SpdyFramerDecoderAdapter selected via flags or some other
// means.
- explicit SpdyFramer(DecoderAdapterFactoryFn adapter_factory);
+ SpdyFramer(DecoderAdapterFactoryFn adapter_factory, CompressionOption option);
virtual ~SpdyFramer();
@@ -475,10 +480,9 @@ class NET_EXPORT_PRIVATE SpdyFramer {
// Serialize a frame of unknown type.
SpdySerializedFrame SerializeFrame(const SpdyFrameIR& frame);
- // For ease of testing and experimentation we can tweak compression on/off.
- bool enable_compression() const { return enable_compression_; }
- void set_enable_compression(bool value) {
- enable_compression_ = value;
+ // Returns whether this SpdyFramer will compress header blocks using HPACK.
+ bool compression_enabled() const {
+ return compression_option_ == ENABLE_COMPRESSION;
}
void SetHpackIndexingPolicy(HpackEncoder::IndexingPolicy policy) {
@@ -766,7 +770,7 @@ class NET_EXPORT_PRIVATE SpdyFramer {
uint8_t current_frame_flags_;
// Determines whether HPACK compression is used.
- bool enable_compression_;
+ const CompressionOption compression_option_;
// On the first read, we check to see if the data starts with HTTP.
// If it does, we likely have an HTTP response. This isn't guaranteed
« no previous file with comments | « net/spdy/spdy_frame_builder_test.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698