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 #include "net/tools/quic/quic_in_memory_cache.h" | 5 #include "net/tools/quic/quic_in_memory_cache.h" |
6 | 6 |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 STLDeleteValues(&responses_); | 197 STLDeleteValues(&responses_); |
198 } | 198 } |
199 | 199 |
200 void QuicInMemoryCache::AddResponseImpl( | 200 void QuicInMemoryCache::AddResponseImpl( |
201 StringPiece host, | 201 StringPiece host, |
202 StringPiece path, | 202 StringPiece path, |
203 SpecialResponseType response_type, | 203 SpecialResponseType response_type, |
204 const SpdyHeaderBlock& response_headers, | 204 const SpdyHeaderBlock& response_headers, |
205 StringPiece response_body, | 205 StringPiece response_body, |
206 const SpdyHeaderBlock& response_trailers) { | 206 const SpdyHeaderBlock& response_trailers) { |
| 207 DCHECK(!host.empty()) << "Host must be populated, e.g. \"www.google.com\""; |
207 string key = GetKey(host, path); | 208 string key = GetKey(host, path); |
208 if (ContainsKey(responses_, key)) { | 209 if (ContainsKey(responses_, key)) { |
209 LOG(DFATAL) << "Response for '" << key << "' already exists!"; | 210 LOG(DFATAL) << "Response for '" << key << "' already exists!"; |
210 return; | 211 return; |
211 } | 212 } |
212 Response* new_response = new Response(); | 213 Response* new_response = new Response(); |
213 new_response->set_response_type(response_type); | 214 new_response->set_response_type(response_type); |
214 new_response->set_headers(response_headers); | 215 new_response->set_headers(response_headers); |
215 new_response->set_body(response_body); | 216 new_response->set_body(response_body); |
216 new_response->set_trailers(response_trailers); | 217 new_response->set_trailers(response_trailers); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ServerPushInfo push_resource = it->second; | 254 ServerPushInfo push_resource = it->second; |
254 if (push_resource.request_url.spec() == resource.request_url.spec()) { | 255 if (push_resource.request_url.spec() == resource.request_url.spec()) { |
255 return true; | 256 return true; |
256 } | 257 } |
257 } | 258 } |
258 return false; | 259 return false; |
259 } | 260 } |
260 | 261 |
261 } // namespace tools | 262 } // namespace tools |
262 } // namespace net | 263 } // namespace net |
OLD | NEW |