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_HTTP_RESPONSE_CACHE_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
6 #define NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ | 6 #define NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Simulate a special behavior at a particular path. | 168 // Simulate a special behavior at a particular path. |
169 void AddSpecialResponse(base::StringPiece host, | 169 void AddSpecialResponse(base::StringPiece host, |
170 base::StringPiece path, | 170 base::StringPiece path, |
171 SpecialResponseType response_type); | 171 SpecialResponseType response_type); |
172 | 172 |
173 // Sets a default response in case of cache misses. Takes ownership of | 173 // Sets a default response in case of cache misses. Takes ownership of |
174 // 'response'. | 174 // 'response'. |
175 void AddDefaultResponse(Response* response); | 175 void AddDefaultResponse(Response* response); |
176 | 176 |
177 // |cache_cirectory| can be generated using `wget -p --save-headers <url>`. | 177 // |cache_cirectory| can be generated using `wget -p --save-headers <url>`. |
| 178 void InitializeFromDirectory(const std::string& cache_directory, const base::F
ilePath& directory); |
| 179 |
| 180 // |cache_cirectory| can be generated using `wget -p --save-headers <url>`. |
178 void InitializeFromDirectory(const std::string& cache_directory); | 181 void InitializeFromDirectory(const std::string& cache_directory); |
179 | 182 |
180 // Find all the server push resources associated with |request_url|. | 183 // Find all the server push resources associated with |request_url|. |
181 std::list<ServerPushInfo> GetServerPushResources(std::string request_url); | 184 std::list<ServerPushInfo> GetServerPushResources(std::string request_url); |
182 | 185 |
183 private: | 186 private: |
184 void AddResponseImpl(base::StringPiece host, | 187 void AddResponseImpl(base::StringPiece host, |
185 base::StringPiece path, | 188 base::StringPiece path, |
186 SpecialResponseType response_type, | 189 SpecialResponseType response_type, |
187 SpdyHeaderBlock response_headers, | 190 SpdyHeaderBlock response_headers, |
(...skipping 27 matching lines...) Expand all Loading... |
215 // Protects against concurrent access from test threads setting responses, and | 218 // Protects against concurrent access from test threads setting responses, and |
216 // server threads accessing those responses. | 219 // server threads accessing those responses. |
217 mutable QuicMutex response_mutex_; | 220 mutable QuicMutex response_mutex_; |
218 | 221 |
219 DISALLOW_COPY_AND_ASSIGN(QuicHttpResponseCache); | 222 DISALLOW_COPY_AND_ASSIGN(QuicHttpResponseCache); |
220 }; | 223 }; |
221 | 224 |
222 } // namespace net | 225 } // namespace net |
223 | 226 |
224 #endif // NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ | 227 #endif // NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ |
OLD | NEW |