OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_pump_libevent.h" | 5 #include "base/message_pump_libevent.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_nsautorelease_pool.h" | 10 #include "base/scoped_nsautorelease_pool.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "third_party/libevent/event.h" | 12 #include "third_party/libevent/event.h" |
13 | 13 |
| 14 using base::Time; |
| 15 using base::TimeDelta; |
| 16 |
14 namespace base { | 17 namespace base { |
15 | 18 |
16 // Return 0 on success | 19 // Return 0 on success |
17 // Too small a function to bother putting in a library? | 20 // Too small a function to bother putting in a library? |
18 static int SetNonBlocking(int fd) | 21 static int SetNonBlocking(int fd) |
19 { | 22 { |
20 int flags = fcntl(fd, F_GETFL, 0); | 23 int flags = fcntl(fd, F_GETFL, 0); |
21 if (-1 == flags) | 24 if (-1 == flags) |
22 flags = 0; | 25 flags = 0; |
23 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); | 26 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 176 |
174 void MessagePumpLibevent::ScheduleDelayedWork(const Time& delayed_work_time) { | 177 void MessagePumpLibevent::ScheduleDelayedWork(const Time& delayed_work_time) { |
175 // We know that we can't be blocked on Wait right now since this method can | 178 // We know that we can't be blocked on Wait right now since this method can |
176 // only be called on the same thread as Run, so we only need to update our | 179 // only be called on the same thread as Run, so we only need to update our |
177 // record of how long to sleep when we do sleep. | 180 // record of how long to sleep when we do sleep. |
178 delayed_work_time_ = delayed_work_time; | 181 delayed_work_time_ = delayed_work_time; |
179 } | 182 } |
180 | 183 |
181 } // namespace base | 184 } // namespace base |
182 | 185 |
OLD | NEW |