OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 // tasks (to faciliate FIFO sorting when two tasks have the same | 617 // tasks (to faciliate FIFO sorting when two tasks have the same |
618 // delayed_run_time value) and for identifying the task in about:tracing. | 618 // delayed_run_time value) and for identifying the task in about:tracing. |
619 pending_task->sequence_num = next_sequence_num_++; | 619 pending_task->sequence_num = next_sequence_num_++; |
620 | 620 |
621 TRACE_EVENT_FLOW_BEGIN0("task", "MessageLoop::PostTask", | 621 TRACE_EVENT_FLOW_BEGIN0("task", "MessageLoop::PostTask", |
622 TRACE_ID_MANGLE(GetTaskTraceID(*pending_task, this))); | 622 TRACE_ID_MANGLE(GetTaskTraceID(*pending_task, this))); |
623 | 623 |
624 bool was_empty = incoming_queue_.empty(); | 624 bool was_empty = incoming_queue_.empty(); |
625 incoming_queue_.push(*pending_task); | 625 incoming_queue_.push(*pending_task); |
626 pending_task->task.Reset(); | 626 pending_task->task.Reset(); |
627 if (!was_empty) | 627 if (!was_empty && !IsType(TYPE_UI)) |
klobag.chromium
2013/06/28 20:57:13
Do you need this to get ScheduleWork() called? Sho
Kristian Monsen
2013/06/28 21:04:41
Yes, this is to avoid early out and always get Sch
joth
2013/07/01 19:28:54
Might be cleaner to delegate this to the pump:
if
Kristian Monsen
2013/07/02 21:32:27
Delegated to the pump.
| |
628 return true; // Someone else should have started the sub-pump. | 628 return true; // Someone else should have started the sub-pump. |
629 | 629 |
630 pump = pump_; | 630 pump = pump_; |
631 } | 631 } |
632 // Since the incoming_queue_ may contain a task that destroys this message | 632 // Since the incoming_queue_ may contain a task that destroys this message |
633 // loop, we cannot exit incoming_queue_lock_ until we are done with |this|. | 633 // loop, we cannot exit incoming_queue_lock_ until we are done with |this|. |
634 // We use a stack-based reference to the message pump so that we can call | 634 // We use a stack-based reference to the message pump so that we can call |
635 // ScheduleWork outside of incoming_queue_lock_. | 635 // ScheduleWork outside of incoming_queue_lock_. |
636 | 636 |
637 pump->ScheduleWork(); | 637 pump->ScheduleWork(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 fd, | 825 fd, |
826 persistent, | 826 persistent, |
827 mode, | 827 mode, |
828 controller, | 828 controller, |
829 delegate); | 829 delegate); |
830 } | 830 } |
831 | 831 |
832 #endif | 832 #endif |
833 | 833 |
834 } // namespace base | 834 } // namespace base |
OLD | NEW |