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

Side by Side Diff: base/synchronization/condition_variable_unittest.cc

Issue 2791243002: Rewrite base::Bind into base::BindOnce on trivial cases in base (Closed)
Patch Set: rebase Created 3 years, 8 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 | « base/synchronization/atomic_flag_unittest.cc ('k') | base/task/cancelable_task_tracker.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Multi-threaded tests of ConditionVariable class. 5 // Multi-threaded tests of ConditionVariable class.
6 6
7 #include "base/synchronization/condition_variable.h" 7 #include "base/synchronization/condition_variable.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 PLOG(ERROR) << "Could not set time of day. Run as root?"; 218 PLOG(ERROR) << "Could not set time of day. Run as root?";
219 return; 219 return;
220 } 220 }
221 221
222 Lock lock; 222 Lock lock;
223 ConditionVariable cv(&lock); 223 ConditionVariable cv(&lock);
224 lock.Acquire(); 224 lock.Acquire();
225 225
226 Thread thread("Helper"); 226 Thread thread("Helper");
227 thread.Start(); 227 thread.Start();
228 thread.task_runner()->PostTask(FROM_HERE, base::Bind(&BackInTime, &lock)); 228 thread.task_runner()->PostTask(FROM_HERE, base::BindOnce(&BackInTime, &lock));
229 229
230 TimeTicks start = TimeTicks::Now(); 230 TimeTicks start = TimeTicks::Now();
231 const TimeDelta kWaitTime = TimeDelta::FromMilliseconds(300); 231 const TimeDelta kWaitTime = TimeDelta::FromMilliseconds(300);
232 // Allow for clocking rate granularity. 232 // Allow for clocking rate granularity.
233 const TimeDelta kFudgeTime = TimeDelta::FromMilliseconds(50); 233 const TimeDelta kFudgeTime = TimeDelta::FromMilliseconds(50);
234 234
235 cv.TimedWait(kWaitTime + kFudgeTime); 235 cv.TimedWait(kWaitTime + kFudgeTime);
236 TimeDelta duration = TimeTicks::Now() - start; 236 TimeDelta duration = TimeTicks::Now() - start;
237 237
238 thread.Stop(); 238 thread.Stop();
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 base::AutoLock auto_lock(lock_); 759 base::AutoLock auto_lock(lock_);
760 // Send notification that we completed our "work." 760 // Send notification that we completed our "work."
761 WorkIsCompleted(thread_id); 761 WorkIsCompleted(thread_id);
762 } 762 }
763 } 763 }
764 } 764 }
765 765
766 } // namespace 766 } // namespace
767 767
768 } // namespace base 768 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/atomic_flag_unittest.cc ('k') | base/task/cancelable_task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698