From e083909f85c761574080cad160a8728a2bed7544 Mon Sep 17 00:00:00 2001 From: zijiehe Date: Tue, 8 Nov 2016 12:47:14 -0800 Subject: [PATCH] Remove evil defines out of shared_x_display.h This is a trivial but dangerous change to remove X11/Xlib.h out of shared_x_display.h. Since we do not have a strict and automatically Include-What-You-Use rule, I cannot quite tell whether any Chromium source files wrongly assume X11/Xlib.h will be included through shared_x_display.h. We can fix the breaks in Chromium after this change has been failed to integrate to Chromium. BUG=webrtc:6513 Review-Url: https://codereview.webrtc.org/2482963003 Cr-Commit-Position: refs/heads/master@{#14987} --- webrtc/modules/desktop_capture/screen_drawer_linux.cc | 1 + webrtc/modules/desktop_capture/x11/shared_x_display.cc | 7 +++++-- webrtc/modules/desktop_capture/x11/shared_x_display.h | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/webrtc/modules/desktop_capture/screen_drawer_linux.cc b/webrtc/modules/desktop_capture/screen_drawer_linux.cc index 4f96b7e92c..c78e6843fe 100644 --- a/webrtc/modules/desktop_capture/screen_drawer_linux.cc +++ b/webrtc/modules/desktop_capture/screen_drawer_linux.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include diff --git a/webrtc/modules/desktop_capture/x11/shared_x_display.cc b/webrtc/modules/desktop_capture/x11/shared_x_display.cc index 3eb5eb10a9..c5b9bd914c 100644 --- a/webrtc/modules/desktop_capture/x11/shared_x_display.cc +++ b/webrtc/modules/desktop_capture/x11/shared_x_display.cc @@ -10,19 +10,22 @@ #include "webrtc/modules/desktop_capture/x11/shared_x_display.h" +#include + #include +#include "webrtc/base/checks.h" #include "webrtc/system_wrappers/include/logging.h" namespace webrtc { SharedXDisplay::SharedXDisplay(Display* display) : display_(display) { - assert(display_); + RTC_DCHECK(display_); } SharedXDisplay::~SharedXDisplay() { - assert(event_handlers_.empty()); + RTC_DCHECK(event_handlers_.empty()); XCloseDisplay(display_); } diff --git a/webrtc/modules/desktop_capture/x11/shared_x_display.h b/webrtc/modules/desktop_capture/x11/shared_x_display.h index 6cade2decc..648f67a51f 100644 --- a/webrtc/modules/desktop_capture/x11/shared_x_display.h +++ b/webrtc/modules/desktop_capture/x11/shared_x_display.h @@ -14,15 +14,17 @@ #include #include -#include -#include - #include #include "webrtc/base/constructormagic.h" #include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/system_wrappers/include/atomic32.h" +// Including Xlib.h will involve evil defines (Bool, Status, True, False), which +// easily conflict with other headers. +typedef struct _XDisplay Display; +typedef union _XEvent XEvent; + namespace webrtc { // A ref-counted object to store XDisplay connection.