OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
6 #define NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 6 #define NET_TOOLS_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 BalsaHeaders headers_; | 62 BalsaHeaders headers_; |
63 std::string body_; | 63 std::string body_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(Response); | 65 DISALLOW_COPY_AND_ASSIGN(Response); |
66 }; | 66 }; |
67 | 67 |
68 // Returns the singleton instance of the cache. | 68 // Returns the singleton instance of the cache. |
69 static QuicInMemoryCache* GetInstance(); | 69 static QuicInMemoryCache* GetInstance(); |
70 | 70 |
71 // Retrieve a response from this cache for a given request. | 71 // Retrieve a response from this cache for a given request. |
72 // If no appropriate response exists, NULL is returned. | 72 // If no appropriate response exists, nullptr is returned. |
73 // Currently, responses are selected based on request URI only. | 73 // Currently, responses are selected based on request URI only. |
74 const Response* GetResponse(const BalsaHeaders& request_headers) const; | 74 const Response* GetResponse(const BalsaHeaders& request_headers) const; |
75 | 75 |
76 // Adds a simple response to the cache. The response headers will | 76 // Adds a simple response to the cache. The response headers will |
77 // only contain the "content-length" header with the lenght of |body|. | 77 // only contain the "content-length" header with the lenght of |body|. |
78 void AddSimpleResponse(base::StringPiece method, | 78 void AddSimpleResponse(base::StringPiece method, |
79 base::StringPiece path, | 79 base::StringPiece path, |
80 base::StringPiece version, | 80 base::StringPiece version, |
81 base::StringPiece response_code, | 81 base::StringPiece response_code, |
82 base::StringPiece response_detail, | 82 base::StringPiece response_detail, |
(...skipping 27 matching lines...) Expand all Loading... |
110 // Cached responses. | 110 // Cached responses. |
111 ResponseMap responses_; | 111 ResponseMap responses_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); | 113 DISALLOW_COPY_AND_ASSIGN(QuicInMemoryCache); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace tools | 116 } // namespace tools |
117 } // namespace net | 117 } // namespace net |
118 | 118 |
119 #endif // NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ | 119 #endif // NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ |
OLD | NEW |