| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A utility to clear the operating system's cache for a file or directory. | 5 // A utility to clear the operating system's cache for a file or directory. |
| 6 // | 6 // |
| 7 // USAGE: clear_system_cache [--recurse] <files or directories> | 7 // USAGE: clear_system_cache [--recurse] <files or directories> |
| 8 | 8 |
| 9 #include <stddef.h> |
| 9 #include <stdio.h> | 10 #include <stdio.h> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/test/test_file_util.h" | 17 #include "base/test/test_file_util.h" |
| 18 | 18 |
| 19 void ClearCacheForFile(const base::FilePath& path) { | 19 void ClearCacheForFile(const base::FilePath& path) { |
| 20 VLOG(1) << "Clearing " << path.MaybeAsASCII(); | 20 VLOG(1) << "Clearing " << path.MaybeAsASCII(); |
| 21 base::EvictFileFromSystemCache(path); | 21 base::EvictFileFromSystemCache(path); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 next = enumerator.Next()) { | 47 next = enumerator.Next()) { |
| 48 ClearCacheForFile(next); | 48 ClearCacheForFile(next); |
| 49 } | 49 } |
| 50 } else { | 50 } else { |
| 51 ClearCacheForFile(path); | 51 ClearCacheForFile(path); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 return 0; | 55 return 0; |
| 56 } | 56 } |
| OLD | NEW |