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

Side by Side Diff: base/observer_list_unittest.cc

Issue 2859053006: Use constexpr TaskTraits constructor in base (part 2). (Closed)
Patch Set: self-review Created 3 years, 7 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/process/kill_win.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 #include "base/observer_list.h" 5 #include "base/observer_list.h"
6 #include "base/observer_list_threadsafe.h" 6 #include "base/observer_list_threadsafe.h"
7 7
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 WaitableEvent task_running(WaitableEvent::ResetPolicy::AUTOMATIC, 594 WaitableEvent task_running(WaitableEvent::ResetPolicy::AUTOMATIC,
595 WaitableEvent::InitialState::NOT_SIGNALED); 595 WaitableEvent::InitialState::NOT_SIGNALED);
596 WaitableEvent barrier(WaitableEvent::ResetPolicy::AUTOMATIC, 596 WaitableEvent barrier(WaitableEvent::ResetPolicy::AUTOMATIC,
597 WaitableEvent::InitialState::NOT_SIGNALED); 597 WaitableEvent::InitialState::NOT_SIGNALED);
598 598
599 // This must be after the declaration of |barrier| so that tasks posted to 599 // This must be after the declaration of |barrier| so that tasks posted to
600 // TaskScheduler can safely use |barrier|. 600 // TaskScheduler can safely use |barrier|.
601 test::ScopedTaskEnvironment scoped_task_environment; 601 test::ScopedTaskEnvironment scoped_task_environment;
602 602
603 CreateSequencedTaskRunnerWithTraits(TaskTraits().WithBaseSyncPrimitives()) 603 CreateSequencedTaskRunnerWithTraits({WithBaseSyncPrimitives()})
604 ->PostTask(FROM_HERE, 604 ->PostTask(FROM_HERE,
605 base::Bind(&ObserverListThreadSafe<Foo>::AddObserver, 605 base::Bind(&ObserverListThreadSafe<Foo>::AddObserver,
606 observer_list, Unretained(&observer))); 606 observer_list, Unretained(&observer)));
607 TaskScheduler::GetInstance()->FlushForTesting(); 607 TaskScheduler::GetInstance()->FlushForTesting();
608 608
609 observer_list->Notify(FROM_HERE, &Foo::Observe, 1); 609 observer_list->Notify(FROM_HERE, &Foo::Observe, 1);
610 observer.WaitForNotificationRunning(); 610 observer.WaitForNotificationRunning();
611 observer_list->RemoveObserver(&observer); 611 observer_list->RemoveObserver(&observer);
612 612
613 observer.Unblock(); 613 observer.Unblock();
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 // However, the first Observe() call will add a second observer: at this 1048 // However, the first Observe() call will add a second observer: at this
1049 // point, it != observer_list.end() should be true, and Observe() should be 1049 // point, it != observer_list.end() should be true, and Observe() should be
1050 // called on the newly added observer on the next iteration of the loop. 1050 // called on the newly added observer on the next iteration of the loop.
1051 observer.Observe(10); 1051 observer.Observe(10);
1052 } 1052 }
1053 1053
1054 EXPECT_EQ(-10, b.total); 1054 EXPECT_EQ(-10, b.total);
1055 } 1055 }
1056 1056
1057 } // namespace base 1057 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/process/kill_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698