Skip to content

Commit

Permalink
Allow using system libevent instead of the bundled one.
Browse files Browse the repository at this point in the history
Patch by Bernard Cafarelli <voyageur@gentoo.org>

TEST=none
BUG=22140

Review URL: http://codereview.chromium.org/524061

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35711 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
phajdan.jr@chromium.org committed Jan 7, 2010
1 parent 227b543 commit e97831d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 43 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ Dominic Jodoin <dominic.jodoin@gmail.com>
Kaspar Brand <googlecontrib@velox.ch>
Clemens Fruhwirth <clemens@endorphin.org>
Kevin Lee Helpingstine <sig11@reprehensible.net>
Bernard Cafarelli <voyageur@gentoo.org>
4 changes: 4 additions & 0 deletions base/message_pump_libevent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
#include "base/scoped_nsautorelease_pool.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
#else
#include "third_party/libevent/event.h"
#endif

// Lifecycle of struct event
// Libevent uses two main data structures:
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/debugger/devtools_remote_listen_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
#include "base/message_loop.h"
#include "base/message_pump_libevent.h"
#include "net/base/net_errors.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
#else
#include "third_party/libevent/event.h"
#endif
#endif

#include "base/eintr_wrapper.h"
#include "base/platform_thread.h"
Expand Down
4 changes: 4 additions & 0 deletions net/base/listen_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include "net/base/net_errors.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
#else
#include "third_party/libevent/event.h"
#endif
#endif

#include "base/eintr_wrapper.h"
#include "net/base/net_util.h"
Expand Down
4 changes: 4 additions & 0 deletions net/base/telnet_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
#include <sys/socket.h>
#include "base/message_loop.h"
#include "net/base/net_errors.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
#else
#include "third_party/libevent/event.h"
#endif
#include "base/message_pump_libevent.h"
#endif

Expand Down
5 changes: 4 additions & 1 deletion net/socket/tcp_client_socket_libevent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
#include "net/base/io_buffer.h"
#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#if defined(USE_SYSTEM_LIBEVENT)
#include <event.h>
#else
#include "third_party/libevent/event.h"

#endif

namespace net {

Expand Down
108 changes: 66 additions & 42 deletions third_party/libevent/libevent.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,78 @@
# found in the LICENSE file.

{
'targets': [
{
'target_name': 'libevent',
'product_name': 'event',
'type': '<(library)',
'sources': [
'buffer.c',
'evbuffer.c',
'evdns.c',
'event.c',
'event_tagging.c',
'evrpc.c',
'evutil.c',
'http.c',
'log.c',
'poll.c',
'select.c',
'signal.c',
'strlcpy.c',
'variables': {
'use_system_libevent%': 0,
},
'conditions': [
['use_system_libevent==0', {
'targets': [
{
'target_name': 'libevent',
'product_name': 'event',
'type': '<(library)',
'sources': [
'buffer.c',
'evbuffer.c',
'evdns.c',
'event.c',
'event_tagging.c',
'evrpc.c',
'evutil.c',
'http.c',
'log.c',
'poll.c',
'select.c',
'signal.c',
'strlcpy.c',
],
'defines': [
'HAVE_CONFIG_H',
],
'include_dirs': [
'.', # libevent includes some of its own headers with
# #include <...> instead of #include "..."
],
'conditions': [
# libevent has platform-specific implementation files. Since its
# native build uses autoconf, platform-specific config.h files are
# provided and live in platform-specific directories.
[ 'OS == "linux"', {
'sources': [ 'epoll.c', 'epoll_sub.c' ],
'include_dirs': [ 'linux' ],
'link_settings': {
'libraries': [
# We need rt for clock_gettime().
# TODO(port) Maybe on FreeBSD as well?
'-lrt',
],
},
}],
[ 'OS == "mac" or OS == "freebsd"', {
'sources': [ 'kqueue.c' ],
'include_dirs': [ 'mac' ]
}],
],
},
],
'defines': [
'HAVE_CONFIG_H',
],
'include_dirs': [
'.', # libevent includes some of its own headers with #include <...>
# instead of #include "..."
],
'conditions': [
# libevent has platform-specific implementation files. Since its
# native build uses autoconf, platform-specific config.h files are
# provided and live in platform-specific directories.
[ 'OS == "linux"', {
'sources': [ 'epoll.c', 'epoll_sub.c' ],
'include_dirs': [ 'linux' ],
}, { # use_system_libevent != 0
'targets': [
{
'target_name': 'libevent',
'type': 'settings',
'direct_dependent_settings': {
'defines': [
'USE_SYSTEM_LIBEVENT',
],
},
'link_settings': {
'libraries': [
# We need rt for clock_gettime().
# TODO(port) Maybe on FreeBSD as well?
'-lrt',
'-levent',
],
},
}],
[ 'OS == "mac" or OS == "freebsd"', {
'sources': [ 'kqueue.c' ],
'include_dirs': [ 'mac' ]
}],
}
],
},
}],
],
}

Expand Down

0 comments on commit e97831d

Please sign in to comment.