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