Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/libevent/chromium.patch

Issue 1531573008: move libevent into base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix shim path Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libevent/buffer.c ('k') | third_party/libevent/compat/sys/_libevent_time.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/third_party/libevent/buffer.c b/third_party/libevent/buffer.c
2 index 64324bb..ebf35c9 100644
3 --- a/third_party/libevent/buffer.c
4 +++ b/third_party/libevent/buffer.c
5 @@ -356,7 +356,6 @@ int
6 evbuffer_expand(struct evbuffer *buf, size_t datlen)
7 {
8 size_t used = buf->misalign + buf->off;
9 - size_t need;
10
11 assert(buf->totallen >= used);
12
13 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c
14 index fa23163..f1c70d0 100644
15 --- a/third_party/libevent/evdns.c
16 +++ b/third_party/libevent/evdns.c
17 @@ -55,7 +55,9 @@
18 #endif
19
20 /* #define _POSIX_C_SOURCE 200507 */
21 +#ifndef _GNU_SOURCE
22 #define _GNU_SOURCE
23 +#endif
24
25 #ifdef DNS_USE_CPU_CLOCK_FOR_ID
26 #ifdef DNS_USE_OPENSSL_FOR_ID
27 @@ -134,7 +136,7 @@
28 typedef ev_uint8_t u_char;
29 typedef unsigned int uint;
30 #endif
31 -#include <event.h>
32 +#include "event.h"
33
34 #define u64 ev_uint64_t
35 #define u32 ev_uint32_t
36 diff --git a/third_party/libevent/evdns.h b/third_party/libevent/evdns.h
37 index 1eb5c38..fca4ac3 100644
38 --- a/third_party/libevent/evdns.h
39 +++ b/third_party/libevent/evdns.h
40 @@ -165,7 +165,7 @@ extern "C" {
41 #endif
42
43 /* For integer types. */
44 -#include <evutil.h>
45 +#include "evutil.h"
46
47 /** Error codes 0-5 are as described in RFC 1035. */
48 #define DNS_ERR_NONE 0
49 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c
50 index da6cd42..36b1c51 100644
51 --- a/third_party/libevent/event.c
52 +++ b/third_party/libevent/event.c
53 @@ -107,7 +107,7 @@ static const struct eventop *eventops[] = {
54 /* Global state */
55 struct event_base *current_base = NULL;
56 extern struct event_base *evsignal_base;
57 -static int use_monotonic;
58 +static int use_monotonic = 1;
59
60 /* Handle signals - This is a deprecated interface */
61 int (*event_sigcb)(void); /* Signal callback when gotsig is set */
62 @@ -124,17 +124,6 @@ static int timeout_next(struct event_base *, struct timeval **);
63 static void timeout_process(struct event_base *);
64 static void timeout_correct(struct event_base *, struct timeval *);
65
66 -static void
67 -detect_monotonic(void)
68 -{
69 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
70 - struct timespec ts;
71 -
72 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
73 - use_monotonic = 1;
74 -#endif
75 -}
76 -
77 static int
78 gettime(struct event_base *base, struct timeval *tp)
79 {
80 @@ -144,18 +133,18 @@ gettime(struct event_base *base, struct timeval *tp)
81 }
82
83 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
84 - if (use_monotonic) {
85 - struct timespec ts;
86 -
87 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
88 - return (-1);
89 + struct timespec ts;
90
91 + if (use_monotonic &&
92 + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
93 tp->tv_sec = ts.tv_sec;
94 tp->tv_usec = ts.tv_nsec / 1000;
95 return (0);
96 }
97 #endif
98
99 + use_monotonic = 0;
100 +
101 return (evutil_gettimeofday(tp, NULL));
102 }
103
104 @@ -182,7 +171,6 @@ event_base_new(void)
105 event_sigcb = NULL;
106 event_gotsig = 0;
107
108 - detect_monotonic();
109 gettime(base, &base->event_tv);
110
111 min_heap_ctor(&base->timeheap);
112 @@ -398,12 +386,9 @@ event_process_active(struct event_base *base)
113 ncalls--;
114 ev->ev_ncalls = ncalls;
115 (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_ar g);
116 - if (event_gotsig || base->event_break) {
117 - ev->ev_pncalls = NULL;
118 + if (event_gotsig || base->event_break)
119 return;
120 - }
121 }
122 - ev->ev_pncalls = NULL;
123 }
124 }
125
126 @@ -808,8 +793,6 @@ int
127 event_del(struct event *ev)
128 {
129 struct event_base *base;
130 - const struct eventop *evsel;
131 - void *evbase;
132
133 event_debug(("event_del: %p, callback %p",
134 ev, ev->ev_callback));
135 @@ -819,8 +802,6 @@ event_del(struct event *ev)
136 return (-1);
137
138 base = ev->ev_base;
139 - evsel = base->evsel;
140 - evbase = base->evbase;
141
142 assert(!(ev->ev_flags & ~EVLIST_ALL));
143
144 @@ -838,7 +819,7 @@ event_del(struct event *ev)
145
146 if (ev->ev_flags & EVLIST_INSERTED) {
147 event_queue_remove(base, ev, EVLIST_INSERTED);
148 - return (evsel->del(evbase, ev));
149 + return (base->evsel->del(base->evbase, ev));
150 }
151
152 return (0);
153 diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h
154 index d1f5d9e..f0887b9 100644
155 --- a/third_party/libevent/event.h
156 +++ b/third_party/libevent/event.h
157 @@ -159,7 +159,7 @@
158 extern "C" {
159 #endif
160
161 -#include <event-config.h>
162 +#include "event-config.h"
163 #ifdef _EVENT_HAVE_SYS_TYPES_H
164 #include <sys/types.h>
165 #endif
166 @@ -172,7 +172,7 @@ extern "C" {
167 #include <stdarg.h>
168
169 /* For int types. */
170 -#include <evutil.h>
171 +#include "evutil.h"
172
173 #ifdef WIN32
174 #define WIN32_LEAN_AND_MEAN
175 diff --git a/third_party/libevent/evhttp.h b/third_party/libevent/evhttp.h
176 index cba8be1..48c1d91 100644
177 --- a/third_party/libevent/evhttp.h
178 +++ b/third_party/libevent/evhttp.h
179 @@ -27,7 +27,7 @@
180 #ifndef _EVHTTP_H_
181 #define _EVHTTP_H_
182
183 -#include <event.h>
184 +#include "event.h"
185
186 #ifdef __cplusplus
187 extern "C" {
188 diff --git a/third_party/libevent/evutil.h b/third_party/libevent/evutil.h
189 index dcb0013..8b664b9 100644
190 --- a/third_party/libevent/evutil.h
191 +++ b/third_party/libevent/evutil.h
192 @@ -38,7 +38,7 @@
193 extern "C" {
194 #endif
195
196 -#include <event-config.h>
197 +#include "event-config.h"
198 #ifdef _EVENT_HAVE_SYS_TIME_H
199 #include <sys/time.h>
200 #endif
OLDNEW
« no previous file with comments | « third_party/libevent/buffer.c ('k') | third_party/libevent/compat/sys/_libevent_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698