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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 if (run_loop_->quit_when_idle_received_) | 610 if (run_loop_->quit_when_idle_received_) |
611 pump_->Quit(); | 611 pump_->Quit(); |
612 | 612 |
613 // When we return we will do a kernel wait for more tasks. | 613 // When we return we will do a kernel wait for more tasks. |
614 #if defined(OS_WIN) | 614 #if defined(OS_WIN) |
615 // On Windows we activate the high resolution timer so that the wait | 615 // On Windows we activate the high resolution timer so that the wait |
616 // _if_ triggered by the timer happens with good resolution. If we don't | 616 // _if_ triggered by the timer happens with good resolution. If we don't |
617 // do this the default resolution is 15ms which might not be acceptable | 617 // do this the default resolution is 15ms which might not be acceptable |
618 // for some tasks. | 618 // for some tasks. |
619 in_high_res_mode_ = pending_high_res_tasks_ > 0; | 619 bool high_res = pending_high_res_tasks_ > 0; |
620 Time::ActivateHighResolutionTimer(in_high_res_mode_); | 620 if (high_res != in_high_res_mode_) { |
| 621 in_high_res_mode_ = high_res; |
| 622 Time::ActivateHighResolutionTimer(in_high_res_mode_); |
| 623 } |
621 #endif | 624 #endif |
622 return false; | 625 return false; |
623 } | 626 } |
624 | 627 |
625 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, | 628 void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, |
626 void(*deleter)(const void*), | 629 void(*deleter)(const void*), |
627 const void* object) { | 630 const void* object) { |
628 PostNonNestableTask(from_here, Bind(deleter, object)); | 631 PostNonNestableTask(from_here, Bind(deleter, object)); |
629 } | 632 } |
630 | 633 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 persistent, | 710 persistent, |
708 mode, | 711 mode, |
709 controller, | 712 controller, |
710 delegate); | 713 delegate); |
711 } | 714 } |
712 #endif | 715 #endif |
713 | 716 |
714 #endif // !defined(OS_NACL) | 717 #endif // !defined(OS_NACL) |
715 | 718 |
716 } // namespace base | 719 } // namespace base |
OLD | NEW |