Allow to wait a condition variable in midi::TaskService
midi::TaskService is a utility class to allow users to run a task
that is bound to the class instance on another thread safely.
To destruct the instance safely, we need to ensure that no tasks
that may refer the instance are not running on other threads.
Originally the feature was implemented with rwlock, but when rwlock
was removed from the base library, it was changed to use a
condition variable.
Change-Id: I0bfe71800ce43332e96623f2a415975d481c9efb
Bug: 796830
Reviewed-on: https://chromium-review.googlesource.com/833851
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527971}
CrOS-Libchrome-Original-Commit: 129091daa1acd388aa674c73dbae06dcca03a75a
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
index 8760aa8..51687c1 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -70,6 +70,9 @@
namespace media {
class BlockingUrlProtocol;
}
+namespace midi {
+class TaskService; // https://crbug.com/796830
+}
namespace mojo {
class SyncCallRestrictions;
namespace edk {
@@ -264,6 +267,7 @@
friend class base::GetAppOutputScopedAllowBaseSyncPrimitives;
friend class leveldb::LevelDBMojoProxy;
friend class media::BlockingUrlProtocol;
+ friend class midi::TaskService; // https://crbug.com/796830
friend class net::MultiThreadedCertVerifierScopedAllowBaseSyncPrimitives;
friend class rlz_lib::FinancialPing;
friend class shell_integration::LaunchXdgUtilityScopedAllowBaseSyncPrimitives;