Reformat the WebRTC code base
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
diff --git a/test/single_threaded_task_queue_unittest.cc b/test/single_threaded_task_queue_unittest.cc
index 5bd40d7..3929574 100644
--- a/test/single_threaded_task_queue_unittest.cc
+++ b/test/single_threaded_task_queue_unittest.cc
@@ -68,9 +68,8 @@
// queue at any given time, post one waiting task that would block the
// task-queue, and unblock only after all tasks have been posted.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
// Post the tasks which comprise the test.
for (size_t i = 0; i < kCount; i++) {
@@ -126,9 +125,8 @@
// Prevent the chain from being set in motion before we've had time to
// schedule it all, lest the queue only contain one task at a time.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
for (size_t i = 0; i < 3; i++) {
task_queue.PostTask([&accumulator, i]() { // |i| passed by value.
@@ -139,9 +137,7 @@
// The test will wait for the task-queue to finish.
rtc::Event done(true, false);
- task_queue.PostTask([&done]() {
- done.Set();
- });
+ task_queue.PostTask([&done]() { done.Set(); });
rendezvous.Set(); // Set the chain in motion.
@@ -159,10 +155,12 @@
constexpr int64_t delay_ms = 20;
static_assert(delay_ms < kMaxWaitTimeMs / 2, "Delay too long for tests.");
- task_queue.PostDelayedTask([&executed, &done]() {
- executed.store(true);
- done.Set();
- }, delay_ms);
+ task_queue.PostDelayedTask(
+ [&executed, &done]() {
+ executed.store(true);
+ done.Set();
+ },
+ delay_ms);
ASSERT_TRUE(done.Wait(kMaxWaitTimeMs));
EXPECT_TRUE(executed.load());
@@ -176,9 +174,7 @@
constexpr int64_t delay_ms = 2000;
static_assert(delay_ms < kMaxWaitTimeMs / 2, "Delay too long for tests.");
- task_queue.PostDelayedTask([&executed]() {
- executed.store(true);
- }, delay_ms);
+ task_queue.PostDelayedTask([&executed]() { executed.store(true); }, delay_ms);
// Wait less than is enough, make sure the task was not yet executed.
rtc::Event not_done(true, false);
@@ -262,16 +258,11 @@
// Prevent the to-be-cancelled task from being executed before we've had
// time to cancel it.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
- TaskId cancelled_task_id = task_queue.PostTask([]() {
- EXPECT_TRUE(false);
- });
- task_queue.PostTask([&done]() {
- done.Set();
- });
+ TaskId cancelled_task_id = task_queue.PostTask([]() { EXPECT_TRUE(false); });
+ task_queue.PostTask([&done]() { done.Set(); });
task_queue.CancelTask(cancelled_task_id);
@@ -292,9 +283,8 @@
// Prevent the chain from being set-off before we've set everything up.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
// This is the canceller-task. It takes cancelled_task_id by reference,
// because the ID will only become known after the cancelled task is
@@ -306,15 +296,11 @@
task_queue.PostTask(canceller_task);
// This task will be cancelled by the task before it.
- auto cancelled_task = []() {
- EXPECT_TRUE(false);
- };
+ auto cancelled_task = []() { EXPECT_TRUE(false); };
cancelled_task_id = task_queue.PostTask(cancelled_task);
// When this task runs, it will allow the test to be finished.
- auto completion_marker_task = [&done]() {
- done.Set();
- };
+ auto completion_marker_task = [&done]() { done.Set(); };
task_queue.PostTask(completion_marker_task);
rendezvous.Set(); // Set the chain in motion.