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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // absolutely "correct" behavior. See TODO above about deleting all tasks | 532 // absolutely "correct" behavior. See TODO above about deleting all tasks |
533 // when it's safe. | 533 // when it's safe. |
534 while (!delayed_work_queue_.empty()) { | 534 while (!delayed_work_queue_.empty()) { |
535 delayed_work_queue_.pop(); | 535 delayed_work_queue_.pop(); |
536 } | 536 } |
537 return did_work; | 537 return did_work; |
538 } | 538 } |
539 | 539 |
540 uint64 MessageLoop::GetTaskTraceID(const PendingTask& task) { | 540 uint64 MessageLoop::GetTaskTraceID(const PendingTask& task) { |
541 return (static_cast<uint64>(task.sequence_num) << 32) | | 541 return (static_cast<uint64>(task.sequence_num) << 32) | |
542 static_cast<uint64>(reinterpret_cast<intptr_t>(this)); | 542 ((static_cast<uint64>(reinterpret_cast<intptr_t>(this)) << 32) >> 32); |
543 } | 543 } |
544 | 544 |
545 void MessageLoop::ReloadWorkQueue() { | 545 void MessageLoop::ReloadWorkQueue() { |
546 // We can improve performance of our loading tasks from the incoming queue to | 546 // We can improve performance of our loading tasks from the incoming queue to |
547 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to | 547 // |*work_queue| by waiting until the last minute (|*work_queue| is empty) to |
548 // load. That reduces the number of locks-per-task significantly when our | 548 // load. That reduces the number of locks-per-task significantly when our |
549 // queues get large. | 549 // queues get large. |
550 if (work_queue_.empty()) | 550 if (work_queue_.empty()) |
551 incoming_task_queue_->ReloadWorkQueue(&work_queue_); | 551 incoming_task_queue_->ReloadWorkQueue(&work_queue_); |
552 } | 552 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 fd, | 745 fd, |
746 persistent, | 746 persistent, |
747 mode, | 747 mode, |
748 controller, | 748 controller, |
749 delegate); | 749 delegate); |
750 } | 750 } |
751 | 751 |
752 #endif | 752 #endif |
753 | 753 |
754 } // namespace base | 754 } // namespace base |
OLD | NEW |