diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 17:40:13 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 17:40:13 +0000 |
commit | 836f134c56bfa714217ca12a73482205c1480774 (patch) | |
tree | 5c5b9d938a712e09831bdd32022e1b3716c5fbdf /base/perftimer.cc | |
parent | d46d6f3b80099ce0c630185a2e86b649bba49254 (diff) | |
download | chromium_src-836f134c56bfa714217ca12a73482205c1480774.zip chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.gz chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.bz2 |
Cross-platform wrappers for fopen, _wfopen_s, etc.
Patch by Paweł Hajdan jr <phajdan.jr@gmail.com>.
http://codereview.chromium.org/6005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/perftimer.cc')
-rw-r--r-- | base/perftimer.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/base/perftimer.cc b/base/perftimer.cc index 1231923..9fc0328 100644 --- a/base/perftimer.cc +++ b/base/perftimer.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdio.h> - #include "base/perftimer.h" +#include <stdio.h> +#include <string> + #include "base/basictypes.h" +#include "base/file_util.h" #include "base/logging.h" static FILE* perf_log_file = NULL; @@ -18,12 +20,8 @@ bool InitPerfLog(const char* log_file) { return false; } -#if defined(OS_WIN) - return fopen_s(&perf_log_file, log_file, "w") == 0; -#elif defined(OS_POSIX) - perf_log_file = fopen(log_file, "w"); + perf_log_file = file_util::OpenFile(std::string(log_file), "w"); return perf_log_file != NULL; -#endif } void FinalizePerfLog() { @@ -32,7 +30,7 @@ void FinalizePerfLog() { NOTREACHED(); return; } - fclose(perf_log_file); + file_util::CloseFile(perf_log_file); } void LogPerfResult(const char* test_name, double value, const char* units) { |