| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/idle.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/synchronization/waitable_event.h" | |
| 9 | |
| 10 | |
| 11 | |
| 12 void IdleStateCallback(IdleState* return_state, base::WaitableEvent* done, | |
| 13 IdleState state) { | |
| 14 *return_state = state; | |
| 15 done->Signal(); | |
| 16 } | |
| 17 | |
| 18 IdleState CalculateIdleStateSync(unsigned int idle_threshold) { | |
| 19 IdleState return_state; | |
| 20 base::WaitableEvent done(true, false); | |
| 21 CalculateIdleState(idle_threshold, base::Bind(&IdleStateCallback, | |
| 22 &return_state, &done)); | |
| 23 done.Wait(); | |
| 24 return return_state; | |
| 25 } | |
| OLD | NEW |