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

Unified Diff: net/spdy/hpack_constants.h

Issue 549583003: Make HPACK static table static and immutable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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/net.gypi ('k') | net/spdy/hpack_constants.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_constants.h
diff --git a/net/spdy/hpack_constants.h b/net/spdy/hpack_constants.h
index 7b1834f74572fb8f9c7530da5017fdaaa0cae20a..16fccfe4d1a1afc2829c41628b0bfe08b68129b0 100644
--- a/net/spdy/hpack_constants.h
+++ b/net/spdy/hpack_constants.h
@@ -29,7 +29,17 @@ struct HpackHuffmanSymbol {
uint16 id;
};
+// An entry in the static table. Must be a POD in order to avoid static
+// initializers, i.e. no user-defined constructors or destructors.
+struct HpackStaticEntry {
+ const char* const name;
+ const size_t name_len;
+ const char* const value;
+ const size_t value_len;
+};
+
class HpackHuffmanTable;
+class HpackStaticTable;
const uint32 kDefaultHeaderTableSizeSetting = 4096;
@@ -65,14 +75,22 @@ const HpackPrefix kLiteralNeverIndexOpcode = { 0x1, 4 };
// table size with a 5-bit prefix.
const HpackPrefix kHeaderTableSizeUpdateOpcode = { 0x1, 3 };
-// Returns symbol code table from "Appendix C. Huffman Codes".
+// Returns symbol code table from "Appendix C. Huffman Code".
NET_EXPORT_PRIVATE std::vector<HpackHuffmanSymbol> HpackHuffmanCode();
+// Returns static table from "Appendix B. Static Table Definition".
+NET_EXPORT_PRIVATE std::vector<HpackStaticEntry> HpackStaticTableVector();
+
// Returns a HpackHuffmanTable instance initialized with |kHpackHuffmanCode|.
// The instance is read-only, has static lifetime, and is safe to share amoung
// threads. This function is thread-safe.
NET_EXPORT_PRIVATE const HpackHuffmanTable& ObtainHpackHuffmanTable();
+// Returns a HpackStaticTable instance initialized with |kHpackStaticTable|.
+// The instance is read-only, has static lifetime, and is safe to share amoung
+// threads. This function is thread-safe.
+NET_EXPORT_PRIVATE const HpackStaticTable& ObtainHpackStaticTable();
+
// Pseudo-headers start with a colon. (HTTP2 8.1.2.1., HPACK 3.1.)
const char kPseudoHeaderPrefix = ':';
« no previous file with comments | « net/net.gypi ('k') | net/spdy/hpack_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698