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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
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 27 matching lines...) Expand all
38 entry->Close(); 38 entry->Close();
39 } 39 }
40 } 40 }
41 41
42 // A version of CreateDirectory which supports lengthy filenames. 42 // A version of CreateDirectory which supports lengthy filenames.
43 // Returns true on success, false on failure. 43 // Returns true on success, false on failure.
44 bool SafeCreateDirectory(const base::FilePath& path) { 44 bool SafeCreateDirectory(const base::FilePath& path) {
45 #ifdef WIN32_LARGE_FILENAME_SUPPORT 45 #ifdef WIN32_LARGE_FILENAME_SUPPORT
46 // Due to large paths on windows, it can't simply do a 46 // Due to large paths on windows, it can't simply do a
47 // CreateDirectory("a/b/c"). Instead, create each subdirectory manually. 47 // CreateDirectory("a/b/c"). Instead, create each subdirectory manually.
48 bool rv = false;
49 std::wstring::size_type pos(0); 48 std::wstring::size_type pos(0);
50 std::wstring backslash(L"\\"); 49 std::wstring backslash(L"\\");
51 50
52 // If the path starts with the long file header, skip over that 51 // If the path starts with the long file header, skip over that
53 const std::wstring kLargeFilenamePrefix(L"\\\\?\\"); 52 const std::wstring kLargeFilenamePrefix(L"\\\\?\\");
54 std::wstring header(kLargeFilenamePrefix); 53 std::wstring header(kLargeFilenamePrefix);
55 if (path.value().find(header) == 0) 54 if (path.value().find(header) == 0)
56 pos = 4; 55 pos = 4;
57 56
58 // Create the subdirectories individually 57 // Create the subdirectories individually
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 213 }
215 214
216 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, 215 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
217 base::Time last_modified) { 216 base::Time last_modified) {
218 #ifdef WIN32_LARGE_FILENAME_SUPPORT 217 #ifdef WIN32_LARGE_FILENAME_SUPPORT
219 CloseHandle(entry_); 218 CloseHandle(entry_);
220 #else 219 #else
221 base::CloseFile(entry_); 220 base::CloseFile(entry_);
222 #endif 221 #endif
223 } 222 }
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server_unittest.cc ('k') | net/tools/flip_server/spdy_interface_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698