OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 5 #ifndef NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
6 #define NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 6 #define NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 scoped_refptr<HttpResponseHeaders> headers_; | 61 scoped_refptr<HttpResponseHeaders> headers_; |
62 std::string body_; | 62 std::string body_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(Response); | 64 DISALLOW_COPY_AND_ASSIGN(Response); |
65 }; | 65 }; |
66 | 66 |
67 // Returns the singleton instance of the cache. | 67 // Returns the singleton instance of the cache. |
68 static QuicInMemoryCache* GetInstance(); | 68 static QuicInMemoryCache* GetInstance(); |
69 | 69 |
70 // Retrieve a response from this cache for a given request. | 70 // Retrieve a response from this cache for a given request. |
71 // If no appropriate response exists, NULL is returned. | 71 // If no appropriate response exists, nullptr is returned. |
72 // Currently, responses are selected based on request URI only. | 72 // Currently, responses are selected based on request URI only. |
73 const Response* GetResponse(const GURL& url) const; | 73 const Response* GetResponse(const GURL& url) const; |
74 | 74 |
75 // Adds a simple response to the cache. The response headers will | 75 // Adds a simple response to the cache. The response headers will |
76 // only contain the "content-length" header with the length of |body|. | 76 // only contain the "content-length" header with the length of |body|. |
77 void AddSimpleResponse(base::StringPiece path, | 77 void AddSimpleResponse(base::StringPiece path, |
78 base::StringPiece version, | 78 base::StringPiece version, |
79 base::StringPiece response_code, | 79 base::StringPiece response_code, |
80 base::StringPiece response_detail, | 80 base::StringPiece response_detail, |
81 base::StringPiece body); | 81 base::StringPiece body); |
(...skipping 23 matching lines...) Expand all Loading... |
105 | 105 |
106 // Cached responses. | 106 // Cached responses. |
107 ResponseMap responses_; | 107 ResponseMap responses_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); | 109 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace net | 112 } // namespace net |
113 | 113 |
114 #endif // NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 114 #endif // NET_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
OLD | NEW |