From d33f3c2ff924641f489dba0b9e83eccfa66d75fc Mon Sep 17 00:00:00 2001 From: klzgrad Date: Thu, 25 Jan 2018 07:50:56 -0500 Subject: [PATCH] build: Trim libevent usage Use system libevent on Linux. Remove extra libs on other platforms. --- base/BUILD.gn | 13 +++++++++++-- base/message_loop/message_pump_libevent.cc | 7 ++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/base/BUILD.gn b/base/BUILD.gn index 81e8afe9ed..c4cdcee574 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1794,7 +1794,11 @@ jumbo_component("base") { } if (dep_libevent) { - deps += [ "//base/third_party/libevent" ] + if (is_linux) { + libs += [ "event_core" ] + } else { + deps += [ "//base/third_party/libevent" ] + } } if (use_libevent) { @@ -2526,6 +2530,7 @@ test("base_unittests") { ] defines = [] + libs = [] deps = [ ":base", @@ -2670,7 +2675,11 @@ test("base_unittests") { if (use_libevent) { sources += [ "message_loop/message_pump_libevent_unittest.cc" ] - deps += [ "//base/third_party/libevent" ] + if (is_linux) { + libs += [ "event_core" ] + } else { + deps += [ "//base/third_party/libevent" ] + } } if (is_fuchsia) { diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc index 2a595e5fe5..e5380b1542 100644 --- a/base/message_loop/message_pump_libevent.cc +++ b/base/message_loop/message_pump_libevent.cc @@ -14,7 +14,6 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/posix/eintr_wrapper.h" -#include "base/third_party/libevent/event.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" @@ -23,6 +22,12 @@ #include "base/mac/scoped_nsautorelease_pool.h" #endif +#if defined(OS_LINUX) +#include +#else +#include "base/third_party/libevent/event.h" +#endif + // Lifecycle of struct event // Libevent uses two main data structures: // struct event_base (of which there is one per message pump), and