OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/logging.h" | 5 #include "base/logging.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 typedef HANDLE FileHandle; | 9 typedef HANDLE FileHandle; |
10 typedef HANDLE MutexHandle; | 10 typedef HANDLE MutexHandle; |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include <iomanip> | 33 #include <iomanip> |
34 #include <cstring> | 34 #include <cstring> |
35 #include <algorithm> | 35 #include <algorithm> |
36 | 36 |
37 #include "base/base_switches.h" | 37 #include "base/base_switches.h" |
38 #include "base/command_line.h" | 38 #include "base/command_line.h" |
39 #include "base/debug_util.h" | 39 #include "base/debug_util.h" |
40 #include "base/lock_impl.h" | 40 #include "base/lock_impl.h" |
41 #include "base/string_piece.h" | 41 #include "base/string_piece.h" |
42 #include "base/string_util.h" | 42 #include "base/string_util.h" |
43 #include "base/sys_string_conversions.h" | 43 #include "base/utf_string_conversions.h" |
44 | 44 |
45 namespace logging { | 45 namespace logging { |
46 | 46 |
47 static const int kErrorMessageBufferSize = 256; | 47 static const int kErrorMessageBufferSize = 256; |
48 | 48 |
49 #ifdef OS_POSIX | 49 #ifdef OS_POSIX |
50 // Wrapper for strerror_r functions that implement the POSIX interface. POSIX | 50 // Wrapper for strerror_r functions that implement the POSIX interface. POSIX |
51 // does not define the behaviour for some of the edge cases, so we wrap it to | 51 // does not define the behaviour for some of the edge cases, so we wrap it to |
52 // guarantee that they are handled. This is used on all POSIX platforms, but | 52 // guarantee that they are handled. This is used on all POSIX platforms, but |
53 // on Linux there are some more cases (see below). | 53 // on Linux there are some more cases (see below). |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 #if defined(OS_WIN) | 428 #if defined(OS_WIN) |
429 // look for the debug dialog program next to our application | 429 // look for the debug dialog program next to our application |
430 wchar_t prog_name[MAX_PATH]; | 430 wchar_t prog_name[MAX_PATH]; |
431 GetModuleFileNameW(NULL, prog_name, MAX_PATH); | 431 GetModuleFileNameW(NULL, prog_name, MAX_PATH); |
432 wchar_t* backslash = wcsrchr(prog_name, '\\'); | 432 wchar_t* backslash = wcsrchr(prog_name, '\\'); |
433 if (backslash) | 433 if (backslash) |
434 backslash[1] = 0; | 434 backslash[1] = 0; |
435 wcscat_s(prog_name, MAX_PATH, L"debug_message.exe"); | 435 wcscat_s(prog_name, MAX_PATH, L"debug_message.exe"); |
436 | 436 |
437 std::wstring cmdline = base::SysUTF8ToWide(str); | 437 std::wstring cmdline = UTF8ToWide(str); |
438 if (cmdline.empty()) | 438 if (cmdline.empty()) |
439 return; | 439 return; |
440 | 440 |
441 STARTUPINFO startup_info; | 441 STARTUPINFO startup_info; |
442 memset(&startup_info, 0, sizeof(startup_info)); | 442 memset(&startup_info, 0, sizeof(startup_info)); |
443 startup_info.cb = sizeof(startup_info); | 443 startup_info.cb = sizeof(startup_info); |
444 | 444 |
445 PROCESS_INFORMATION process_info; | 445 PROCESS_INFORMATION process_info; |
446 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL, | 446 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL, |
447 NULL, &startup_info, &process_info)) { | 447 NULL, &startup_info, &process_info)) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 if (!log_file) | 766 if (!log_file) |
767 return; | 767 return; |
768 | 768 |
769 CloseFile(log_file); | 769 CloseFile(log_file); |
770 log_file = NULL; | 770 log_file = NULL; |
771 } | 771 } |
772 | 772 |
773 } // namespace logging | 773 } // namespace logging |
774 | 774 |
775 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 775 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
776 return out << base::SysWideToUTF8(std::wstring(wstr)); | 776 return out << WideToUTF8(std::wstring(wstr)); |
777 } | 777 } |
OLD | NEW |