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

Side by Side Diff: net/tools/flip_server/mem_cache.cc

Issue 1239493005: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/flip_server/mem_cache.h" 5 #include "net/tools/flip_server/mem_cache.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 size_t slash_pos = filename_stripped.find('/'); 197 size_t slash_pos = filename_stripped.find('/');
198 if (slash_pos == std::string::npos) { 198 if (slash_pos == std::string::npos) {
199 slash_pos = filename_stripped.size(); 199 slash_pos = filename_stripped.size();
200 } 200 }
201 InsertFile( 201 InsertFile(
202 &visitor.headers, filename_stripped.substr(0, slash_pos), visitor.body); 202 &visitor.headers, filename_stripped.substr(0, slash_pos), visitor.body);
203 } 203 }
204 204
205 FileData* MemoryCache::GetFileData(const std::string& filename) { 205 FileData* MemoryCache::GetFileData(const std::string& filename) {
206 Files::iterator fi = files_.end(); 206 Files::iterator fi = files_.end();
207 if (base::EndsWith(filename, ".html", true)) { 207 if (base::EndsWith(filename, ".html", base::CompareCase::SENSITIVE)) {
208 fi = files_.find(filename.substr(0, filename.size() - 5) + ".http"); 208 fi = files_.find(filename.substr(0, filename.size() - 5) + ".http");
209 } 209 }
210 if (fi == files_.end()) 210 if (fi == files_.end())
211 fi = files_.find(filename); 211 fi = files_.find(filename);
212 212
213 if (fi == files_.end()) { 213 if (fi == files_.end()) {
214 return NULL; 214 return NULL;
215 } 215 }
216 return fi->second; 216 return fi->second;
217 } 217 }
(...skipping 25 matching lines...) Expand all
243 } 243 }
244 244
245 void MemoryCache::ClearFiles() { 245 void MemoryCache::ClearFiles() {
246 for (Files::const_iterator i = files_.begin(); i != files_.end(); ++i) { 246 for (Files::const_iterator i = files_.begin(); i != files_.end(); ++i) {
247 delete i->second; 247 delete i->second;
248 } 248 }
249 files_.clear(); 249 files_.clear();
250 } 250 }
251 251
252 } // namespace net 252 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698