OLD | NEW |
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> |
11 #include <sys/stat.h> | 11 #include <sys/stat.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 | 14 |
15 #include <deque> | 15 #include <deque> |
16 #include <map> | 16 #include <map> |
17 #include <string> | 17 #include <string> |
18 | 18 |
| 19 #include "base/memory/ptr_util.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "net/tools/balsa/balsa_frame.h" | 21 #include "net/tools/balsa/balsa_frame.h" |
21 #include "net/tools/balsa/balsa_headers.h" | 22 #include "net/tools/balsa/balsa_headers.h" |
22 #include "net/tools/flip_server/url_to_filename_encoder.h" | 23 #include "net/tools/flip_server/url_to_filename_encoder.h" |
23 #include "net/tools/flip_server/url_utilities.h" | 24 #include "net/tools/flip_server/url_utilities.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 // The directory where cache locates); | 27 // The directory where cache locates); |
27 const char FLAGS_cache_base_dir[] = "."; | 28 const char FLAGS_cache_base_dir[] = "."; |
28 } // namespace | 29 } // namespace |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const std::string& body) { | 224 const std::string& body) { |
224 InsertFile(new FileData(headers, filename, body)); | 225 InsertFile(new FileData(headers, filename, body)); |
225 } | 226 } |
226 | 227 |
227 void MemoryCache::InsertFile(FileData* file_data) { | 228 void MemoryCache::InsertFile(FileData* file_data) { |
228 Files::iterator it = files_.find(file_data->filename()); | 229 Files::iterator it = files_.find(file_data->filename()); |
229 if (it != files_.end()) { | 230 if (it != files_.end()) { |
230 it->second.reset(file_data); | 231 it->second.reset(file_data); |
231 } else { | 232 } else { |
232 files_.insert( | 233 files_.insert( |
233 std::make_pair(file_data->filename(), make_scoped_ptr(file_data))); | 234 std::make_pair(file_data->filename(), base::WrapUnique(file_data))); |
234 } | 235 } |
235 } | 236 } |
236 | 237 |
237 } // namespace net | 238 } // namespace net |
OLD | NEW |