diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 23:54:04 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 23:54:04 +0000 |
commit | 640517fdd23e08ed95cf129d27457db817ee6124 (patch) | |
tree | 2674bc857b9d1b566e05bcfa1dd5c8cfd1897dbf /base/trace_event.cc | |
parent | f92ed219c9aeeed79993d1d32f34e5d5c9888dbe (diff) | |
download | chromium_src-640517fdd23e08ed95cf129d27457db817ee6124.zip chromium_src-640517fdd23e08ed95cf129d27457db817ee6124.tar.gz chromium_src-640517fdd23e08ed95cf129d27457db817ee6124.tar.bz2 |
Begin the first small step towards using FilePath everywhere:
- Add some transition APIs.
- Start migrating some code to transition APIs.
Review URL: http://codereview.chromium.org/8825
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/trace_event.cc')
-rw-r--r-- | base/trace_event.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/base/trace_event.cc b/base/trace_event.cc index fa47184..2aa9b6f 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; } |