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

Side by Side Diff: net/tools/dump_cache/cache_dumper.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/third_party/nss/ssl/BUILD.gn ('k') | net/tools/quic/end_to_end_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/dump_cache/cache_dumper.h" 5 #include "net/tools/dump_cache/cache_dumper.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 pos++; 62 pos++;
63 } 63 }
64 // Now create the full path 64 // Now create the full path
65 return CreateDirectoryW(path.value().c_str(), NULL) == TRUE; 65 return CreateDirectoryW(path.value().c_str(), NULL) == TRUE;
66 #else 66 #else
67 return base::CreateDirectory(path); 67 return base::CreateDirectory(path);
68 #endif 68 #endif
69 } 69 }
70 70
71 DiskDumper::DiskDumper(const base::FilePath& path) 71 DiskDumper::DiskDumper(const base::FilePath& path)
72 : path_(path), entry_(NULL) { 72 : path_(path.AsEndingWithSeparator()), entry_(NULL) {
73 base::CreateDirectory(path); 73 base::CreateDirectory(path);
74 } 74 }
75 75
76 int DiskDumper::CreateEntry(const std::string& key, 76 int DiskDumper::CreateEntry(const std::string& key,
77 disk_cache::Entry** entry, 77 disk_cache::Entry** entry,
78 const net::CompletionCallback& callback) { 78 const net::CompletionCallback& callback) {
79 // The URL may not start with a valid protocol; search for it. 79 // The URL may not start with a valid protocol; search for it.
80 int urlpos = key.find("http"); 80 int urlpos = key.find("http");
81 std::string url = urlpos > 0 ? key.substr(urlpos) : key; 81 std::string url = urlpos > 0 ? key.substr(urlpos) : key;
82 std::string base_path = path_.MaybeAsASCII(); 82 std::string base_path = path_.MaybeAsASCII();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 214
215 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, 215 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
216 base::Time last_modified) { 216 base::Time last_modified) {
217 #ifdef WIN32_LARGE_FILENAME_SUPPORT 217 #ifdef WIN32_LARGE_FILENAME_SUPPORT
218 CloseHandle(entry_); 218 CloseHandle(entry_);
219 #else 219 #else
220 base::CloseFile(entry_); 220 base::CloseFile(entry_);
221 #endif 221 #endif
222 } 222 }
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/BUILD.gn ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698