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

Unified Diff: base/file_util_win.cc

Issue 9774: * Revert "Por rt flush_cache tool." (Closed)
Patch Set: Created 12 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util_mac.mm ('k') | chrome/SConscript » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 5f75544cbd128fba1012c4be64dc2ca4a4c982ce..355bdfda9d5ea499318cc569ff25dcd77084fd33 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -692,45 +692,4 @@ std::wstring FileEnumerator::Next() {
return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
}
-bool EvictFileFromSystemCache(const FilePath path) {
- // Overwrite it with no buffering.
- ScopedHandle file(CreateFile(path.value().c_str(),
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
- if (!file.IsValid())
- return false;
-
- // Execute in chunks. It could be optimized. We want to do few of these since
- // these operations will be slow without the cache.
- char buffer[128 * 1024];
- int total_bytes = 0;
- DWORD bytes_read;
- for (;;) {
- if (!ReadFile(file, buffer, sizeof(buffer), &bytes_read, NULL))
- return false;
- if (bytes_read == 0)
- break;
-
- bool final = false;
- if (bytes_read < sizeof(buffer))
- final = true;
-
- DWORD to_write = final ? sizeof(buffer) : bytes_read;
-
- DWORD actual;
- SetFilePointer(file, total_bytes, 0, FILE_BEGIN);
- if (!WriteFile(file, buffer, to_write, &actual, NULL))
- return false;
- total_bytes += bytes_read;
-
- if (final) {
- SetFilePointer(file, total_bytes, 0, FILE_BEGIN);
- SetEndOfFile(file);
- break;
- }
- }
- return true;
-}
-
} // namespace file_util
« no previous file with comments | « base/file_util_mac.mm ('k') | chrome/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698