diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 22:32:16 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 22:32:16 +0000 |
commit | 02ec37a5c693e5c795145b92264fbb4677ad12b4 (patch) | |
tree | fc221b9063c2cf5dfb5400f0029e8e8a03729708 /app | |
parent | 2b6b77e5b3765de7f23f45b43c978c6111e32525 (diff) | |
download | chromium_src-02ec37a5c693e5c795145b92264fbb4677ad12b4.zip chromium_src-02ec37a5c693e5c795145b92264fbb4677ad12b4.tar.gz chromium_src-02ec37a5c693e5c795145b92264fbb4677ad12b4.tar.bz2 |
Fixed the race described in bug 54400 by changing a LOG(FATAL) to a LOG(ERROR). Queried the X server to make the error messages in the error handler more descriptive. When a MakeCurrent fails in the GPU process, the associated rendering is informed that the context is lost.
TEST=Run "chrome --enable-accelerated-compositing". Open a few tabs with "http://webkit.org/blog-files/3d-transforms/poster-circle.html". Close one of the tabs. Look for X error info logged on the console (from gpu_main.cc). Remaining tab should still be animated (the fix prevents gpu process from being terminated). This is a race condition, so there may not be an error logged the first time. A few trials should trip the error.
BUG=54400
Landing on behalf of baker@
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/x11_util.cc | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/app/x11_util.cc b/app/x11_util.cc index e86c3ab..4c48187 100644 --- a/app/x11_util.cc +++ b/app/x11_util.cc @@ -21,6 +21,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/stringprintf.h" +#include "base/string_number_conversions.h" #include "base/thread.h" #include "app/x11_util_internal.h" #include "gfx/rect.h" @@ -834,17 +835,43 @@ void SetX11ErrorHandlers(XErrorHandler error_handler, io_error_handler ? io_error_handler : DefaultX11IOErrorHandler); } -std::string GetErrorEventDescription(Display* dpy, XErrorEvent* error_event) { - char buf[255]; - XGetErrorText(dpy, error_event->error_code, buf, 254); +std::string GetErrorEventDescription(Display *dpy, + XErrorEvent *error_event) { + char error_str[256]; + char request_str[256]; + + XGetErrorText(dpy, error_event->error_code, error_str, sizeof(error_str)); + + strncpy(request_str, "Unknown", sizeof(request_str)); + if (error_event->request_code < 128) { + std::string num = base::UintToString(error_event->request_code); + XGetErrorDatabaseText( + dpy, "XRequest", num.c_str(), "Unknown", request_str, + sizeof(request_str)); + } else { + int num_ext; + char **ext_list = XListExtensions(dpy, &num_ext); + + for (int i = 0; i < num_ext; i++) { + int ext_code, first_event, first_error; + XQueryExtension(dpy, ext_list[i], &ext_code, &first_event, &first_error); + if (error_event->request_code == ext_code) { + std::string msg = StringPrintf( + "%s.%d", ext_list[i], error_event->minor_code); + XGetErrorDatabaseText( + dpy, "XRequest", msg.c_str(), "Unknown", request_str, + sizeof(request_str)); + break; + } + } + XFreeExtensionList(ext_list); + } + return base::StringPrintf( - "X Error detected: %s " - "(serial: %lu, error_code: %u, request_code: %u, minor_code: %u)", - buf, - error_event->serial, - error_event->error_code, - error_event->request_code, - error_event->minor_code); + "X Error detected: serial %lu, error_code %u (%s), " + "request_code %u minor_code %u (%s)", + error_event->serial, error_event->error_code, error_str, + error_event->request_code, error_event->minor_code, request_str); } // ---------------------------------------------------------------------------- // End of x11_util_internal.h |