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

Unified Diff: base/trace_event.cc

Issue 8825: Begin the first small step towards using FilePath everywhere: (Closed)
Patch Set: works on windows Created 12 years, 2 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
« no previous file with comments | « base/path_service_unittest.cc ('k') | chrome/browser/download/download_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event.cc
diff --git a/base/trace_event.cc b/base/trace_event.cc
index fa471846c642e2de92a23389fc38ac58010ee4d8..2aa9b6f73f6bf862a26583fdb9f3f04625ffe9cc 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -4,6 +4,7 @@
#include "base/trace_event.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/platform_thread.h"
@@ -21,7 +22,8 @@ static const char* kEventTypeNames[] = {
"INSTANT"
};
-static const wchar_t* kLogFileName = L"trace_%d.log";
+static const FilePath::CharType* kLogFileName =
+ FILE_PATH_LITERAL("trace_%d.log");
TraceLog::TraceLog() : enabled_(false), log_file_(NULL) {
ProcessHandle proc = process_util::GetCurrentProcessHandle();
@@ -83,15 +85,16 @@ void TraceLog::CloseLogFile() {
}
bool TraceLog::OpenLogFile() {
- std::wstring pid_filename =
- StringPrintf(kLogFileName, process_util::GetCurrentProcId());
- std::wstring log_file_name;
- PathService::Get(base::DIR_EXE, &log_file_name);
- file_util::AppendToPath(&log_file_name, pid_filename);
- log_file_ = file_util::OpenFile(log_file_name, "a");
+ FilePath::StringType pid_filename =
+ StringPrintf(kLogFileName, process_util::GetCurrentProcId());
+ FilePath log_file_path;
+ if (!PathService::Get(base::DIR_EXE, &log_file_path))
+ return false;
+ log_file_path = log_file_path.Append(pid_filename);
+ log_file_ = file_util::OpenFile(log_file_path, "a");
if (!log_file_) {
// try the current directory
- log_file_ = file_util::OpenFile(pid_filename, "a");
+ log_file_ = file_util::OpenFile(FilePath(pid_filename), "a");
if (!log_file_) {
return false;
}
« no previous file with comments | « base/path_service_unittest.cc ('k') | chrome/browser/download/download_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698