Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 diff --git a/third_party/libevent/buffer.c b/third_party/libevent/buffer.c | 1 diff --git a/third_party/libevent/buffer.c b/third_party/libevent/buffer.c |
| 2 index 64324bb..ebf35c9 100644 | 2 index 64324bb..ebf35c9 100644 |
| 3 --- a/third_party/libevent/buffer.c | 3 --- a/third_party/libevent/buffer.c |
| 4 +++ b/third_party/libevent/buffer.c | 4 +++ b/third_party/libevent/buffer.c |
| 5 @@ -356,7 +356,6 @@ int | 5 @@ -356,7 +356,6 @@ int |
| 6 evbuffer_expand(struct evbuffer *buf, size_t datlen) | 6 evbuffer_expand(struct evbuffer *buf, size_t datlen) |
| 7 { | 7 { |
| 8 size_t used = buf->misalign + buf->off; | 8 size_t used = buf->misalign + buf->off; |
| 9 - size_t need; | 9 - size_t need; |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 /* For integer types. */ | 43 /* For integer types. */ |
| 44 -#include <evutil.h> | 44 -#include <evutil.h> |
| 45 +#include "evutil.h" | 45 +#include "evutil.h" |
| 46 | 46 |
| 47 /** Error codes 0-5 are as described in RFC 1035. */ | 47 /** Error codes 0-5 are as described in RFC 1035. */ |
| 48 #define DNS_ERR_NONE 0 | 48 #define DNS_ERR_NONE 0 |
| 49 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c | 49 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c |
| 50 index da6cd42..36b1c51 100644 | 50 index da6cd42..36b1c51 100644 |
| 51 --- a/third_party/libevent/event.c | 51 --- a/third_party/libevent/event.c |
| 52 +++ b/third_party/libevent/event.c | 52 +++ b/third_party/libevent/event.c |
| 53 @@ -107,7 +107,7 @@ static const struct eventop *eventops[] = { | 53 @@ -107,11 +107,7 @@ static const struct eventop *eventops[] = { |
| 54 /* Global state */ | 54 /* Global state */ |
| 55 struct event_base *current_base = NULL; | 55 struct event_base *current_base = NULL; |
| 56 extern struct event_base *evsignal_base; | 56 extern struct event_base *evsignal_base; |
| 57 -static int use_monotonic; | 57 -static int use_monotonic; |
| 58 - | |
| 59 -/* Handle signals - This is a deprecated interface */ | |
| 60 -int (*event_sigcb)(void); /* Signal callback when gotsig is set */ | |
| 61 -volatile sig_atomic_t event_gotsig; /* Set in signal handler */ | |
| 58 +static int use_monotonic = 1; | 62 +static int use_monotonic = 1; |
| 59 | 63 |
| 60 /* Handle signals - This is a deprecated interface */ | 64 /* Prototypes */ |
|
tfarina
2016/04/22 13:46:35
Is this comment necessary? I wouldn't add it my se
tommi (sloooow) - chröme
2016/04/22 14:34:54
It's necessary in this patch file because it's in
| |
| 61 int (*event_sigcb)(void);» » /* Signal callback when gotsig is set */ | 65 static void» event_queue_insert(struct event_base *, struct event *, int); |
| 62 @@ -124,17 +124,6 @@ static int»timeout_next(struct event_base *, struct timeval **); | 66 @@ -124,17 +120,6 @@ static int»timeout_next(struct event_base *, struct timeval **); |
| 63 static void timeout_process(struct event_base *); | 67 static void timeout_process(struct event_base *); |
| 64 static void timeout_correct(struct event_base *, struct timeval *); | 68 static void timeout_correct(struct event_base *, struct timeval *); |
| 65 | 69 |
| 66 -static void | 70 -static void |
| 67 -detect_monotonic(void) | 71 -detect_monotonic(void) |
| 68 -{ | 72 -{ |
| 69 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | 73 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) |
| 70 - struct timespec ts; | 74 - struct timespec ts; |
| 71 - | 75 - |
| 72 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) | 76 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) |
| 73 - use_monotonic = 1; | 77 - use_monotonic = 1; |
| 74 -#endif | 78 -#endif |
| 75 -} | 79 -} |
| 76 - | 80 - |
| 77 static int | 81 static int |
| 78 gettime(struct event_base *base, struct timeval *tp) | 82 gettime(struct event_base *base, struct timeval *tp) |
| 79 { | 83 { |
| 80 @@ -144,18 +133,18 @@ gettime(struct event_base *base, struct timeval *tp) | 84 @@ -144,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp) |
| 81 } | 85 } |
| 82 | 86 |
| 83 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | 87 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) |
| 84 - if (use_monotonic) { | 88 - if (use_monotonic) { |
| 85 - struct timespec ts; | 89 - struct timespec ts; |
| 86 - | 90 - |
| 87 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) | 91 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) |
| 88 - return (-1); | 92 - return (-1); |
| 89 + struct timespec ts; | 93 + struct timespec ts; |
| 90 | 94 |
| 91 + if (use_monotonic && | 95 + if (use_monotonic && |
| 92 + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { | 96 + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { |
| 93 tp->tv_sec = ts.tv_sec; | 97 tp->tv_sec = ts.tv_sec; |
| 94 tp->tv_usec = ts.tv_nsec / 1000; | 98 tp->tv_usec = ts.tv_nsec / 1000; |
| 95 return (0); | 99 return (0); |
| 96 } | 100 } |
| 97 #endif | 101 #endif |
| 98 | 102 |
| 99 + use_monotonic = 0; | 103 + use_monotonic = 0; |
| 100 + | 104 + |
| 101 return (evutil_gettimeofday(tp, NULL)); | 105 return (evutil_gettimeofday(tp, NULL)); |
| 102 } | 106 } |
| 103 | 107 |
| 104 @@ -182,7 +171,6 @@ event_base_new(void) | 108 @@ -179,10 +164,6 @@ event_base_new(void) |
| 105 » event_sigcb = NULL; | 109 » if ((base = calloc(1, sizeof(struct event_base))) == NULL) |
| 106 » event_gotsig = 0; | 110 » » event_err(1, "%s: calloc", __func__); |
| 107 | 111 |
| 112 - event_sigcb = NULL; | |
| 113 - event_gotsig = 0; | |
| 114 - | |
| 108 - detect_monotonic(); | 115 - detect_monotonic(); |
| 109 gettime(base, &base->event_tv); | 116 gettime(base, &base->event_tv); |
| 110 | 117 |
| 111 min_heap_ctor(&base->timeheap); | 118 min_heap_ctor(&base->timeheap); |
| 112 @@ -398,12 +386,9 @@ event_process_active(struct event_base *base) | 119 @@ -398,12 +379,9 @@ event_process_active(struct event_base *base) |
| 113 ncalls--; | 120 ncalls--; |
| 114 ev->ev_ncalls = ncalls; | 121 ev->ev_ncalls = ncalls; |
| 115 (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_ar g); | 122 (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_ar g); |
| 116 - if (event_gotsig || base->event_break) { | 123 - if (event_gotsig || base->event_break) { |
| 117 - ev->ev_pncalls = NULL; | 124 - ev->ev_pncalls = NULL; |
| 118 +» » » if (event_gotsig || base->event_break) | 125 +» » » if (base->event_break) |
| 119 return; | 126 return; |
| 120 - } | 127 - } |
| 121 } | 128 } |
| 122 - ev->ev_pncalls = NULL; | 129 - ev->ev_pncalls = NULL; |
| 123 } | 130 } |
| 124 } | 131 } |
| 125 | 132 |
| 126 @@ -808,8 +793,6 @@ int | 133 @@ -506,18 +484,6 @@ event_base_loop(struct event_base *base, int flags) |
| 134 » » » break; | |
| 135 » » } | |
| 136 | |
| 137 -» » /* You cannot use this interface for multi-threaded apps */ | |
| 138 -» » while (event_gotsig) { | |
| 139 -» » » event_gotsig = 0; | |
| 140 -» » » if (event_sigcb) { | |
| 141 -» » » » res = (*event_sigcb)(); | |
| 142 -» » » » if (res == -1) { | |
| 143 -» » » » » errno = EINTR; | |
| 144 -» » » » » return (-1); | |
| 145 -» » » » } | |
| 146 -» » » } | |
| 147 -» » } | |
| 148 - | |
| 149 » » timeout_correct(base, &tv); | |
| 150 | |
| 151 » » tv_p = &tv; | |
| 152 @@ -808,8 +774,6 @@ int | |
| 127 event_del(struct event *ev) | 153 event_del(struct event *ev) |
| 128 { | 154 { |
| 129 struct event_base *base; | 155 struct event_base *base; |
| 130 - const struct eventop *evsel; | 156 - const struct eventop *evsel; |
| 131 - void *evbase; | 157 - void *evbase; |
| 132 | 158 |
| 133 event_debug(("event_del: %p, callback %p", | 159 event_debug(("event_del: %p, callback %p", |
| 134 ev, ev->ev_callback)); | 160 ev, ev->ev_callback)); |
| 135 @@ -819,8 +802,6 @@ event_del(struct event *ev) | 161 @@ -819,8 +783,6 @@ event_del(struct event *ev) |
| 136 return (-1); | 162 return (-1); |
| 137 | 163 |
| 138 base = ev->ev_base; | 164 base = ev->ev_base; |
| 139 - evsel = base->evsel; | 165 - evsel = base->evsel; |
| 140 - evbase = base->evbase; | 166 - evbase = base->evbase; |
| 141 | 167 |
| 142 assert(!(ev->ev_flags & ~EVLIST_ALL)); | 168 assert(!(ev->ev_flags & ~EVLIST_ALL)); |
| 143 | 169 |
| 144 @@ -838,7 +819,7 @@ event_del(struct event *ev) | 170 @@ -838,7 +800,7 @@ event_del(struct event *ev) |
| 145 | 171 |
| 146 if (ev->ev_flags & EVLIST_INSERTED) { | 172 if (ev->ev_flags & EVLIST_INSERTED) { |
| 147 event_queue_remove(base, ev, EVLIST_INSERTED); | 173 event_queue_remove(base, ev, EVLIST_INSERTED); |
| 148 - return (evsel->del(evbase, ev)); | 174 - return (evsel->del(evbase, ev)); |
| 149 + return (base->evsel->del(base->evbase, ev)); | 175 + return (base->evsel->del(base->evbase, ev)); |
| 150 } | 176 } |
| 151 | 177 |
| 152 return (0); | 178 return (0); |
| 153 diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h | 179 diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h |
| 154 index d1f5d9e..f0887b9 100644 | 180 index d1f5d9e..f0887b9 100644 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 +++ b/third_party/libevent/evutil.h | 217 +++ b/third_party/libevent/evutil.h |
| 192 @@ -38,7 +38,7 @@ | 218 @@ -38,7 +38,7 @@ |
| 193 extern "C" { | 219 extern "C" { |
| 194 #endif | 220 #endif |
| 195 | 221 |
| 196 -#include <event-config.h> | 222 -#include <event-config.h> |
| 197 +#include "event-config.h" | 223 +#include "event-config.h" |
| 198 #ifdef _EVENT_HAVE_SYS_TIME_H | 224 #ifdef _EVENT_HAVE_SYS_TIME_H |
| 199 #include <sys/time.h> | 225 #include <sys/time.h> |
| 200 #endif | 226 #endif |
| OLD | NEW |