Chromium Code Reviews| Index: net/disk_cache/simple/simple_util_win.cc |
| diff --git a/net/disk_cache/simple/simple_util_win.cc b/net/disk_cache/simple/simple_util_win.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4173ae8a8236150f7673ddef71a1c990abbd2611 |
| --- /dev/null |
| +++ b/net/disk_cache/simple/simple_util_win.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "net/disk_cache/simple/simple_util.h" |
| + |
| +#include <windows.h> |
| + |
| +#include "base/files/file_util.h" |
| +#include "base/format_macros.h" |
| +#include "base/rand_util.h" |
| +#include "base/strings/stringprintf.h" |
| +#include "net/disk_cache/cache_util.h" |
| + |
| +namespace disk_cache { |
| +namespace simple_util { |
| + |
| +bool SimpleCacheDeleteFile(const base::FilePath& path) { |
|
mmenke
2014/10/28 20:07:43
Per offline discussion, this could be a little cle
|
| + const base::FilePath rename_target = |
| + path.DirName().AppendASCII(base::StringPrintf("todelete_%016" PRIx64, |
| + base::RandUint64())); |
| + |
| + const base::FilePath to_delete_file = |
| + MoveFile(path.value().c_str(), rename_target.value().c_str()) ? |
| + rename_target : path; |
| + |
| + return DeleteCacheFile(to_delete_file); |
| +} |
| + |
| +} // namespace simple_util |
| +} // namespace disk_cache |