Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: net/tools/quic/quic_in_memory_cache.cc

Issue 1544563002: Adds a DCHECK that the host argument to QuicInMemoryCache::AddResponse is not empty. An empty host … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110267778
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/tools/quic/quic_simple_server_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_simple_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698