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

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

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.h ('k') | net/tools/quic/quic_server.h » ('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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (ContainsKey(responses_, GetKey(request_headers))) { 103 if (ContainsKey(responses_, GetKey(request_headers))) {
104 LOG(DFATAL) << "Response for given request already exists!"; 104 LOG(DFATAL) << "Response for given request already exists!";
105 return; 105 return;
106 } 106 }
107 Response* new_response = new Response(); 107 Response* new_response = new Response();
108 new_response->set_headers(response_headers); 108 new_response->set_headers(response_headers);
109 new_response->set_body(response_body); 109 new_response->set_body(response_body);
110 responses_[GetKey(request_headers)] = new_response; 110 responses_[GetKey(request_headers)] = new_response;
111 } 111 }
112 112
113 void QuicInMemoryCache::AddSpecialResponse(StringPiece method,
114 StringPiece path,
115 StringPiece version,
116 SpecialResponseType response_type) {
117 BalsaHeaders request_headers, response_headers;
118 request_headers.SetRequestFirstlineFromStringPieces(method,
119 path,
120 version);
121 AddResponse(request_headers, response_headers, "");
122 responses_[GetKey(request_headers)]->response_type_ = response_type;
123 }
124
113 QuicInMemoryCache::QuicInMemoryCache() { 125 QuicInMemoryCache::QuicInMemoryCache() {
114 Initialize(); 126 Initialize();
115 } 127 }
116 128
117 void QuicInMemoryCache::ResetForTests() { 129 void QuicInMemoryCache::ResetForTests() {
118 STLDeleteValues(&responses_); 130 STLDeleteValues(&responses_);
119 Initialize(); 131 Initialize();
120 } 132 }
121 133
122 void QuicInMemoryCache::Initialize() { 134 void QuicInMemoryCache::Initialize() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) { 235 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) {
224 uri.remove_prefix(8); 236 uri.remove_prefix(8);
225 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) { 237 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) {
226 uri.remove_prefix(7); 238 uri.remove_prefix(7);
227 } 239 }
228 return host.as_string() + uri.as_string(); 240 return host.as_string() + uri.as_string();
229 } 241 }
230 242
231 } // namespace tools 243 } // namespace tools
232 } // namespace net 244 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.h ('k') | net/tools/quic/quic_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698