Chromium Code Reviews| Index: base/message_loop/message_loop.cc |
| diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc |
| index 818073367bdf2698a233a9aa46a79b878d3fbe7b..193a3bed992dfbaa586ff888da92a4a68617550c 100644 |
| --- a/base/message_loop/message_loop.cc |
| +++ b/base/message_loop/message_loop.cc |
| @@ -117,8 +117,10 @@ MessageLoop::DestructionObserver::~DestructionObserver() { |
| MessageLoop::MessageLoop(Type type) |
| : type_(type), |
| +#if defined(OS_WIN) |
|
Will Harris
2015/01/20 23:04:47
hi res timer is supported on platforms other than
Lei Zhang
2015/01/20 23:19:37
Doesn't look like it to me.
- The variables here
|
| pending_high_res_tasks_(0), |
| in_high_res_mode_(false), |
| +#endif |
| nestable_tasks_allowed_(true), |
| #if defined(OS_WIN) |
| os_modal_loop_(false), |
| @@ -133,8 +135,10 @@ MessageLoop::MessageLoop(Type type) |
| MessageLoop::MessageLoop(scoped_ptr<MessagePump> pump) |
| : pump_(pump.Pass()), |
| type_(TYPE_CUSTOM), |
| +#if defined(OS_WIN) |
| pending_high_res_tasks_(0), |
| in_high_res_mode_(false), |
| +#endif |
| nestable_tasks_allowed_(true), |
| #if defined(OS_WIN) |
| os_modal_loop_(false), |
| @@ -422,10 +426,13 @@ bool MessageLoop::ProcessNextDelayedNonNestableTask() { |
| void MessageLoop::RunTask(const PendingTask& pending_task) { |
| DCHECK(nestable_tasks_allowed_); |
| +#if defined(OS_WIN) |
| if (pending_task.is_high_res) { |
| pending_high_res_tasks_--; |
| - CHECK(pending_high_res_tasks_ >= 0); |
| + CHECK_GE(pending_high_res_tasks_, 0); |
| } |
| +#endif |
| + |
| // Execute the task and assume the worst: It is probably not reentrant. |
| nestable_tasks_allowed_ = false; |
| @@ -490,6 +497,7 @@ bool MessageLoop::DeletePendingTasks() { |
| } |
| void MessageLoop::ReloadWorkQueue() { |
| +#if defined(OS_WIN) |
| // We can improve performance of our loading tasks from the incoming queue to |
| // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to |
| // load. That reduces the number of locks-per-task significantly when our |
| @@ -498,6 +506,7 @@ void MessageLoop::ReloadWorkQueue() { |
| pending_high_res_tasks_ += |
| incoming_task_queue_->ReloadWorkQueue(&work_queue_); |
| } |
| +#endif |
| } |
| void MessageLoop::ScheduleWork() { |
| @@ -692,8 +701,8 @@ bool MessageLoopForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { |
| bool MessageLoopForIO::WatchFileDescriptor(int fd, |
| bool persistent, |
| Mode mode, |
| - FileDescriptorWatcher *controller, |
| - Watcher *delegate) { |
| + FileDescriptorWatcher* controller, |
| + Watcher* delegate) { |
| return ToPumpIO(pump_.get())->WatchFileDescriptor( |
| fd, |
| persistent, |