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}
diff --git a/webrtc/modules/desktop_capture/screen_drawer_linux.cc b/webrtc/modules/desktop_capture/screen_drawer_linux.cc
index 4f96b7e..c78e684 100644
--- a/webrtc/modules/desktop_capture/screen_drawer_linux.cc
+++ b/webrtc/modules/desktop_capture/screen_drawer_linux.cc
@@ -12,6 +12,7 @@
#include <sys/stat.h>
#include <semaphore.h>
#include <string.h>
+#include <X11/Xlib.h>
#include <memory>
diff --git a/webrtc/modules/desktop_capture/x11/shared_x_display.cc b/webrtc/modules/desktop_capture/x11/shared_x_display.cc
index 3eb5eb1..c5b9bd9 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 <X11/Xlib.h>
+
#include <algorithm>
+#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 6cade2d..648f67a 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 <map>
#include <vector>
-#include <assert.h>
-#include <X11/Xlib.h>
-
#include <string>
#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.