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

Unified Diff: base/test_file_util_win.cc

Issue 9639: Port flush_cache tool. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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/test_file_util_mac.cc ('k') | chrome/browser/safe_browsing/database_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test_file_util_win.cc
===================================================================
--- base/test_file_util_win.cc (revision 6884)
+++ base/test_file_util_win.cc (working copy)
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/scoped_handle.h"
@@ -17,10 +18,10 @@
// our purpose fine since 4K is the page size on x86 as well as x64.
static const ptrdiff_t kPageSize = 4096;
-bool EvictFileFromSystemCache(const wchar_t* file) {
+bool EvictFileFromSystemCache(const FilePath& file) {
// Request exclusive access to the file and overwrite it with no buffering.
ScopedHandle file_handle(
- CreateFile(file, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+ CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
if (!file_handle)
return false;
@@ -85,8 +86,8 @@
// to open the file again, this time without the FILE_FLAG_NO_BUFFERING
// flag and use SetEndOfFile to mark EOF.
file_handle.Set(NULL);
- file_handle.Set(CreateFile(file, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
- 0, NULL));
+ file_handle.Set(CreateFile(file.value().c_str(), GENERIC_WRITE, 0, NULL,
+ OPEN_EXISTING, 0, NULL));
CHECK(SetFilePointer(file_handle, total_bytes, NULL, FILE_BEGIN) !=
INVALID_SET_FILE_POINTER);
CHECK(::SetEndOfFile(file_handle));
@@ -147,7 +148,7 @@
// files that are in the repository, and they will have read-only set.
// This will prevent us from evicting from the cache, but these don't
// matter anyway.
- EvictFileFromSystemCache(cur_dest_path.c_str());
+ EvictFileFromSystemCache(FilePath::FromWStringHack(cur_dest_path));
}
} while (FindNextFile(fh, &fd));
« no previous file with comments | « base/test_file_util_mac.cc ('k') | chrome/browser/safe_browsing/database_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698