summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-11 18:07:40 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-11 18:07:40 +0000
commit0d8a7a1b0662e50c962cd3f14d7ef1a65d5a630b (patch)
treecdfdedd91eaa12cd3e46064984f2e66f2a562bd3 /base/file_util_win.cc
parentcfe54f8ffaee27afc1deda0c9e8ada192df514fd (diff)
downloadchromium_src-0d8a7a1b0662e50c962cd3f14d7ef1a65d5a630b.zip
chromium_src-0d8a7a1b0662e50c962cd3f14d7ef1a65d5a630b.tar.gz
chromium_src-0d8a7a1b0662e50c962cd3f14d7ef1a65d5a630b.tar.bz2
* Revert "Por rt flush_cache tool."
This reverts commit 3bd600b37c5ee613c004c84736ee3cb69434562a. Review URL: http://codereview.chromium.org/9774 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc41
1 files changed, 0 insertions, 41 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 5f75544..355bdfd 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