diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 20:03:54 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 20:03:54 +0000 |
commit | 1ecbf13615d89a0e0369cab2e70692d5b9a46341 (patch) | |
tree | 8938e0f033cb69a1ef1c4b009396bec20c4e623a /chrome | |
parent | 91a55b979b98d4dd69c7dcf61bc408ae230efab1 (diff) | |
download | chromium_src-1ecbf13615d89a0e0369cab2e70692d5b9a46341.zip chromium_src-1ecbf13615d89a0e0369cab2e70692d5b9a46341.tar.gz chromium_src-1ecbf13615d89a0e0369cab2e70692d5b9a46341.tar.bz2 |
Port flush_cache tool and perf_tests.
BUG=4160,4263
Review URL: http://codereview.chromium.org/9639
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/safe_browsing/database_perftest.cc | 176 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database.h | 6 | ||||
-rw-r--r-- | chrome/browser/visitedlink_perftest.cc | 4 | ||||
-rw-r--r-- | chrome/chrome.scons | 2 | ||||
-rw-r--r-- | chrome/test/perf/perftests.cc | 9 | ||||
-rw-r--r-- | chrome/test/perf/perftests.scons | 68 | ||||
-rw-r--r-- | chrome/tools/perf/flush_cache/flush_cache.cc | 6 |
7 files changed, 139 insertions, 132 deletions
diff --git a/chrome/browser/safe_browsing/database_perftest.cc b/chrome/browser/safe_browsing/database_perftest.cc index 273bda4..0da2ffc 100644 --- a/chrome/browser/safe_browsing/database_perftest.cc +++ b/chrome/browser/safe_browsing/database_perftest.cc @@ -5,25 +5,26 @@ #include <stdio.h> #include <stdlib.h> +#include <limits> #include <set> +#include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "base/perftimer.h" +#include "base/rand_util.h" +#include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/test_file_util.h" #include "chrome/browser/safe_browsing/safe_browsing_database.h" +#include "chrome/browser/safe_browsing/safe_browsing_database_impl.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/sqlite_compiled_statement.h" #include "chrome/common/sqlite_utils.h" +#include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -// These tests are slow, especially the ones that create databases. So disable -// them by default. -//#define SAFE_BROWSING_DATABASE_TESTS_ENABLED -#ifdef SAFE_BROWSING_DATABASE_TESTS_ENABLED - namespace { // Base class for a safebrowsing database. Derived classes can implement @@ -35,28 +36,27 @@ class Database { ~Database() { if (db_) { - statement_cache_.Cleanup(); sqlite3_close(db_); db_ = NULL; } } - bool Init(const std::string& name, bool create) { + bool Init(const FilePath& name, bool create) { // get an empty file for the test DB - std::wstring filename; + FilePath filename; PathService::Get(base::DIR_TEMP, &filename); - filename.push_back(FilePath::kSeparators[0]); - filename.append(ASCIIToWide(name)); + filename = filename.Append(name); if (create) { - DeleteFile(filename.c_str()); + file_util::Delete(filename, false); } else { - DLOG(INFO) << "evicting " << name << " ..."; - file_util::EvictFileFromSystemCache(filename.c_str()); + DLOG(INFO) << "evicting " << name.value() << " ..."; + file_util::EvictFileFromSystemCache(filename); DLOG(INFO) << "... evicted"; } - if (sqlite3_open(WideToUTF8(filename).c_str(), &db_) != SQLITE_OK) + const std::string sqlite_path = WideToUTF8(filename.ToWStringHack()); + if (sqlite3_open(sqlite_path.c_str(), &db_) != SQLITE_OK) return false; statement_cache_.set_db(db_); @@ -197,7 +197,7 @@ class IndexedWithIDDatabase : public SimpleDatabase { } }; -} +} // namespace class SafeBrowsing: public testing::Test { protected: @@ -253,7 +253,8 @@ class SafeBrowsing: public testing::Test { db_name_.append(count_start); db_name_.append(db_->GetDBSuffix()); - ASSERT_TRUE(db_->Init(db_name_, type == WRITE)); + FilePath path = FilePath::FromWStringHack(ASCIIToWide(db_name_)); + ASSERT_TRUE(db_->Init(path, type == WRITE)); if (type == WRITE) { WriteEntries(size); @@ -275,10 +276,9 @@ class SafeBrowsing: public testing::Test { SQLTransaction transaction(db_->db()); transaction.Begin(); - int inc = kint32max / count; for (int i = 0; i < count; i++) { - int hostkey; - rand_s((unsigned int*)&hostkey); + int hostkey = base::RandInt(std::numeric_limits<int>::min(), + std::numeric_limits<int>::max()); ASSERT_TRUE(db_->Add(hostkey, prefixes, 1)); } @@ -292,8 +292,8 @@ class SafeBrowsing: public testing::Test { int64 total_ms = 0; for (int i = 0; i < count; ++i) { - int key; - rand_s((unsigned int*)&key); + int key = base::RandInt(std::numeric_limits<int>::min(), + std::numeric_limits<int>::max()); PerfTimer timer; @@ -332,74 +332,75 @@ class SafeBrowsing: public testing::Test { std::string db_name_; }; -TEST_F(SafeBrowsing, Write_100K) { +TEST_F(SafeBrowsing, DISABLED_Write_100K) { } -TEST_F(SafeBrowsing, Read_100K) { +TEST_F(SafeBrowsing, DISABLED_Read_100K) { } -TEST_F(SafeBrowsing, WriteIndexed_100K) { +TEST_F(SafeBrowsing, DISABLED_WriteIndexed_100K) { } -TEST_F(SafeBrowsing, ReadIndexed_100K) { +TEST_F(SafeBrowsing, DISABLED_ReadIndexed_100K) { } -TEST_F(SafeBrowsing, WriteIndexed_250K) { +TEST_F(SafeBrowsing, DISABLED_WriteIndexed_250K) { } -TEST_F(SafeBrowsing, ReadIndexed_250K) { +TEST_F(SafeBrowsing, DISABLED_ReadIndexed_250K) { } -TEST_F(SafeBrowsing, WriteIndexed_500K) { +TEST_F(SafeBrowsing, DISABLED_WriteIndexed_500K) { } -TEST_F(SafeBrowsing, ReadIndexed_500K) { +TEST_F(SafeBrowsing, DISABLED_ReadIndexed_500K) { } -TEST_F(SafeBrowsing, ReadIndexedWithID_250K) { +TEST_F(SafeBrowsing, DISABLED_WriteIndexedWithID_250K) { } -TEST_F(SafeBrowsing, WriteIndexedWithID_250K) { +TEST_F(SafeBrowsing, DISABLED_ReadIndexedWithID_250K) { } -TEST_F(SafeBrowsing, ReadIndexedWithID_500K) { +TEST_F(SafeBrowsing, DISABLED_WriteIndexedWithID_500K) { } -TEST_F(SafeBrowsing, WriteIndexedWithID_500K) { +TEST_F(SafeBrowsing, DISABLED_ReadIndexedWithID_500K) { } -TEST_F(SafeBrowsing, CountIndexed_250K) { +TEST_F(SafeBrowsing, DISABLED_CountIndexed_250K) { } -TEST_F(SafeBrowsing, CountIndexed_500K) { +TEST_F(SafeBrowsing, DISABLED_CountIndexed_500K) { } -TEST_F(SafeBrowsing, CountIndexedWithID_250K) { +TEST_F(SafeBrowsing, DISABLED_CountIndexedWithID_250K) { } -TEST_F(SafeBrowsing, CountIndexedWithID_500K) { +TEST_F(SafeBrowsing, DISABLED_CountIndexedWithID_500K) { } class SafeBrowsingDatabaseTest { public: - SafeBrowsingDatabaseTest(const std::wstring& name) { + SafeBrowsingDatabaseTest(const FilePath& filename) { logging::InitLogging( NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); - PathService::Get(base::DIR_TEMP, &filename_); - filename_.push_back(FilePath::kSeparators[0]); - filename_.append(name); + std::wstring tmp_path; + PathService::Get(base::DIR_TEMP, &tmp_path); + path_ = FilePath::FromWStringHack(tmp_path); + path_ = path_.Append(filename); } void Create(int size) { - DeleteFile(filename_.c_str()); + file_util::Delete(path_, false); - SafeBrowsingDatabase database; - database.set_synchronous(); - EXPECT_TRUE(database.Init(filename_)); + scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); + database->SetSynchronous(); + EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); int chunk_id = 0; int total_host_keys = size; @@ -413,7 +414,8 @@ class SafeBrowsingDatabaseTest { for (int j = 0; j < host_keys_per_chunk; ++j) { SBChunkHost host; - rand_s((unsigned int*)&host.host); + host.host = base::RandInt(std::numeric_limits<int>::min(), + std::numeric_limits<int>::max()); host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2); host.entry->SetPrefixAt(0, 0x2425525); host.entry->SetPrefixAt(1, 0x1536366); @@ -422,32 +424,37 @@ class SafeBrowsingDatabaseTest { } } - database.InsertChunks("goog-malware", chunks); + database->InsertChunks("goog-malware", chunks); } void Read(bool use_bloom_filter) { int keys_to_read = 500; - file_util::EvictFileFromSystemCache(filename_.c_str()); + file_util::EvictFileFromSystemCache(path_); - SafeBrowsingDatabase database; - database.set_synchronous(); - EXPECT_TRUE(database.Init(filename_)); + scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); + database->SetSynchronous(); + EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); PerfTimer total_timer; int64 db_ms = 0; int keys_from_db = 0; for (int i = 0; i < keys_to_read; ++i) { - int key; - rand_s((unsigned int*)&key); + int key = base::RandInt(std::numeric_limits<int>::min(), + std::numeric_limits<int>::max()); std::string url = StringPrintf("http://www.%d.com/blah.html", key); std::string matching_list; std::vector<SBPrefix> prefix_hits; + std::vector<SBFullHashResult> full_hits; GURL gurl(url); - if (!use_bloom_filter || database.NeedToCheckUrl(gurl)) { + if (!use_bloom_filter || database->NeedToCheckUrl(gurl)) { PerfTimer timer; - database.ContainsUrl(gurl, &matching_list, &prefix_hits); + database->ContainsUrl(gurl, + &matching_list, + &prefix_hits, + &full_hits, + base::Time::Now()); int64 time_ms = timer.Elapsed().InMilliseconds(); @@ -460,81 +467,80 @@ class SafeBrowsingDatabaseTest { int64 total_ms = total_timer.Elapsed().InMilliseconds(); - DLOG(INFO) << WideToASCII(file_util::GetFilenameFromPath(filename_)) << - " read " << keys_to_read << " entries in " << total_ms << " ms. " << - keys_from_db << " keys were read from the db, with average read taking " << + DLOG(INFO) << path_.BaseName().value() << " read " << keys_to_read << + " entries in " << total_ms << " ms. " << keys_from_db << + " keys were read from the db, with average read taking " << db_ms / keys_from_db << " ms"; } void BuildBloomFilter() { - file_util::EvictFileFromSystemCache(filename_.c_str()); - file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename(filename_), false); + file_util::EvictFileFromSystemCache(path_); + file_util::Delete(SafeBrowsingDatabase::BloomFilterFilename( + path_.ToWStringHack()), false); PerfTimer total_timer; - SafeBrowsingDatabase database; - database.set_synchronous(); - EXPECT_TRUE(database.Init(filename_)); + scoped_ptr<SafeBrowsingDatabase> database(SafeBrowsingDatabase::Create()); + database->SetSynchronous(); + EXPECT_TRUE(database->Init(path_.ToWStringHack(), NULL)); int64 total_ms = total_timer.Elapsed().InMilliseconds(); - DLOG(INFO) << WideToASCII(file_util::GetFilenameFromPath(filename_)) << + DLOG(INFO) << path_.BaseName().value() << " built bloom filter in " << total_ms << " ms."; } private: - std::wstring filename_; + FilePath path_; }; // Adds 100K host records. -TEST(SafeBrowsingDatabase, FillUp100K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing100K"); +TEST(SafeBrowsingDatabase, DISABLED_FillUp100K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing100K"))); db.Create(100000); } // Adds 250K host records. -TEST(SafeBrowsingDatabase, FillUp250K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); +TEST(SafeBrowsingDatabase, DISABLED_FillUp250K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); db.Create(250000); } // Adds 500K host records. -TEST(SafeBrowsingDatabase, FillUp500K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); +TEST(SafeBrowsingDatabase, DISABLED_FillUp500K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); db.Create(500000); } // Reads 500 entries and prints the timing. -TEST(SafeBrowsingDatabase, ReadFrom250K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); +TEST(SafeBrowsingDatabase, DISABLED_ReadFrom250K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); db.Read(false); } -TEST(SafeBrowsingDatabase, ReadFrom500K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); +TEST(SafeBrowsingDatabase, DISABLED_ReadFrom500K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); db.Read(false); } // Read 500 entries with a bloom filter and print the timing. -TEST(SafeBrowsingDatabase, BloomReadFrom250K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); +TEST(SafeBrowsingDatabase, DISABLED_BloomReadFrom250K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); db.Read(true); } -TEST(SafeBrowsingDatabase, BloomReadFrom500K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); +TEST(SafeBrowsingDatabase, DISABLED_BloomReadFrom500K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); db.Read(true); } // Test how long bloom filter creation takes. -TEST(SafeBrowsingDatabase, BuildBloomFilter250K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing250K"); +TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter250K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing250K"))); db.BuildBloomFilter(); } -TEST(SafeBrowsingDatabase, BuildBloomFilter500K) { - SafeBrowsingDatabaseTest db(L"SafeBrowsing500K"); +TEST(SafeBrowsingDatabase, DISABLED_BuildBloomFilter500K) { + SafeBrowsingDatabaseTest db(FilePath(FILE_PATH_LITERAL("SafeBrowsing500K"))); db.BuildBloomFilter(); } - -#endif diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index 5e38763..6e6612a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -89,6 +89,9 @@ class SafeBrowsingDatabase { virtual std::wstring filename() const { return filename_; } protected: + friend class SafeBrowsingDatabaseTest; + FRIEND_TEST(SafeBrowsingDatabase, HashCaching); + static std::wstring BloomFilterFilename(const std::wstring& db_filename); // Load the bloom filter off disk, or generates one if it doesn't exist. @@ -106,9 +109,6 @@ class SafeBrowsingDatabase { // Measuring false positive rate. Call this each time we look in the filter. virtual void IncrementBloomFilterReadCount() {} - // Full hash cache support. - FRIEND_TEST(SafeBrowsingDatabase, HashCaching); - typedef struct HashCacheEntry { SBFullHash full_hash; int list_id; diff --git a/chrome/browser/visitedlink_perftest.cc b/chrome/browser/visitedlink_perftest.cc index d589f92..3775fab 100644 --- a/chrome/browser/visitedlink_perftest.cc +++ b/chrome/browser/visitedlink_perftest.cc @@ -6,6 +6,7 @@ #include <string> #include <vector> +#include "base/file_path.h" #include "base/file_util.h" #include "base/perftimer.h" #include "base/shared_memory.h" @@ -143,7 +144,8 @@ TEST_F(VisitedLink, TestLoad) { for (int i = 0; i < load_count; i++) { // make sure the file has to be re-loaded - file_util::EvictFileFromSystemCache(db_name_.c_str()); + file_util::EvictFileFromSystemCache( + FilePath::FromWStringHack(std::wstring(db_name_))); // cold load (no OS cache, hopefully) { diff --git a/chrome/chrome.scons b/chrome/chrome.scons index a012047..78d63b8 100644 --- a/chrome/chrome.scons +++ b/chrome/chrome.scons @@ -93,7 +93,6 @@ if env['PLATFORM'] != 'win32': 'test/memory_test/memory_test.scons', 'test/mini_installer_test/mini_installer_test.scons', 'test/page_cycler/page_cycler_tests.scons', - 'test/perf/perftests.scons', 'test/plugin/plugin_tests.scons', 'test/reliability/reliability_tests.scons', 'test/security_tests/security_tests.scons', @@ -103,7 +102,6 @@ if env['PLATFORM'] != 'win32': 'test/ui/ui_tests.scons', 'tools/convert_dict/convert_dict.scons', 'tools/crash_service/crash_service.scons', - 'tools/perf/flush_cache/flush_cache.scons', 'tools/profiles/generate_profile.scons', ] sconscript_files = list(set(sconscript_files) - set(remove_files)) diff --git a/chrome/test/perf/perftests.cc b/chrome/test/perf/perftests.cc index 3e67a6b..18d92aa 100644 --- a/chrome/test/perf/perftests.cc +++ b/chrome/test/perf/perftests.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/at_exit.h" +#include "base/command_line.h" +#include "base/debug_util.h" #include "base/message_loop.h" #include "base/perftimer.h" #include "base/process_util.h" @@ -11,7 +14,9 @@ // TODO(darin): share code with base/run_all_perftests.cc int main(int argc, char **argv) { + base::AtExitManager exit_manager; base::EnableTerminationOnHeapCorruption(); + CommandLine::SetArgcArgv(argc, argv); chrome::RegisterPathProvider(); MessageLoop main_message_loop; @@ -43,8 +48,8 @@ int main(int argc, char **argv) { // Raise to high priority to have more precise measurements. Since we don't // aim at 1% precision, it is not necessary to run at realtime level. - if (!IsDebuggerPresent()) { - SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + if (!DebugUtil::BeingDebugged()) { + base::RaiseProcessToHighPriority(); } int result = RUN_ALL_TESTS(); diff --git a/chrome/test/perf/perftests.scons b/chrome/test/perf/perftests.scons index d93f4a6..c089027 100644 --- a/chrome/test/perf/perftests.scons +++ b/chrome/test/perf/perftests.scons @@ -1,29 +1,22 @@ -# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +# Copyright (c) 2008 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +__doc__ = """ +Configuration for building the perf_tests{,.exe} executable. +""" + Import('env') env = env.Clone() env.ApplySConscript([ - '$BASE_DIR/gfx/using_base_gfx.scons', '$BASE_DIR/using_base.scons', - '$BZIP2_DIR/using_bzip2.scons', - '$CHROME_DIR/third_party/hunspell/using_hunspell.scons', + '$NET_DIR/using_net.scons', '$CHROME_SRC_DIR/build/using_googleurl.scons', - '$CHROME_SRC_DIR/build/using_v8.scons', '$GTEST_DIR/../using_gtest.scons', '$ICU38_DIR/using_icu38.scons', - '$LIBJPEG_DIR/using_libjpeg.scons', - '$LIBPNG_DIR/using_libpng.scons', - '$LIBXML_DIR/using_libxml.scons', - '$LIBXSLT_DIR/using_libxslt.scons', '$MODP_B64_DIR/using_modp_b64.scons', - '$NET_DIR/using_net.scons', - '$SDCH_DIR/using_sdch.scons', - '$SKIA_DIR/using_skia.scons', - '$ZLIB_DIR/using_zlib.scons', ]) env.Prepend( @@ -31,35 +24,16 @@ env.Prepend( 'PERF_TEST', ], LIBS = [ - 'activex_shim', 'browser', - 'browser_views', 'common', - 'debugger', - 'default_plugin', - 'glue', - 'JavaScriptCore_pcre', - 'plugin', - 'port', - 'renderer', 'sqlite', - 'util', - 'v8_snapshot', - 'V8Bindings', - 'views', - 'WebCore', - 'WTF', ], ) -if env['PLATFORM'] == 'win32': - env.Prepend( - LIBS = [ - 'rpcrt4', - 'shlwapi', - 'winmm', - ], - ) +if env['PLATFORM'] in ('posix', 'darwin'): + env.SConscript([ + '$LIBEVENT_DIR/using_libevent.scons', + ], {'env':env}) input_files = [ 'perftests.cc', @@ -71,4 +45,24 @@ input_files = [ '$CHROME_DIR/common/json_value_serializer_perftest.cc', ] -env.ChromeTestProgram('perf_tests', input_files) +if env['PLATFORM'] == 'win32': + env.Prepend( + LIBS = [ + 'rpcrt4', + 'shlwapi', + 'winmm', + ] + ) + +if env['PLATFORM'] != 'win32': + # TODO(port): Port these files. + remove_files = [ + 'url_parse_perftest.cc', + '$CHROME_DIR/browser/visitedlink_master$OBJSUFFIX', + '$CHROME_DIR/browser/visitedlink_perftest.cc', + ] + for file in remove_files: + input_files.remove(file) + +if env['PLATFORM'] in ('posix', 'win32'): + env.ChromeTestProgram('perf_tests', input_files) diff --git a/chrome/tools/perf/flush_cache/flush_cache.cc b/chrome/tools/perf/flush_cache/flush_cache.cc index d6ba850..e178da4e 100644 --- a/chrome/tools/perf/flush_cache/flush_cache.cc +++ b/chrome/tools/perf/flush_cache/flush_cache.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This little program attempts to flush the disk cache for some files. +// This little program attempts to flush the system cache for some files. // It's useful for testing Chrome with a cold database. +#include "base/file_path.h" #include "base/string_piece.h" #include "base/process_util.h" #include "base/sys_string_conversions.h" @@ -20,7 +21,8 @@ int main(int argc, const char* argv[]) { for (int i = 1; i < argc; ++i) { std::wstring filename = base::SysNativeMBToWide(argv[i]); - if (!file_util::EvictFileFromSystemCache(filename.c_str())) { + FilePath path = FilePath::FromWStringHack(filename); + if (!file_util::EvictFileFromSystemCache(path)) { fprintf(stderr, "Failed to evict %s from cache -- is it a directory?\n", argv[i]); } |