OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 5 #include <limits> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 cache_.reset(); | 214 cache_.reset(); |
215 | 215 |
216 // Flush all files in the cache out of system memory. | 216 // Flush all files in the cache out of system memory. |
217 const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*"); | 217 const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*"); |
218 base::FileEnumerator enumerator(cache_path_, true /* recursive */, | 218 base::FileEnumerator enumerator(cache_path_, true /* recursive */, |
219 base::FileEnumerator::FILES, file_pattern); | 219 base::FileEnumerator::FILES, file_pattern); |
220 for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); | 220 for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); |
221 file_path = enumerator.Next()) { | 221 file_path = enumerator.Next()) { |
222 ASSERT_TRUE(base::EvictFileFromSystemCache(file_path)); | 222 ASSERT_TRUE(base::EvictFileFromSystemCache(file_path)); |
223 } | 223 } |
224 #if defined(OS_LINUX) | 224 #if defined(OS_LINUX) || defined(OS_ANDROID) |
225 // And, cache directories, on platforms where the eviction utility supports | 225 // And, cache directories, on platforms where the eviction utility supports |
226 // this (currently Linux only). | 226 // this (currently Linux and Android only). |
jkarlin
2017/06/01 15:15:27
Can you point me to the CL that enabled Android su
| |
227 if (simple_cache_mode_) { | 227 if (simple_cache_mode_) { |
228 ASSERT_TRUE( | 228 ASSERT_TRUE( |
229 base::EvictFileFromSystemCache(cache_path_.AppendASCII("index-dir"))); | 229 base::EvictFileFromSystemCache(cache_path_.AppendASCII("index-dir"))); |
230 } | 230 } |
231 ASSERT_TRUE(base::EvictFileFromSystemCache(cache_path_)); | 231 ASSERT_TRUE(base::EvictFileFromSystemCache(cache_path_)); |
232 #endif | 232 #endif |
233 | 233 |
234 DisableFirstCleanup(); | 234 DisableFirstCleanup(); |
235 InitCache(); | 235 InitCache(); |
236 } | 236 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 index.SetMaxSize(kEntries); | 341 index.SetMaxSize(kEntries); |
342 index.UpdateEntrySize(0, 1u); | 342 index.UpdateEntrySize(0, 1u); |
343 evict_elapsed_ms += timer.Elapsed().InMillisecondsF(); | 343 evict_elapsed_ms += timer.Elapsed().InMillisecondsF(); |
344 } | 344 } |
345 | 345 |
346 LOG(ERROR) << "Average time to evict:" << (evict_elapsed_ms / iterations) | 346 LOG(ERROR) << "Average time to evict:" << (evict_elapsed_ms / iterations) |
347 << "ms"; | 347 << "ms"; |
348 } | 348 } |
349 | 349 |
350 } // namespace | 350 } // namespace |
OLD | NEW |