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

Unified Diff: chrome/app/chrome_dll_main.cc

Issue 56072: Make Gtk/Gdk/GLib errors/warnings really fatal. (Closed)
Patch Set: extract to function Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_dll_main.cc
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 6ef4c20e3d4561b761ba0af2cfa91ae9bc363c4e..46bd0ff9e29084ab757930c716a38303f78ae446 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -159,18 +159,33 @@ bool IncorrectChromeHtmlArguments(const std::wstring& command_line) {
#endif // OS_WIN
#if defined(OS_LINUX)
-static void GtkFatalLogHandler(const gchar* log_domain,
- GLogLevelFlags log_level,
- const gchar* message,
- gpointer userdata) {
+static void GLibFatalLogHandler(const gchar* log_domain,
+ GLogLevelFlags log_level,
+ const gchar* message,
+ gpointer userdata) {
if (!log_domain)
- log_domain = "<all>";
+ log_domain = "<unknown>";
if (!message)
message = "<no message>";
- NOTREACHED() << "GTK: (" << log_domain << "): " << message;
+ LOG(FATAL) << log_domain << ": " << message;
}
-#endif
+
+static void SetUpGLibLogHandler() {
+ // Register GLib-handled assertions to go through our logging system.
+ const char* kLogDomains[] = { NULL, "Gtk", "Gdk", "GLib" };
+ for (size_t i = 0; i < arraysize(kLogDomains); i++) {
+ g_log_set_handler(kLogDomains[i],
+ static_cast<GLogLevelFlags>(G_LOG_FLAG_RECURSION |
+ G_LOG_FLAG_FATAL |
+ G_LOG_LEVEL_ERROR |
+ G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_WARNING),
+ GLibFatalLogHandler,
+ NULL);
+ }
+}
+#endif // defined(OS_LINUX)
// Register the invalid param handler and pure call handler to be able to
// notify breakpad when it happens.
@@ -404,15 +419,7 @@ int ChromeMain(int argc, const char** argv) {
#if defined(OS_LINUX)
// gtk_init() can change |argc| and |argv|, but nobody else uses them.
gtk_init(&argc, const_cast<char***>(&argv));
- // Register GTK assertions to go through our logging system.
- g_log_set_handler(NULL, // All logging domains.
- static_cast<GLogLevelFlags>(G_LOG_FLAG_RECURSION |
- G_LOG_FLAG_FATAL |
- G_LOG_LEVEL_ERROR |
- G_LOG_LEVEL_CRITICAL |
- G_LOG_LEVEL_WARNING),
- GtkFatalLogHandler,
- NULL);
+ SetUpGLibLogHandler();
#endif
ScopedOleInitializer ole_initializer;
« no previous file with comments | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698