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

Unified Diff: net/tools/quic/quic_in_memory_cache.h

Issue 24596008: Cleanup of QuicInMemoryCache to sync with internal version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 7 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/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_in_memory_cache.h
diff --git a/net/tools/quic/quic_in_memory_cache.h b/net/tools/quic/quic_in_memory_cache.h
index 94f524a7616b8a19672c23641ac1abb97b2145fd..43b692e6416e28f635c04e2c68902c2c32955ba9 100644
--- a/net/tools/quic/quic_in_memory_cache.h
+++ b/net/tools/quic/quic_in_memory_cache.h
@@ -12,12 +12,17 @@
#include "base/strings/string_piece.h"
#include "net/tools/flip_server/balsa_frame.h"
#include "net/tools/flip_server/balsa_headers.h"
+#include "net/tools/flip_server/noop_balsa_visitor.h"
template <typename T> struct DefaultSingletonTraits;
namespace net {
namespace tools {
+namespace test {
+class QuicInMemoryCachePeer;
+} // namespace
+
extern std::string FLAGS_quic_in_memory_cache_dir;
class QuicServer;
@@ -51,6 +56,8 @@ class QuicInMemoryCache {
DISALLOW_COPY_AND_ASSIGN(Response);
};
+
+ // Returns the singleton instance of the cache.
static QuicInMemoryCache* GetInstance();
// Retrieve a response from this cache for a given request.
@@ -58,30 +65,32 @@ class QuicInMemoryCache {
// Currently, responses are selected based on request URI only.
const Response* GetResponse(const BalsaHeaders& request_headers) const;
- // Adds a response to the cache if no matching entry exists.
- // Otherwise it verifies that the existing entry matches.
- void AddOrVerifyResponse(base::StringPiece method,
- base::StringPiece path,
- base::StringPiece version,
- base::StringPiece response_code,
- base::StringPiece response_detail,
- base::StringPiece body);
+ // Adds a simple response to the cache. The response headers will
+ // only contain the "content-length" header with the lenght of |body|.
+ void AddSimpleResponse(base::StringPiece method,
+ base::StringPiece path,
+ base::StringPiece version,
+ base::StringPiece response_code,
+ base::StringPiece response_detail,
+ base::StringPiece body);
// Add a response to the cache.
void AddResponse(const BalsaHeaders& request_headers,
const BalsaHeaders& response_headers,
base::StringPiece response_body);
- void ResetForTests();
-
private:
typedef base::hash_map<std::string, Response*> ResponseMap;
friend struct DefaultSingletonTraits<QuicInMemoryCache>;
+ friend class test::QuicInMemoryCachePeer;
QuicInMemoryCache();
~QuicInMemoryCache();
+ void ResetForTests();
+
void Initialize();
+
std::string GetKey(const BalsaHeaders& response_headers) const;
// Cached responses.
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698