OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ |
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ |
13 | 13 |
14 #include <X11/Xlib.h> | 14 #include <X11/Xlib.h> |
15 | 15 |
16 #include "webrtc/rtc_base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 // Helper class that registers X Window error handler. Caller can use | 20 // Helper class that registers X Window error handler. Caller can use |
21 // GetLastErrorAndDisable() to get the last error that was caught, if any. | 21 // GetLastErrorAndDisable() to get the last error that was caught, if any. |
22 class XErrorTrap { | 22 class XErrorTrap { |
23 public: | 23 public: |
24 explicit XErrorTrap(Display* display); | 24 explicit XErrorTrap(Display* display); |
25 ~XErrorTrap(); | 25 ~XErrorTrap(); |
26 | 26 |
27 // Returns last error and removes unregisters the error handler. | 27 // Returns last error and removes unregisters the error handler. |
28 int GetLastErrorAndDisable(); | 28 int GetLastErrorAndDisable(); |
29 | 29 |
30 private: | 30 private: |
31 XErrorHandler original_error_handler_; | 31 XErrorHandler original_error_handler_; |
32 bool enabled_; | 32 bool enabled_; |
33 | 33 |
34 RTC_DISALLOW_COPY_AND_ASSIGN(XErrorTrap); | 34 RTC_DISALLOW_COPY_AND_ASSIGN(XErrorTrap); |
35 }; | 35 }; |
36 | 36 |
37 } // namespace webrtc | 37 } // namespace webrtc |
38 | 38 |
39 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ | 39 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_X11_X_ERROR_TRAP_H_ |
OLD | NEW |