Index: net/spdy/spdy_framer.h |
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h |
index 80ff71c17bfc7566995cb8f5a4dbc7a5c0b185c2..375aa8b86bcb098ade838d2e59628e219e252aa2 100644 |
--- a/net/spdy/spdy_framer.h |
+++ b/net/spdy/spdy_framer.h |
@@ -214,6 +214,22 @@ class NET_EXPORT_PRIVATE SpdyFramerVisitorInterface { |
const SpdyControlFrame& compressed_frame) = 0; |
}; |
+// Optionally, and in addition to SpdyFramerVisitorInterface, a class supporting |
+// SpdyFramerDebugVisitorInterface may be used in conjunction with SpdyFramer in |
+// order to extract debug/internal information about the SpdyFramer as it |
+// operates. |
+// |
+// Most SPDY implementations need not bother with this interface at all. |
+class SpdyFramerDebugVisitorInterface { |
+ public: |
+ virtual ~SpdyFramerDebugVisitorInterface() {} |
+ |
+ // Called after compressing header blocks. |
+ // Provides decompressed and compressed sizes. |
+ virtual void OnCompressedHeaderBlock(size_t decompressed_len, |
+ size_t compressed_len) {} |
+}; |
+ |
class NET_EXPORT_PRIVATE SpdyFramer { |
public: |
// SPDY states. |
@@ -284,6 +300,13 @@ class NET_EXPORT_PRIVATE SpdyFramer { |
visitor_ = visitor; |
} |
+ // Set debug callbacks to be called from the framer. The debug visitor is |
+ // completely optional and need not be set in order for normal operation. |
+ // If this is called multiple times, only the last visitor will be used. |
+ void set_debug_visitor(SpdyFramerDebugVisitorInterface* debug_visitor) { |
+ debug_visitor_ = debug_visitor; |
+ } |
+ |
// Pass data into the framer for parsing. |
// Returns the number of bytes consumed. It is safe to pass more bytes in |
// than may be consumed. |
@@ -579,6 +602,7 @@ class NET_EXPORT_PRIVATE SpdyFramer { |
scoped_ptr<z_stream> header_decompressor_; |
SpdyFramerVisitorInterface* visitor_; |
+ SpdyFramerDebugVisitorInterface* debug_visitor_; |
std::string display_protocol_; |