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

Unified Diff: net/quic/quic_in_memory_cache.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/quic/quic_http_utils_test.cc ('k') | net/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/quic/quic_in_memory_cache.h
diff --git a/net/quic/quic_in_memory_cache.h b/net/quic/quic_in_memory_cache.h
deleted file mode 100644
index ee3a9de1e00b0ec22412e74f9650f87e59f9dbe6..0000000000000000000000000000000000000000
--- a/net/quic/quic_in_memory_cache.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_QUIC_QUIC_IN_MEMORY_CACHE_H_
-#define NET_QUIC_QUIC_IN_MEMORY_CACHE_H_
-
-#include <string>
-
-#include "base/containers/hash_tables.h"
-#include "base/files/file_util.h"
-#include "base/memory/singleton.h"
-#include "base/strings/string_piece.h"
-#include "net/http/http_response_headers.h"
-
-template <typename T> struct DefaultSingletonTraits;
-class GURL;
-
-namespace net {
-
-extern base::FilePath::StringType g_quic_in_memory_cache_dir;
-
-namespace test {
-class QuicInMemoryCachePeer;
-} // namespace
-
-class QuicServer;
-
-// In-memory cache for HTTP responses.
-// Reads from disk cache generated by:
-// `wget -p --save_headers <url>`
-class QuicInMemoryCache {
- public:
- enum SpecialResponseType {
- REGULAR_RESPONSE, // Send the headers and body like a server should.
- CLOSE_CONNECTION, // Close the connection (sending the close packet).
- IGNORE_REQUEST, // Do nothing, expect the client to time out.
- };
-
- // Container for response header/body pairs.
- class Response {
- public:
- Response();
- ~Response();
-
- SpecialResponseType response_type() const { return response_type_; }
- const HttpResponseHeaders& headers() const { return *headers_.get(); }
- const base::StringPiece body() const { return base::StringPiece(body_); }
-
- private:
- friend class QuicInMemoryCache;
-
- void set_headers(scoped_refptr<HttpResponseHeaders> headers) {
- headers_ = headers;
- }
- void set_body(base::StringPiece body) {
- body.CopyToString(&body_);
- }
-
- SpecialResponseType response_type_;
- scoped_refptr<HttpResponseHeaders> headers_;
- std::string body_;
-
- 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.
- // If no appropriate response exists, nullptr is returned.
- // Currently, responses are selected based on request URI only.
- const Response* GetResponse(const GURL& url) const;
-
- // Adds a simple response to the cache. The response headers will
- // only contain the "content-length" header with the length of |body|.
- void AddSimpleResponse(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 GURL& url,
- scoped_refptr<HttpResponseHeaders> response_headers,
- base::StringPiece response_body);
-
- // Simulate a special behavior at a particular path.
- void AddSpecialResponse(base::StringPiece path,
- SpecialResponseType response_type);
-
- 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 GURL& url) const;
-
- // Cached responses.
- ResponseMap responses_;
-
- DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache);
-};
-
-} // namespace net
-
-#endif // NET_QUIC_QUIC_IN_MEMORY_CACHE_H_
« no previous file with comments | « net/quic/quic_http_utils_test.cc ('k') | net/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698