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

Side by Side Diff: base/logging.cc

Issue 6482013: Mac: Don't show dialogs for debug messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 10 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 | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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;
11 typedef HANDLE MutexHandle; 11 typedef HANDLE MutexHandle;
12 // Windows warns on using write(). It prefers _write(). 12 // Windows warns on using write(). It prefers _write().
13 #define write(fd, buf, count) _write(fd, buf, static_cast<unsigned int>(count)) 13 #define write(fd, buf, count) _write(fd, buf, static_cast<unsigned int>(count))
14 // Windows doesn't define STDERR_FILENO. Define it here. 14 // Windows doesn't define STDERR_FILENO. Define it here.
15 #define STDERR_FILENO 2 15 #define STDERR_FILENO 2
16 #elif defined(OS_MACOSX) 16 #elif defined(OS_MACOSX)
17 #include <CoreFoundation/CoreFoundation.h>
18 #include <mach/mach.h> 17 #include <mach/mach.h>
19 #include <mach/mach_time.h> 18 #include <mach/mach_time.h>
20 #include <mach-o/dyld.h> 19 #include <mach-o/dyld.h>
21 #elif defined(OS_POSIX) 20 #elif defined(OS_POSIX)
22 #if defined(OS_NACL) 21 #if defined(OS_NACL)
23 #include <sys/nacl_syscalls.h> 22 #include <sys/nacl_syscalls.h>
24 #include <sys/time.h> // timespec doesn't seem to be in <time.h> 23 #include <sys/time.h> // timespec doesn't seem to be in <time.h>
25 #else 24 #else
26 #include <sys/syscall.h> 25 #include <sys/syscall.h>
27 #endif 26 #endif
(...skipping 22 matching lines...) Expand all
50 #include "base/debug/debugger.h" 49 #include "base/debug/debugger.h"
51 #include "base/debug/stack_trace.h" 50 #include "base/debug/stack_trace.h"
52 #include "base/eintr_wrapper.h" 51 #include "base/eintr_wrapper.h"
53 #include "base/string_piece.h" 52 #include "base/string_piece.h"
54 #include "base/synchronization/lock_impl.h" 53 #include "base/synchronization/lock_impl.h"
55 #include "base/utf_string_conversions.h" 54 #include "base/utf_string_conversions.h"
56 #include "base/vlog.h" 55 #include "base/vlog.h"
57 #if defined(OS_POSIX) 56 #if defined(OS_POSIX)
58 #include "base/safe_strerror_posix.h" 57 #include "base/safe_strerror_posix.h"
59 #endif 58 #endif
60 #if defined(OS_MACOSX)
61 #include "base/mac/scoped_cftyperef.h"
62 #include "base/sys_string_conversions.h"
63 #endif
64 59
65 namespace logging { 60 namespace logging {
66 61
67 DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; 62 DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
68 VlogInfo* g_vlog_info = NULL; 63 VlogInfo* g_vlog_info = NULL;
69 64
70 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { 65 const char* const log_severity_names[LOG_NUM_SEVERITIES] = {
71 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; 66 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" };
72 67
73 int min_log_level = 0; 68 int min_log_level = 0;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL, 491 if (CreateProcessW(prog_name, &cmdline[0], NULL, NULL, false, 0, NULL,
497 NULL, &startup_info, &process_info)) { 492 NULL, &startup_info, &process_info)) {
498 WaitForSingleObject(process_info.hProcess, INFINITE); 493 WaitForSingleObject(process_info.hProcess, INFINITE);
499 CloseHandle(process_info.hThread); 494 CloseHandle(process_info.hThread);
500 CloseHandle(process_info.hProcess); 495 CloseHandle(process_info.hProcess);
501 } else { 496 } else {
502 // debug process broken, let's just do a message box 497 // debug process broken, let's just do a message box
503 MessageBoxW(NULL, &cmdline[0], L"Fatal error", 498 MessageBoxW(NULL, &cmdline[0], L"Fatal error",
504 MB_OK | MB_ICONHAND | MB_TOPMOST); 499 MB_OK | MB_ICONHAND | MB_TOPMOST);
505 } 500 }
506 #elif defined(OS_MACOSX)
507 base::mac::ScopedCFTypeRef<CFStringRef> message(
508 base::SysUTF8ToCFStringRef(str));
509 CFUserNotificationDisplayNotice(0, kCFUserNotificationStopAlertLevel,
510 NULL, NULL, NULL, CFSTR("Fatal Error"),
511 message, NULL);
512 #else 501 #else
513 // We intentionally don't implement a dialog on other platforms. 502 // We intentionally don't implement a dialog on other platforms.
514 // You can just look at stderr. 503 // You can just look at stderr.
515 #endif 504 #endif
516 } 505 }
517 506
518 #if defined(OS_WIN) 507 #if defined(OS_WIN)
519 LogMessage::SaveLastError::SaveLastError() : last_error_(::GetLastError()) { 508 LogMessage::SaveLastError::SaveLastError() : last_error_(::GetLastError()) {
520 } 509 }
521 510
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 808
820 if (level == LOG_FATAL) 809 if (level == LOG_FATAL)
821 base::debug::BreakDebugger(); 810 base::debug::BreakDebugger();
822 } 811 }
823 812
824 } // namespace logging 813 } // namespace logging
825 814
826 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { 815 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
827 return out << WideToUTF8(std::wstring(wstr)); 816 return out << WideToUTF8(std::wstring(wstr));
828 } 817 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698