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

Unified Diff: base/perftimer.cc

Issue 6005: Cross-platform equivalent of fopen, _wfopen_s etc.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 months 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
Index: base/perftimer.cc
===================================================================
--- base/perftimer.cc (revision 2711)
+++ base/perftimer.cc (working copy)
@@ -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 @@
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 @@
NOTREACHED();
return;
}
- fclose(perf_log_file);
+ file_util::CloseFile(perf_log_file);
}
void LogPerfResult(const char* test_name, double value, const char* units) {

Powered by Google App Engine
This is Rietveld 408576698