OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <X11/Xlib.h> | |
6 | |
7 #include "base/basictypes.h" | |
8 #include "ui/base/ui_export.h" | |
9 | |
10 namespace ui { | |
11 | |
12 // X11ErrorTracker catches X11 errors in a non-fatal way. It does so by | |
13 // temporarily changing the X11 error handler. The old error handler is | |
14 // restored when the tracker is destroyed. | |
15 class UI_EXPORT X11ErrorTracker { | |
16 public: | |
17 X11ErrorTracker(); | |
18 ~X11ErrorTracker(); | |
19 | |
20 // Returns whether an X11 error happened since this function was last called | |
21 // (or since the creation of the tracker). This is potentially expensive, | |
22 // since this causes a sync with the X server. | |
23 bool FoundNewError(); | |
24 | |
25 private: | |
26 #if !defined(TOOLKIT_GTK) | |
27 XErrorHandler old_handler_; | |
28 #endif | |
29 | |
30 DISALLOW_COPY_AND_ASSIGN(X11ErrorTracker); | |
31 }; | |
32 | |
33 } // namespace ui | |
OLD | NEW |