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

Side by Side Diff: chrome/tools/crash_service/main.cc

Issue 280004: Revert wstring patch (r29078 and follow up commits). It is causing failures o... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/mini_installer_test/run_all_unittests.cc ('k') | chrome_frame/chrome_launcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/tools/crash_service/crash_service.h" 5 #include "chrome/tools/crash_service/crash_service.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <tchar.h> 9 #include <tchar.h>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 15
16 namespace { 16 namespace {
17 17
18 const wchar_t kStandardLogFile[] = L"operation_log.txt"; 18 const wchar_t kStandardLogFile[] = L"operation_log.txt";
19 19
20 bool GetCrashServiceDirectory(FilePath* dir) { 20 bool GetCrashServiceDirectory(std::wstring* dir) {
21 FilePath temp_dir; 21 std::wstring temp_dir;
22 if (!file_util::GetTempDir(&temp_dir)) 22 if (!file_util::GetTempDir(&temp_dir))
23 return false; 23 return false;
24 temp_dir = temp_dir.Append(L"chrome_crashes"); 24 file_util::AppendToPath(&temp_dir, L"chrome_crashes");
25 if (!file_util::PathExists(temp_dir)) { 25 if (!file_util::PathExists(temp_dir)) {
26 if (!file_util::CreateDirectory(temp_dir)) 26 if (!file_util::CreateDirectory(temp_dir))
27 return false; 27 return false;
28 } 28 }
29 *dir = temp_dir; 29 *dir = temp_dir;
30 return true; 30 return true;
31 } 31 }
32 32
33 } // namespace. 33 } // namespace.
34 34
35 int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line, 35 int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line,
36 int show_mode) { 36 int show_mode) {
37 // Manages the destruction of singletons. 37 // Manages the destruction of singletons.
38 base::AtExitManager exit_manager; 38 base::AtExitManager exit_manager;
39 39
40 CommandLine::Init(0, NULL); 40 CommandLine::Init(0, NULL);
41 41
42 // We use/create a directory under the user's temp folder, for logging. 42 // We use/create a directory under the user's temp folder, for logging.
43 FilePath operating_dir; 43 std::wstring operating_dir;
44 GetCrashServiceDirectory(&operating_dir); 44 GetCrashServiceDirectory(&operating_dir);
45 FilePath log_file = operating_dir.Append(kStandardLogFile); 45 std::wstring log_file(operating_dir);
46 file_util::AppendToPath(&log_file, kStandardLogFile);
46 47
47 // Logging to a file with pid, tid and timestamp. 48 // Logging to a file with pid, tid and timestamp.
48 logging::InitLogging(log_file.value().c_str(), logging::LOG_ONLY_TO_FILE, 49 logging::InitLogging(log_file.c_str(), logging::LOG_ONLY_TO_FILE,
49 logging::LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE); 50 logging::LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE);
50 logging::SetLogItems(true, true, true, false); 51 logging::SetLogItems(true, true, true, false);
51 52
52 LOG(INFO) << "session start. cmdline is [" << cmd_line << "]"; 53 LOG(INFO) << "session start. cmdline is [" << cmd_line << "]";
53 54
54 CrashService crash_service(operating_dir.ToWStringHack()); 55 CrashService crash_service(operating_dir);
55 if (!crash_service.Initialize(::GetCommandLineW())) 56 if (!crash_service.Initialize(::GetCommandLineW()))
56 return 1; 57 return 1;
57 58
58 LOG(INFO) << "ready to process crash requests"; 59 LOG(INFO) << "ready to process crash requests";
59 60
60 // Enter the message loop. 61 // Enter the message loop.
61 int retv = crash_service.ProcessingLoop(); 62 int retv = crash_service.ProcessingLoop();
62 // Time to exit. 63 // Time to exit.
63 LOG(INFO) << "session end. return code is " << retv; 64 LOG(INFO) << "session end. return code is " << retv;
64 return retv; 65 return retv;
65 } 66 }
OLDNEW
« no previous file with comments | « chrome/test/mini_installer_test/run_all_unittests.cc ('k') | chrome_frame/chrome_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698