Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: base/message_loop/message_loop.cc

Issue 541203002: fix for high resolution timer on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits fixes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698