Extracts SpdyHeaderBlock::Storage as a separate library. This is a continuation of the attempt to simplify SpdyHeaderBlock.
gfe-relnote: Refactoring, no functional change.
PiperOrigin-RevId: 284571559
Change-Id: I8396e585439ec58bcdba6aeb22f44f56352625ba
diff --git a/spdy/core/spdy_header_block.h b/spdy/core/spdy_header_block.h
index b9c0967..ff5f4c9 100644
--- a/spdy/core/spdy_header_block.h
+++ b/spdy/core/spdy_header_block.h
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include "net/third_party/quiche/src/spdy/core/spdy_header_storage.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h"
@@ -38,13 +39,11 @@
// It's expected that keys are rarely deleted from a SpdyHeaderBlock.
class SPDY_EXPORT_PRIVATE SpdyHeaderBlock {
private:
- class Storage;
-
// Stores a list of value fragments that can be joined later with a
// key-dependent separator.
class SPDY_EXPORT_PRIVATE HeaderValue {
public:
- HeaderValue(Storage* storage,
+ HeaderValue(SpdyHeaderStorage* storage,
SpdyStringPiece key,
SpdyStringPiece initial_value);
@@ -73,7 +72,7 @@
// fragments and separators.
SpdyStringPiece ConsolidatedValue() const;
- mutable Storage* storage_;
+ mutable SpdyHeaderStorage* storage_;
mutable std::vector<SpdyStringPiece> fragments_;
// The first element is the key; the second is the consolidated value.
mutable std::pair<SpdyStringPiece, SpdyStringPiece> pair_;
@@ -180,7 +179,7 @@
// This object provides automatic conversions that allow SpdyHeaderBlock to be
// nearly a drop-in replacement for
// SpdyLinkedHashMap<std::string, std::string>.
- // It reads data from or writes data to a SpdyHeaderBlock::Storage.
+ // It reads data from or writes data to a SpdyHeaderStorage.
class SPDY_EXPORT_PRIVATE ValueProxy {
public:
~ValueProxy();
@@ -226,25 +225,19 @@
friend class test::SpdyHeaderBlockPeer;
void AppendHeader(const SpdyStringPiece key, const SpdyStringPiece value);
- Storage* GetStorage();
+ SpdyHeaderStorage* GetStorage();
SpdyStringPiece WriteKey(const SpdyStringPiece key);
size_t bytes_allocated() const;
// SpdyStringPieces held by |map_| point to memory owned by |*storage_|.
// |storage_| might be nullptr as long as |map_| is empty.
MapType map_;
- std::unique_ptr<Storage> storage_;
+ std::unique_ptr<SpdyHeaderStorage> storage_;
size_t key_size_ = 0;
size_t value_size_ = 0;
};
-// Writes |fragments| to |dst|, joined by |separator|. |dst| must be large
-// enough to hold the result. Returns the number of bytes written.
-SPDY_EXPORT_PRIVATE size_t Join(char* dst,
- const std::vector<SpdyStringPiece>& fragments,
- SpdyStringPiece separator);
-
} // namespace spdy
#endif // QUICHE_SPDY_CORE_SPDY_HEADER_BLOCK_H_