OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <io.h> | 8 #include <io.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 typedef HANDLE FileHandle; | 10 typedef HANDLE FileHandle; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // process that displays its command line. We look for "Debug | 487 // process that displays its command line. We look for "Debug |
488 // Message.exe" in the same directory as the application. If it | 488 // Message.exe" in the same directory as the application. If it |
489 // exists, we use it, otherwise, we use a regular message box. | 489 // exists, we use it, otherwise, we use a regular message box. |
490 wchar_t prog_name[MAX_PATH]; | 490 wchar_t prog_name[MAX_PATH]; |
491 GetModuleFileNameW(NULL, prog_name, MAX_PATH); | 491 GetModuleFileNameW(NULL, prog_name, MAX_PATH); |
492 wchar_t* backslash = wcsrchr(prog_name, '\\'); | 492 wchar_t* backslash = wcsrchr(prog_name, '\\'); |
493 if (backslash) | 493 if (backslash) |
494 backslash[1] = 0; | 494 backslash[1] = 0; |
495 wcscat_s(prog_name, MAX_PATH, L"debug_message.exe"); | 495 wcscat_s(prog_name, MAX_PATH, L"debug_message.exe"); |
496 | 496 |
497 std::wstring cmdline = UTF8ToWide(str); | 497 std::wstring cmdline = base::UTF8ToWide(str); |
498 if (cmdline.empty()) | 498 if (cmdline.empty()) |
499 return; | 499 return; |
500 | 500 |
501 STARTUPINFO startup_info; | 501 STARTUPINFO startup_info; |
502 memset(&startup_info, 0, sizeof(startup_info)); | 502 memset(&startup_info, 0, sizeof(startup_info)); |
503 startup_info.cb = sizeof(startup_info); | 503 startup_info.cb = sizeof(startup_info); |
504 | 504 |
505 PROCESS_INFORMATION process_info; | 505 PROCESS_INFORMATION process_info; |
506 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL, | 506 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL, |
507 NULL, &startup_info, &process_info)) { | 507 NULL, &startup_info, &process_info)) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 std::wstring GetLogFileFullPath() { | 855 std::wstring GetLogFileFullPath() { |
856 if (log_file_name) | 856 if (log_file_name) |
857 return *log_file_name; | 857 return *log_file_name; |
858 return std::wstring(); | 858 return std::wstring(); |
859 } | 859 } |
860 #endif | 860 #endif |
861 | 861 |
862 } // namespace logging | 862 } // namespace logging |
863 | 863 |
864 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { | 864 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { |
865 return out << WideToUTF8(std::wstring(wstr)); | 865 return out << base::WideToUTF8(std::wstring(wstr)); |
866 } | 866 } |
OLD | NEW |