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

Side by Side Diff: chrome/browser/browser_main_gtk.cc

Issue 3175038: Allow overriding of X error functions (Closed)
Patch Set: Messed up #ifdef Created 10 years, 3 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
« no previous file with comments | « chrome/browser/browser_main_gtk.h ('k') | chrome/browser/browser_process_impl.cc » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include "app/x11_util.h"
8 #include "app/x11_util_internal.h"
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/debug_util.h" 10 #include "base/debug_util.h"
11 #include "chrome/browser/browser_list.h"
12 #include "chrome/browser/browser_main_gtk.h"
9 #include "chrome/browser/browser_main_win.h" 13 #include "chrome/browser/browser_main_win.h"
10 #include "chrome/browser/metrics/metrics_service.h" 14 #include "chrome/browser/metrics/metrics_service.h"
11 #include "chrome/common/result_codes.h" 15 #include "chrome/common/result_codes.h"
12 16
13 #if defined(USE_LINUX_BREAKPAD) 17 #if defined(USE_LINUX_BREAKPAD)
14 #include "chrome/app/breakpad_linux.h" 18 #include "chrome/app/breakpad_linux.h"
15 #endif 19 #endif
16 20
21 namespace {
22
23 // Indicates that we're currently responding to an IO error (by shutting down).
24 bool g_in_x11_io_error_handler = false;
25
26 int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
27 if (!g_in_x11_io_error_handler)
28 LOG(ERROR) << x11_util::GetErrorEventDescription(error);
29 return 0;
30 }
31
32 int BrowserX11IOErrorHandler(Display* d) {
33 // If there's an IO error it likely means the X server has gone away
34 if (!g_in_x11_io_error_handler) {
35 g_in_x11_io_error_handler = true;
36 LOG(ERROR) << "X IO Error detected";
37 BrowserList::WindowsSessionEnding();
38 }
39
40 return 0;
41 }
42
43 } // namespace
44
17 void DidEndMainMessageLoop() { 45 void DidEndMainMessageLoop() {
18 } 46 }
19 47
20 void RecordBreakpadStatusUMA(MetricsService* metrics) { 48 void RecordBreakpadStatusUMA(MetricsService* metrics) {
21 #if defined(USE_LINUX_BREAKPAD) 49 #if defined(USE_LINUX_BREAKPAD)
22 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); 50 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled());
23 #else 51 #else
24 metrics->RecordBreakpadRegistration(false); 52 metrics->RecordBreakpadRegistration(false);
25 #endif 53 #endif
26 metrics->RecordBreakpadHasDebugger(DebugUtil::BeingDebugged()); 54 metrics->RecordBreakpadHasDebugger(DebugUtil::BeingDebugged());
(...skipping 12 matching lines...) Expand all
39 int HandleIconsCommands(const CommandLine &parsed_command_line) { 67 int HandleIconsCommands(const CommandLine &parsed_command_line) {
40 return 0; 68 return 0;
41 } 69 }
42 70
43 bool CheckMachineLevelInstall() { 71 bool CheckMachineLevelInstall() {
44 return false; 72 return false;
45 } 73 }
46 74
47 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { 75 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) {
48 } 76 }
77
78 void SetBrowserX11ErrorHandlers() {
79 // Set up error handlers to make sure profile gets written if X server
80 // goes away.
81 x11_util::SetX11ErrorHandlers(
82 BrowserX11ErrorHandler,
83 BrowserX11IOErrorHandler);
84 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main_gtk.h ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698