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

Unified Diff: base/test/test_support_android.cc

Issue 1904273002: Enforce singleton not allowed behavior for CONTINUE_ON_SHUTDOWN tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made a Singleton leaky in test_support_android.cc Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_support_android.cc
diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc
index c59722d4e01075924b41c065e4016a38afb65b6f..c35e6197fc2bb02981793f7caadcaaa33ac63e29 100644
--- a/base/test/test_support_android.cc
+++ b/base/test/test_support_android.cc
@@ -43,22 +43,21 @@ RunState* g_state = NULL;
// when there are no pending messages.
class Waitable {
public:
- static Waitable* GetInstance() { return base::Singleton<Waitable>::get(); }
-
- // Signals that there are more work to do.
- void Signal() {
- waitable_event_.Signal();
- }
-
- // Blocks until more work is scheduled.
- void Block() {
- waitable_event_.Wait();
- }
-
- void Quit() {
- g_state->should_quit = true;
- Signal();
- }
+ static Waitable* GetInstance() {
+ return base::Singleton<Waitable,
+ base::LeakySingletonTraits<Waitable>>::get();
+ }
+
+ // Signals that there are more work to do.
+ void Signal() { waitable_event_.Signal(); }
+
+ // Blocks until more work is scheduled.
+ void Block() { waitable_event_.Wait(); }
+
+ void Quit() {
+ g_state->should_quit = true;
+ Signal();
+ }
private:
friend struct base::DefaultSingletonTraits<Waitable>;
« no previous file with comments | « no previous file | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698