[ThreadPool] Rename base::ThreadPool to base::ThreadPoolInstance
In order to leave the base::ThreadPool symbol available for
an upcoming "destination" task trait.
Also moved ThreadPoolImpl to be the implementation of TaskExecutor,
not ThreadPoolInstance. It was a mistake that base::ThreadPool was
implementing TaskExecutor, its users shouldn't have access to
PostTask*() and Create*TaskRunner*().
[email protected]
(bypass owners for side-effects beyond //base)
Bug: 968047
Change-Id: I0607fba6d7f30d202bf7f61a9f461b1256e87467
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1634851
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: François Doray <[email protected]>
Commit-Queue: Gabriel Charette <[email protected]>
Auto-Submit: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#664300}
diff --git a/base/android/java/src/org/chromium/base/task/DefaultTaskExecutor.java b/base/android/java/src/org/chromium/base/task/DefaultTaskExecutor.java
index 9952c42..5d1e8fcc 100644
--- a/base/android/java/src/org/chromium/base/task/DefaultTaskExecutor.java
+++ b/base/android/java/src/org/chromium/base/task/DefaultTaskExecutor.java
@@ -12,7 +12,7 @@
import java.util.Map;
/**
- * The default {@link TaskExecutor} which maps directly to base::ThreadPool.
+ * The default {@link TaskExecutor} which maps directly to base/task/post_task.h.
*/
class DefaultTaskExecutor implements TaskExecutor {
private final Map<TaskTraits, TaskRunner> mTraitsToRunnerMap = new HashMap<>();
diff --git a/base/i18n/streaming_utf8_validator_unittest.cc b/base/i18n/streaming_utf8_validator_unittest.cc
index 9c9bd5b3..37969689 100644
--- a/base/i18n/streaming_utf8_validator_unittest.cc
+++ b/base/i18n/streaming_utf8_validator_unittest.cc
@@ -110,7 +110,7 @@
};
TEST_F(StreamingUtf8ValidatorThoroughTest, TestEverything) {
- base::ThreadPool::CreateAndStartWithDefaultParams(
+ base::ThreadPoolInstance::CreateAndStartWithDefaultParams(
"StreamingUtf8ValidatorThoroughTest");
{
base::AutoLock al(lock_);
@@ -125,9 +125,9 @@
begin += kThoroughTestChunkSize;
} while (begin != 0);
}
- base::ThreadPool::GetInstance()->Shutdown();
- base::ThreadPool::GetInstance()->JoinForTesting();
- base::ThreadPool::SetInstance(nullptr);
+ base::ThreadPoolInstance::Get()->Shutdown();
+ base::ThreadPoolInstance::Get()->JoinForTesting();
+ base::ThreadPoolInstance::Set(nullptr);
}
#endif // BASE_I18N_UTF8_VALIDATOR_THOROUGH_TEST
diff --git a/base/observer_list_threadsafe_unittest.cc b/base/observer_list_threadsafe_unittest.cc
index 6d8f4a2..7f3db3e3 100644
--- a/base/observer_list_threadsafe_unittest.cc
+++ b/base/observer_list_threadsafe_unittest.cc
@@ -390,11 +390,11 @@
BindOnce(&ObserverListThreadSafe<Foo>::AddObserver,
observer_list, Unretained(&observer_2)));
- ThreadPool::GetInstance()->FlushForTesting();
+ ThreadPoolInstance::Get()->FlushForTesting();
observer_list->Notify(FROM_HERE, &Foo::Observe, 1);
- ThreadPool::GetInstance()->FlushForTesting();
+ ThreadPoolInstance::Get()->FlushForTesting();
EXPECT_TRUE(observer_1.called_on_valid_sequence());
EXPECT_TRUE(observer_2.called_on_valid_sequence());
@@ -467,7 +467,7 @@
->PostTask(FROM_HERE,
base::BindOnce(&ObserverListThreadSafe<Foo>::AddObserver,
observer_list, Unretained(&observer)));
- ThreadPool::GetInstance()->FlushForTesting();
+ ThreadPoolInstance::Get()->FlushForTesting();
observer_list->Notify(FROM_HERE, &Foo::Observe, 1);
observer.WaitForNotificationRunning();
diff --git a/base/task/README.md b/base/task/README.md
index 4d230ba9..a3710c54 100644
--- a/base/task/README.md
+++ b/base/task/README.md
@@ -3,9 +3,9 @@
- base/task/thread_pool/: implementation of the ThreadPool.
- base/task/sequence_manager/: implementation of the SequenceManager.
-Apart from embedders explicitly managing a ThreadPool and/or SequenceManager
-instance(s) for their process/threads, the vast majority of users should only
-need APIs in base/task/.
+Apart from embedders explicitly managing a ThreadPoolInstance and/or
+SequenceManager instance(s) for their process/threads, the vast majority of
+users should only need APIs in base/task/.
Documentation:
diff --git a/base/task/lazy_task_runner_unittest.cc b/base/task/lazy_task_runner_unittest.cc
index c3150fc..98619dd 100644
--- a/base/task/lazy_task_runner_unittest.cc
+++ b/base/task/lazy_task_runner_unittest.cc
@@ -161,7 +161,7 @@
test::ScopedTaskEnvironment scoped_task_environment;
// If the TaskRunner isn't released when the test::ScopedTaskEnvironment
// goes out of scope, the second invocation of the line below will access a
- // deleted ThreadPool and crash.
+ // deleted ThreadPoolInstance and crash.
g_sequenced_task_runner_user_visible.Get()->PostTask(FROM_HERE,
DoNothing());
}
@@ -172,7 +172,7 @@
test::ScopedTaskEnvironment scoped_task_environment;
// If the TaskRunner isn't released when the test::ScopedTaskEnvironment
// goes out of scope, the second invocation of the line below will access a
- // deleted ThreadPool and crash.
+ // deleted ThreadPoolInstance and crash.
g_single_thread_task_runner_user_visible.Get()->PostTask(FROM_HERE,
DoNothing());
}
@@ -184,7 +184,7 @@
test::ScopedTaskEnvironment scoped_task_environment;
// If the TaskRunner isn't released when the test::ScopedTaskEnvironment
// goes out of scope, the second invocation of the line below will access a
- // deleted ThreadPool and crash.
+ // deleted ThreadPoolInstance and crash.
g_com_sta_task_runner_user_visible.Get()->PostTask(FROM_HERE, DoNothing());
}
}
diff --git a/base/task/post_task.cc b/base/task/post_task.cc
index 744eea2..2a9b022 100644
--- a/base/task/post_task.cc
+++ b/base/task/post_task.cc
@@ -10,6 +10,7 @@
#include "base/task/scoped_set_task_priority_for_current_thread.h"
#include "base/task/task_executor.h"
#include "base/task/thread_pool/thread_pool.h"
+#include "base/task/thread_pool/thread_pool_impl.h"
#include "base/threading/post_task_and_reply_impl.h"
namespace base {
@@ -40,12 +41,14 @@
}
TaskExecutor* GetTaskExecutorForTraits(const TaskTraits& traits) {
- DCHECK(ThreadPool::GetInstance())
+ TaskExecutor* executor = GetRegisteredTaskExecutorForTraits(traits);
+ DCHECK(executor || ThreadPoolInstance::Get())
<< "Ref. Prerequisite section of post_task.h.\n\n"
"Hint: if this is in a unit test, you're likely merely missing a "
"base::test::ScopedTaskEnvironment member in your fixture.\n";
- TaskExecutor* executor = GetRegisteredTaskExecutorForTraits(traits);
- return executor ? executor : ThreadPool::GetInstance();
+ return executor ? executor
+ : static_cast<internal::ThreadPoolImpl*>(
+ ThreadPoolInstance::Get());
}
} // namespace
diff --git a/base/task/post_task.h b/base/task/post_task.h
index bdb1f9d..50faa81 100644
--- a/base/task/post_task.h
+++ b/base/task/post_task.h
@@ -59,9 +59,9 @@
// requirements are not sufficient.
//
// Tasks posted with only traits defined in base/task/task_traits.h run on
-// threads owned by the registered ThreadPool (i.e. not on the main thread).
-// An embedder (e.g. Chrome) can define additional traits to make tasks run on
-// threads of their choosing. TODO(https://crbug.com/863341): Make this a
+// threads owned by the registered ThreadPoolInstance (i.e. not on the main
+// thread). An embedder (e.g. Chrome) can define additional traits to make tasks
+// run on threads of their choosing. TODO(https://crbug.com/863341): Make this a
// reality.
//
// Tasks posted with the same traits will be scheduled in the order they were
@@ -70,8 +70,8 @@
// for tasks posted in a given order (being scheduled first doesn't mean it will
// run first -- could run in parallel or have its physical thread preempted).
//
-// Prerequisite: A ThreadPool must have been registered for the current
-// process via ThreadPool::SetInstance() before the functions below are
+// Prerequisite: A ThreadPoolInstance must have been registered for the current
+// process via ThreadPoolInstance::Set() before the functions below are
// valid. This is typically done during the initialization phase in each
// process. If your code is not running in that phase, you most likely don't
// have to worry about this. You will encounter DCHECKs or nullptr dereferences
diff --git a/base/task/scoped_set_task_priority_for_current_thread.h b/base/task/scoped_set_task_priority_for_current_thread.h
index e5f098b..713775f 100644
--- a/base/task/scoped_set_task_priority_for_current_thread.h
+++ b/base/task/scoped_set_task_priority_for_current_thread.h
@@ -25,9 +25,8 @@
DISALLOW_COPY_AND_ASSIGN(ScopedSetTaskPriorityForCurrentThread);
};
-// Returns the priority of the ThreadPool task running on the current thread,
-// or TaskPriority::USER_VISIBLE if no ThreadPool task is running on the
-// current thread.
+// Returns the priority of the task running on the current thread,
+// or TaskPriority::USER_VISIBLE if none.
BASE_EXPORT TaskPriority GetTaskPriorityForCurrentThread();
} // namespace internal
diff --git a/base/task/sequence_manager/sequence_manager_perftest.cc b/base/task/sequence_manager/sequence_manager_perftest.cc
index 9d76444..83221181 100644
--- a/base/task/sequence_manager/sequence_manager_perftest.cc
+++ b/base/task/sequence_manager/sequence_manager_perftest.cc
@@ -243,14 +243,14 @@
class SingleThreadInThreadPoolPerfTestDelegate : public PerfTestDelegate {
public:
SingleThreadInThreadPoolPerfTestDelegate() : done_cond_(&done_lock_) {
- ThreadPool::SetInstance(
+ ThreadPoolInstance::Set(
std::make_unique<::base::internal::ThreadPoolImpl>("Test"));
- ThreadPool::GetInstance()->StartWithDefaultParams();
+ ThreadPoolInstance::Get()->StartWithDefaultParams();
}
~SingleThreadInThreadPoolPerfTestDelegate() override {
- ThreadPool::GetInstance()->JoinForTesting();
- ThreadPool::SetInstance(nullptr);
+ ThreadPoolInstance::Get()->JoinForTesting();
+ ThreadPoolInstance::Set(nullptr);
}
const char* GetName() const override {
diff --git a/base/task/task_features.h b/base/task/task_features.h
index 169fa098..ac1ae97 100644
--- a/base/task/task_features.h
+++ b/base/task/task_features.h
@@ -31,7 +31,7 @@
#endif
#if HAS_NATIVE_THREAD_POOL()
-// Under this feature, ThreadPool will use a ThreadGroup backed by a
+// Under this feature, ThreadPoolImpl will use a ThreadGroup backed by a
// native thread pool implementation. The Windows Thread Pool API and
// libdispatch are used on Windows and macOS/iOS respectively.
extern const BASE_EXPORT Feature kUseNativeThreadPool;
diff --git a/base/task/task_traits.h b/base/task/task_traits.h
index d893a2a..2038380c 100644
--- a/base/task/task_traits.h
+++ b/base/task/task_traits.h
@@ -72,9 +72,10 @@
// executing when shutdown is invoked will be allowed to continue and
// will block shutdown until completion.
//
- // Note: Because ThreadPool::Shutdown() may block while these tasks are
- // executing, care must be taken to ensure that they do not block on the
- // thread that called ThreadPool::Shutdown(), as this may lead to deadlock.
+ // Note: Because ThreadPoolInstance::Shutdown() may block while these tasks
+ // are executing, care must be taken to ensure that they do not block on the
+ // thread that called ThreadPoolInstance::Shutdown(), as this may lead to
+ // deadlock.
SKIP_ON_SHUTDOWN,
// Tasks posted with this mode before shutdown is complete will block shutdown
@@ -163,9 +164,10 @@
// (1) don't block (ref. MayBlock() and WithBaseSyncPrimitives()),
// (2) prefer inheriting the current priority to specifying their own, and
// (3) can either block shutdown or be skipped on shutdown
- // (ThreadPool implementation is free to choose a fitting default).
+ // (ThreadPoolInstance implementation is free to choose a fitting
+ // default).
//
- // To get TaskTraits for tasks that require stricter guarantees and/or know
+ // To get TaskTraits for tasks that require stricter guarantees and/or know
// the specific TaskPriority appropriate for them, provide arguments of type
// TaskPriority, TaskShutdownBehavior, ThreadPolicy, MayBlock and/or
// WithBaseSyncPrimitives in any order to the constructor.
diff --git a/base/task/thread_pool/environment_config.cc b/base/task/thread_pool/environment_config.cc
index 2e531cf..2380f6a 100644
--- a/base/task/thread_pool/environment_config.cc
+++ b/base/task/thread_pool/environment_config.cc
@@ -23,7 +23,7 @@
#if !defined(OS_ANDROID)
// When thread priority can't be increased to NORMAL, run all threads with a
- // NORMAL priority to avoid priority inversions on shutdown (ThreadPool
+ // NORMAL priority to avoid priority inversions on shutdown (ThreadPoolImpl
// increases BACKGROUND threads priority to NORMAL on shutdown while resolving
// remaining shutdown blocking tasks).
//
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
index c5a4a64..5aebe0bd 100644
--- a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
+++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
@@ -49,9 +49,9 @@
// unit tests so that PooledSingleThreadTaskRunnerManager bound TaskRunners
// can return false on PostTask, letting such callers know they should complete
// necessary work synchronously. Note: |!g_manager_is_alive| is generally
-// equivalent to |!ThreadPool::GetInstance()| but has the advantage of being
+// equivalent to |!ThreadPoolInstance::Get()| but has the advantage of being
// valid in thread_pool unit tests that don't instantiate a full
-// ThreadPool.
+// thread pool.
bool g_manager_is_alive = false;
size_t GetEnvironmentIndexForTraits(const TaskTraits& traits) {
diff --git a/base/task/thread_pool/pooled_task_runner_delegate.h b/base/task/thread_pool/pooled_task_runner_delegate.h
index 967697b..8feec1ff 100644
--- a/base/task/thread_pool/pooled_task_runner_delegate.h
+++ b/base/task/thread_pool/pooled_task_runner_delegate.h
@@ -23,7 +23,7 @@
// Returns true if a PooledTaskRunnerDelegate instance exists in the
// process. This is needed in case of unit tests wherein a TaskRunner
- // outlives the ThreadPool that created it.
+ // outlives the ThreadPoolInstance that created it.
static bool Exists();
// Invoked when a |task| is posted to the PooledParallelTaskRunner or
diff --git a/base/task/thread_pool/service_thread.cc b/base/task/thread_pool/service_thread.cc
index 2d2d73f..01800c5 100644
--- a/base/task/thread_pool/service_thread.cc
+++ b/base/task/thread_pool/service_thread.cc
@@ -38,10 +38,10 @@
}
void ServiceThread::Init() {
- // In unit tests we sometimes do not have a fully functional ThreadPool
+ // In unit tests we sometimes do not have a fully functional thread pool
// environment, do not perform the heartbeat report in that case since it
// relies on such an environment.
- if (ThreadPool::GetInstance()) {
+ if (ThreadPoolInstance::Get()) {
// Compute the histogram every hour (with a slight offset to drift if that
// hour tick happens to line up with specific events). Once per hour per
// user was deemed sufficient to gather a reliable metric.
diff --git a/base/task/thread_pool/service_thread_unittest.cc b/base/task/thread_pool/service_thread_unittest.cc
index 6b666356..9bfb845 100644
--- a/base/task/thread_pool/service_thread_unittest.cc
+++ b/base/task/thread_pool/service_thread_unittest.cc
@@ -58,8 +58,8 @@
TEST(ThreadPoolServiceThreadIntegrationTest, HeartbeatLatencyReport) {
ServiceThread::SetHeartbeatIntervalForTesting(TimeDelta::FromMilliseconds(1));
- ThreadPool::SetInstance(std::make_unique<internal::ThreadPoolImpl>("Test"));
- ThreadPool::GetInstance()->StartWithDefaultParams();
+ ThreadPoolInstance::Set(std::make_unique<internal::ThreadPoolImpl>("Test"));
+ ThreadPoolInstance::Get()->StartWithDefaultParams();
static constexpr const char* kExpectedMetrics[] = {
"ThreadPool.HeartbeatLatencyMicroseconds.Test."
@@ -92,8 +92,8 @@
}
}
- ThreadPool::GetInstance()->JoinForTesting();
- ThreadPool::SetInstance(nullptr);
+ ThreadPoolInstance::Get()->JoinForTesting();
+ ThreadPoolInstance::Set(nullptr);
ServiceThread::SetHeartbeatIntervalForTesting(TimeDelta());
}
diff --git a/base/task/thread_pool/task.cc b/base/task/thread_pool/task.cc
index 33f19f1..91eea840 100644
--- a/base/task/thread_pool/task.cc
+++ b/base/task/thread_pool/task.cc
@@ -24,12 +24,12 @@
std::move(task),
delay.is_zero() ? TimeTicks() : TimeTicks::Now() + delay,
Nestable::kNonNestable) {
- // ThreadPool doesn't use |sequence_num| but tracing (toplevel.flow) relies
- // on it being unique. While this subtle dependency is a bit overreaching,
- // ThreadPool is the only task system that doesn't use |sequence_num| and
- // the dependent code rarely changes so this isn't worth a big change and
- // faking it here isn't too bad for now (posting tasks is full of atomic ops
- // already).
+ // ThreadPoolImpl doesn't use |sequence_num| but tracing (toplevel.flow)
+ // relies on it being unique. While this subtle dependency is a bit
+ // overreaching, ThreadPoolImpl is the only task system that doesn't use
+ // |sequence_num| and the dependent code rarely changes so this isn't worth a
+ // big change and faking it here isn't too bad for now (posting tasks is full
+ // of atomic ops already).
this->sequence_num = g_sequence_nums_for_tracing.GetNext();
}
diff --git a/base/task/thread_pool/thread_group_native.cc b/base/task/thread_pool/thread_group_native.cc
index 3f4682ef..48c86cc 100644
--- a/base/task/thread_pool/thread_group_native.cc
+++ b/base/task/thread_pool/thread_group_native.cc
@@ -150,7 +150,7 @@
// Native thread pools give us no control over the number of workers that are
// active at one time. Consequently, we cannot report a true value here.
// Instead, the values were chosen to match
- // ThreadPool::StartWithDefaultParams.
+ // ThreadPoolInstance::StartWithDefaultParams.
const int num_cores = SysInfo::NumberOfProcessors();
return std::max(3, num_cores - 1);
}
diff --git a/base/task/thread_pool/thread_pool.cc b/base/task/thread_pool/thread_pool.cc
index 300e16ed..750b8ea 100644
--- a/base/task/thread_pool/thread_pool.cc
+++ b/base/task/thread_pool/thread_pool.cc
@@ -18,33 +18,33 @@
namespace {
// |g_thread_pool| is intentionally leaked on shutdown.
-ThreadPool* g_thread_pool = nullptr;
+ThreadPoolInstance* g_thread_pool = nullptr;
} // namespace
-ThreadPool::InitParams::InitParams(int max_num_foreground_threads_in)
+ThreadPoolInstance::InitParams::InitParams(int max_num_foreground_threads_in)
: max_num_foreground_threads(max_num_foreground_threads_in) {}
-ThreadPool::InitParams::~InitParams() = default;
+ThreadPoolInstance::InitParams::~InitParams() = default;
-ThreadPool::ScopedExecutionFence::ScopedExecutionFence() {
+ThreadPoolInstance::ScopedExecutionFence::ScopedExecutionFence() {
DCHECK(g_thread_pool);
g_thread_pool->SetCanRun(false);
}
-ThreadPool::ScopedExecutionFence::~ScopedExecutionFence() {
+ThreadPoolInstance::ScopedExecutionFence::~ScopedExecutionFence() {
DCHECK(g_thread_pool);
g_thread_pool->SetCanRun(true);
}
#if !defined(OS_NACL)
// static
-void ThreadPool::CreateAndStartWithDefaultParams(StringPiece name) {
+void ThreadPoolInstance::CreateAndStartWithDefaultParams(StringPiece name) {
Create(name);
- GetInstance()->StartWithDefaultParams();
+ g_thread_pool->StartWithDefaultParams();
}
-void ThreadPool::StartWithDefaultParams() {
+void ThreadPoolInstance::StartWithDefaultParams() {
// Values were chosen so that:
// * There are few background threads.
// * Background threads never outnumber foreground threads.
@@ -57,18 +57,18 @@
}
#endif // !defined(OS_NACL)
-void ThreadPool::Create(StringPiece name) {
- SetInstance(std::make_unique<internal::ThreadPoolImpl>(name));
+void ThreadPoolInstance::Create(StringPiece name) {
+ Set(std::make_unique<internal::ThreadPoolImpl>(name));
}
// static
-void ThreadPool::SetInstance(std::unique_ptr<ThreadPool> thread_pool) {
+void ThreadPoolInstance::Set(std::unique_ptr<ThreadPoolInstance> thread_pool) {
delete g_thread_pool;
g_thread_pool = thread_pool.release();
}
// static
-ThreadPool* ThreadPool::GetInstance() {
+ThreadPoolInstance* ThreadPoolInstance::Get() {
return g_thread_pool;
}
diff --git a/base/task/thread_pool/thread_pool.h b/base/task/thread_pool/thread_pool.h
index c141741c..d60a463 100644
--- a/base/task/thread_pool/thread_pool.h
+++ b/base/task/thread_pool/thread_pool.h
@@ -16,7 +16,6 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string_piece.h"
#include "base/task/single_thread_task_runner_thread_mode.h"
-#include "base/task/task_executor.h"
#include "base/task/task_traits.h"
#include "base/task_runner.h"
#include "base/time/time.h"
@@ -45,10 +44,10 @@
//
// The instance methods of this class are thread-safe.
//
-// Note: All ThreadPool users should go through base/task/post_task.h instead
+// Note: All thread pool users should go through base/task/post_task.h instead
// of this interface except for the one callsite per process which manages the
// process's instance.
-class BASE_EXPORT ThreadPool : public TaskExecutor {
+class BASE_EXPORT ThreadPoolInstance {
public:
struct BASE_EXPORT InitParams {
enum class CommonThreadPoolEnvironment {
@@ -82,10 +81,10 @@
};
// A ScopedExecutionFence prevents any new task from being scheduled in
- // ThreadPool within its scope. Upon its destruction, all tasks that were
- // preeempted are released. Note: the constructor of ScopedExecutionFence will
- // not wait for currently running tasks (as they were posted before entering
- // this scope and do not violate the contract; some of them could be
+ // ThreadPoolInstance within its scope. Upon its destruction, all tasks that
+ // were preeempted are released. Note: the constructor of ScopedExecutionFence
+ // will not wait for currently running tasks (as they were posted before
+ // entering this scope and do not violate the contract; some of them could be
// CONTINUE_ON_SHUTDOWN and waiting for them to complete is ill-advised).
class BASE_EXPORT ScopedExecutionFence {
public:
@@ -96,10 +95,10 @@
DISALLOW_COPY_AND_ASSIGN(ScopedExecutionFence);
};
- // Destroying a ThreadPool is not allowed in production; it is always
+ // Destroying a ThreadPoolInstance is not allowed in production; it is always
// leaked. In tests, it should only be destroyed after JoinForTesting() has
// returned.
- ~ThreadPool() override = default;
+ virtual ~ThreadPoolInstance() = default;
// Allows the thread pool to create threads and run tasks following the
// |init_params| specification.
@@ -145,20 +144,20 @@
virtual void JoinForTesting() = 0;
// CreateAndStartWithDefaultParams(), Create(), and SetInstance() register a
- // ThreadPool to handle tasks posted through the post_task.h API for this
- // process.
+ // ThreadPoolInstance to handle tasks posted through the post_task.h API for
+ // this process.
//
- // Processes that need to initialize ThreadPool with custom params or that
- // need to allow tasks to be posted before the ThreadPool creates its
- // threads should use Create() followed by Start(). Other processes can use
- // CreateAndStartWithDefaultParams().
+ // Processes that need to initialize ThreadPoolInstance with custom params or
+ // that need to allow tasks to be posted before the ThreadPoolInstance creates
+ // its threads should use Create() followed by Start(). Other processes can
+ // use CreateAndStartWithDefaultParams().
//
- // A registered ThreadPool is only deleted when a new ThreadPool is
- // registered. The last registered ThreadPool is leaked on shutdown. The
- // methods below must not be called when TaskRunners created by a previous
- // ThreadPool are still alive. The methods are not thread-safe; proper
- // synchronization is required to use the post_task.h API after registering a
- // new ThreadPool.
+ // A registered ThreadPoolInstance is only deleted when a new
+ // ThreadPoolInstance is registered. The last registered ThreadPoolInstance is
+ // leaked on shutdown. The methods below must not be called when TaskRunners
+ // created by a previous ThreadPoolInstance are still alive. The methods are
+ // not thread-safe; proper synchronization is required to use the post_task.h
+ // API after registering a new ThreadPoolInstance.
#if !defined(OS_NACL)
// Creates and starts a thread pool using default params. |name| is used to
@@ -173,31 +172,30 @@
void StartWithDefaultParams();
#endif // !defined(OS_NACL)
- // Creates a ready to start thread pool. |name| is used to label
- // histograms, it must not be empty. It should identify the component that
- // creates the ThreadPool. The thread pool doesn't create threads until
- // Start() is called. Tasks can be posted at any time but will not run until
- // after Start() is called. For tests, prefer
- // base::test::ScopedTaskEnvironment (ensures isolation).
+ // Creates a ready to start thread pool. |name| is used to label histograms,
+ // it must not be empty. It should identify the component that creates the
+ // ThreadPoolInstance. The thread pool doesn't create threads until Start() is
+ // called. Tasks can be posted at any time but will not run until after
+ // Start() is called. For tests, prefer base::test::ScopedTaskEnvironment
+ // (ensures isolation).
static void Create(StringPiece name);
// Registers |thread_pool| to handle tasks posted through the post_task.h
// API for this process. For tests, prefer base::test::ScopedTaskEnvironment
// (ensures isolation).
- static void SetInstance(std::unique_ptr<ThreadPool> thread_pool);
+ static void Set(std::unique_ptr<ThreadPoolInstance> thread_pool);
- // Retrieve the ThreadPool set via SetInstance() or
- // CreateAndSet(Simple|Default)ThreadPool(). This should be used very
- // rarely; most users of ThreadPool should use the post_task.h API. In
- // particular, refrain from doing
- // if (!ThreadPool::GetInstance()) {
- // ThreadPool::SetInstance(...);
+ // Retrieve the ThreadPoolInstance set via SetInstance() or Create(). This
+ // should be used very rarely; most users of the thread pool should use the
+ // post_task.h API. In particular, refrain from doing
+ // if (!ThreadPoolInstance::Get()) {
+ // ThreadPoolInstance::Set(...);
// base::PostTask(...);
// }
// instead make sure to SetInstance() early in one determinstic place in the
// process' initialization phase.
// In doubt, consult with //base/task/thread_pool/OWNERS.
- static ThreadPool* GetInstance();
+ static ThreadPoolInstance* Get();
private:
friend class ThreadPoolTestHelpers;
@@ -205,7 +203,7 @@
friend class content::BrowserMainLoopTest_CreateThreadsInSingleProcess_Test;
// Returns the maximum number of non-single-threaded non-blocked tasks posted
- // with |traits| that can run concurrently in this ThreadPool. |traits|
+ // with |traits| that can run concurrently in this thread pool. |traits|
// can't contain TaskPriority::BEST_EFFORT.
//
// Do not use this method. To process n items, post n tasks that each process
diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc
index 34e0638e..c7e265e 100644
--- a/base/task/thread_pool/thread_pool_impl.cc
+++ b/base/task/thread_pool/thread_pool_impl.cc
@@ -106,7 +106,7 @@
background_thread_group_.reset();
}
-void ThreadPoolImpl::Start(const ThreadPool::InitParams& init_params,
+void ThreadPoolImpl::Start(const ThreadPoolInstance::InitParams& init_params,
WorkerThreadObserver* worker_thread_observer) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!started_);
diff --git a/base/task/thread_pool/thread_pool_impl.h b/base/task/thread_pool/thread_pool_impl.h
index d8ef7255..6a3784a 100644
--- a/base/task/thread_pool/thread_pool_impl.h
+++ b/base/task/thread_pool/thread_pool_impl.h
@@ -18,6 +18,7 @@
#include "base/strings/string_piece.h"
#include "base/synchronization/atomic_flag.h"
#include "base/task/single_thread_task_runner_thread_mode.h"
+#include "base/task/task_executor.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool/delayed_task_manager.h"
#include "base/task/thread_pool/environment_config.h"
@@ -45,8 +46,9 @@
namespace internal {
-// Default ThreadPool implementation. This class is thread-safe.
-class BASE_EXPORT ThreadPoolImpl : public ThreadPool,
+// Default ThreadPoolInstance implementation. This class is thread-safe.
+class BASE_EXPORT ThreadPoolImpl : public ThreadPoolInstance,
+ public TaskExecutor,
public ThreadGroup::Delegate,
public PooledTaskRunnerDelegate {
public:
@@ -67,8 +69,8 @@
~ThreadPoolImpl() override;
- // ThreadPool:
- void Start(const ThreadPool::InitParams& init_params,
+ // ThreadPoolInstance:
+ void Start(const ThreadPoolInstance::InitParams& init_params,
WorkerThreadObserver* worker_thread_observer) override;
int GetMaxConcurrentNonBlockedTasksWithTraitsDeprecated(
const TaskTraits& traits) const override;
diff --git a/base/task/thread_pool/thread_pool_impl_unittest.cc b/base/task/thread_pool/thread_pool_impl_unittest.cc
index 9e3f1cc..d855656c 100644
--- a/base/task/thread_pool/thread_pool_impl_unittest.cc
+++ b/base/task/thread_pool/thread_pool_impl_unittest.cc
@@ -162,7 +162,7 @@
}
scoped_refptr<TaskRunner> CreateTaskRunnerWithTraitsAndExecutionMode(
- ThreadPool* thread_pool,
+ ThreadPoolImpl* thread_pool,
const TaskTraits& traits,
TaskSourceExecutionMode execution_mode,
SingleThreadTaskRunnerThreadMode default_single_thread_task_runner_mode =
@@ -263,7 +263,7 @@
TimeDelta reclaim_time = TimeDelta::FromSeconds(30)) {
SetupFeatures();
- ThreadPool::InitParams init_params(max_num_foreground_threads);
+ ThreadPoolInstance::InitParams init_params(max_num_foreground_threads);
init_params.suggested_reclaim_time = reclaim_time;
thread_pool_.Start(init_params, worker_thread_observer_);
diff --git a/base/task/thread_pool/thread_pool_perftest.cc b/base/task/thread_pool/thread_pool_perftest.cc
index cd955c95..47d01f8 100644
--- a/base/task/thread_pool/thread_pool_perftest.cc
+++ b/base/task/thread_pool/thread_pool_perftest.cc
@@ -113,14 +113,14 @@
}
protected:
- ThreadPoolPerfTest() { ThreadPool::Create("PerfTest"); }
+ ThreadPoolPerfTest() { ThreadPoolInstance::Create("PerfTest"); }
- ~ThreadPoolPerfTest() override { ThreadPool::SetInstance(nullptr); }
+ ~ThreadPoolPerfTest() override { ThreadPoolInstance::Set(nullptr); }
void StartThreadPool(size_t num_running_threads,
size_t num_posting_threads,
base::RepeatingClosure post_action) {
- ThreadPool::GetInstance()->Start({num_running_threads});
+ ThreadPoolInstance::Get()->Start({num_running_threads});
base::RepeatingClosure done = BarrierClosure(
num_posting_threads,
@@ -136,7 +136,7 @@
void OnCompletePostingTasks() { complete_posting_tasks_.Signal(); }
void Benchmark(const std::string& trace, ExecutionMode execution_mode) {
- base::Optional<ThreadPool::ScopedExecutionFence> execution_fence;
+ base::Optional<ThreadPoolInstance::ScopedExecutionFence> execution_fence;
if (execution_mode == ExecutionMode::kPostThenRun) {
execution_fence.emplace();
}
@@ -151,13 +151,13 @@
}
// Wait for no pending tasks.
- ThreadPool::GetInstance()->FlushForTesting();
+ ThreadPoolInstance::Get()->FlushForTesting();
tasks_run_duration_ = TimeTicks::Now() - tasks_run_start;
ASSERT_EQ(0U, num_tasks_pending_);
for (auto& thread : threads_)
thread->Join();
- ThreadPool::GetInstance()->JoinForTesting();
+ ThreadPoolInstance::Get()->JoinForTesting();
perf_test::PrintResult(
"Posting tasks throughput", "", trace,
diff --git a/base/test/android/javatests/src/org/chromium/base/test/task/ThreadPoolTestHelpers.java b/base/test/android/javatests/src/org/chromium/base/test/task/ThreadPoolTestHelpers.java
index 34bf0d6..e90eaf9 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/task/ThreadPoolTestHelpers.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/task/ThreadPoolTestHelpers.java
@@ -4,17 +4,17 @@
package org.chromium.base.test.task;
-/** Helpers that allow base::ThreadPool to be initialized or shutdown for testing. */
+/** Helpers that allow base::ThreadPoolInstance to be initialized or shutdown for testing. */
public class ThreadPoolTestHelpers {
/**
- * Initializes base::ThreadPool with default params.
+ * Initializes base::ThreadPoolInstance with default params.
*/
public static void enableThreadPoolExecutionForTesting() {
nativeEnableThreadPoolExecutionForTesting();
}
/**
- * Shuts down base::ThreadPool.
+ * Shuts down base::ThreadPoolInstance.
*/
public static void disableThreadPoolExecutionForTesting() {
nativeDisableThreadPoolExecutionForTesting();
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 9af9190..675182b 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -666,8 +666,8 @@
print_test_stdio_(AUTO) {}
TestLauncher::~TestLauncher() {
- if (base::ThreadPool::GetInstance()) {
- base::ThreadPool::GetInstance()->Shutdown();
+ if (base::ThreadPoolInstance::Get()) {
+ base::ThreadPoolInstance::Get()->Shutdown();
}
}
@@ -1240,8 +1240,8 @@
}
void TestLauncher::CreateAndStartThreadPool(int num_parallel_jobs) {
- base::ThreadPool::Create("TestLauncher");
- base::ThreadPool::GetInstance()->Start({num_parallel_jobs});
+ base::ThreadPoolInstance::Create("TestLauncher");
+ base::ThreadPoolInstance::Get()->Start({num_parallel_jobs});
}
void TestLauncher::CombinePositiveTestFilters(
diff --git a/base/test/launcher/test_launcher.h b/base/test/launcher/test_launcher.h
index c6ac5aa..91ff42d 100644
--- a/base/test/launcher/test_launcher.h
+++ b/base/test/launcher/test_launcher.h
@@ -209,10 +209,9 @@
// Called by the delay timer when no output was made for a while.
void OnOutputTimeout();
- // Creates and starts a ThreadPool with |num_parallel_jobs| dedicated to
- // foreground blocking tasks (corresponds to the traits used to launch and
- // wait for child processes).
- // virtual to mock in testing.
+ // Creates and starts a ThreadPoolInstance with |num_parallel_jobs| dedicated
+ // to foreground blocking tasks (corresponds to the traits used to launch and
+ // wait for child processes). virtual to mock in testing.
virtual void CreateAndStartThreadPool(int num_parallel_jobs);
// Make sure we don't accidentally call the wrong methods e.g. on the worker
diff --git a/base/test/scoped_task_environment.cc b/base/test/scoped_task_environment.cc
index 26a96c2..4fae7f3 100644
--- a/base/test/scoped_task_environment.cc
+++ b/base/test/scoped_task_environment.cc
@@ -350,10 +350,10 @@
MakeExpectedNotRunClosure(FROM_HERE, "Run() timed out."))) {
CHECK(now_source == NowSource::REAL_TIME || mock_time_domain_)
<< "NowSource must be REAL_TIME unless we're using mock time";
- CHECK(!ThreadPool::GetInstance())
- << "Someone has already initialized ThreadPool. If nothing in your "
- "test does so, then a test that ran earlier may have initialized one, "
- "and leaked it. base::TestSuite will trap leaked globals, unless "
+ CHECK(!ThreadPoolInstance::Get())
+ << "Someone has already installed a ThreadPoolInstance. If nothing in "
+ "your test does so, then a test that ran earlier may have installed "
+ "one and leaked it. base::TestSuite will trap leaked globals, unless "
"someone has explicitly disabled it with "
"DisableCheckForLeakedGlobals().";
@@ -381,16 +381,16 @@
}
void ScopedTaskEnvironment::InitializeThreadPool() {
- // Instantiate a ThreadPool with 4 workers per pool. Having multiple
- // threads prevents deadlocks should some blocking APIs not use
+ // Instantiate a ThreadPoolInstance with 4 workers per thread group. Having
+ // multiple threads prevents deadlocks should some blocking APIs not use
// ScopedBlockingCall. It also allows enough concurrency to allow TSAN to spot
// data races.
constexpr int kMaxThreads = 4;
- ThreadPool::InitParams init_params(kMaxThreads);
+ ThreadPoolInstance::InitParams init_params(kMaxThreads);
init_params.suggested_reclaim_time = TimeDelta::Max();
#if defined(OS_WIN)
- // Enable the MTA in unit tests to match the browser process' ThreadPool
- // configuration.
+ // Enable the MTA in unit tests to match the browser process's
+ // ThreadPoolInstance configuration.
//
// This has the adverse side-effect of enabling the MTA in non-browser unit
// tests as well but the downside there is not as bad as not having it in
@@ -400,15 +400,15 @@
// misuse will still be caught in later phases (and COM usage should already
// be pretty much inexistent in sandboxed processes).
init_params.common_thread_pool_environment =
- ThreadPool::InitParams::CommonThreadPoolEnvironment::COM_MTA;
+ ThreadPoolInstance::InitParams::CommonThreadPoolEnvironment::COM_MTA;
#endif
auto task_tracker = std::make_unique<TestTaskTracker>();
task_tracker_ = task_tracker.get();
- ThreadPool::SetInstance(std::make_unique<internal::ThreadPoolImpl>(
+ ThreadPoolInstance::Set(std::make_unique<internal::ThreadPoolImpl>(
"ScopedTaskEnvironment", std::move(task_tracker)));
- thread_pool_ = ThreadPool::GetInstance();
- ThreadPool::GetInstance()->Start(init_params);
+ thread_pool_ = ThreadPoolInstance::Get();
+ ThreadPoolInstance::Get()->Start(init_params);
}
void ScopedTaskEnvironment::CompleteInitialization() {
@@ -440,18 +440,18 @@
// infinite post loop in the remaining work but this isn't possible right now
// because base::~MessageLoop() didn't use to do this and adding it here would
// make the migration away from MessageLoop that much harder.
- CHECK_EQ(ThreadPool::GetInstance(), thread_pool_);
+ CHECK_EQ(ThreadPoolInstance::Get(), thread_pool_);
// Without FlushForTesting(), DeleteSoon() and ReleaseSoon() tasks could be
// skipped, resulting in memory leaks.
task_tracker_->AllowRunTasks();
- ThreadPool::GetInstance()->FlushForTesting();
- ThreadPool::GetInstance()->Shutdown();
- ThreadPool::GetInstance()->JoinForTesting();
- // Destroying ThreadPool state can result in waiting on worker threads.
- // Make sure this is allowed to avoid flaking tests that have disallowed waits
- // on their main thread.
+ ThreadPoolInstance::Get()->FlushForTesting();
+ ThreadPoolInstance::Get()->Shutdown();
+ ThreadPoolInstance::Get()->JoinForTesting();
+ // Destroying ThreadPoolInstance state can result in waiting on worker
+ // threads. Make sure this is allowed to avoid flaking tests that have
+ // disallowed waits on their main thread.
ScopedAllowBaseSyncPrimitivesForTesting allow_waits_to_destroy_task_tracker;
- ThreadPool::SetInstance(nullptr);
+ ThreadPoolInstance::Set(nullptr);
}
sequence_manager::TimeDomain* ScopedTaskEnvironment::GetTimeDomain() const {
@@ -544,7 +544,8 @@
// tasks in ThreadPool. This increases likelihood of TSAN catching
// threading errors and eliminates possibility of hangs should a
// ThreadPool task synchronously block on a main thread task
- // (ThreadPool::FlushForTesting() can't be used here for that reason).
+ // (ThreadPoolInstance::FlushForTesting() can't be used here for that
+ // reason).
RunLoop().RunUntilIdle();
// Then halt ThreadPool. DisallowRunTasks() failing indicates that there
diff --git a/base/test/scoped_task_environment.h b/base/test/scoped_task_environment.h
index b6386fd..ccf2e53 100644
--- a/base/test/scoped_task_environment.h
+++ b/base/test/scoped_task_environment.h
@@ -22,7 +22,7 @@
class Clock;
class FileDescriptorWatcher;
-class ThreadPool;
+class ThreadPoolInstance;
class TickClock;
namespace test {
@@ -80,7 +80,7 @@
// The main thread doesn't pump system messages and uses a mock clock for
// delayed tasks (controllable via FastForward*() methods).
// TODO(gab): Make this the default |main_thread_type|.
- // TODO(gab): Also mock the ThreadPool's clock simultaneously (this
+ // TODO(gab): Also mock the ThreadPoolInstance's clock simultaneously (this
// currently only mocks the main thread's clock).
MOCK_TIME,
// The main thread pumps UI messages.
@@ -170,7 +170,7 @@
trait_helpers::NotATraitTag()) {}
// Waits until no undelayed ThreadPool tasks remain. Then, unregisters the
- // ThreadPool and the (Thread|Sequenced)TaskRunnerHandle.
+ // ThreadPoolInstance and the (Thread|Sequenced)TaskRunnerHandle.
virtual ~ScopedTaskEnvironment();
// Returns a TaskRunner that schedules tasks on the main thread.
@@ -303,7 +303,7 @@
std::unique_ptr<FileDescriptorWatcher> file_descriptor_watcher_;
#endif
- const ThreadPool* thread_pool_ = nullptr;
+ const ThreadPoolInstance* thread_pool_ = nullptr;
// Owned by |thread_pool_|.
TestTaskTracker* task_tracker_ = nullptr;
diff --git a/base/test/scoped_task_environment_unittest.cc b/base/test/scoped_task_environment_unittest.cc
index 6d77fde..c015495 100644
--- a/base/test/scoped_task_environment_unittest.cc
+++ b/base/test/scoped_task_environment_unittest.cc
@@ -281,7 +281,7 @@
TEST_P(ScopedTaskEnvironmentTest, SingleThreadShouldNotInitializeThreadPool) {
ScopedTaskEnvironmentForTest scoped_task_environment(
ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY);
- EXPECT_THAT(ThreadPool::GetInstance(), IsNull());
+ EXPECT_THAT(ThreadPoolInstance::Get(), IsNull());
}
#if defined(OS_POSIX)
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 6ccd773..7807d031 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -121,25 +121,25 @@
// Check for leaks in individual tests.
void OnTestStart(const testing::TestInfo& test) override {
- thread_pool_set_before_test_ = ThreadPool::GetInstance();
+ thread_pool_set_before_test_ = ThreadPoolInstance::Get();
}
void OnTestEnd(const testing::TestInfo& test) override {
- DCHECK_EQ(thread_pool_set_before_test_, ThreadPool::GetInstance())
+ DCHECK_EQ(thread_pool_set_before_test_, ThreadPoolInstance::Get())
<< " in test " << test.test_case_name() << "." << test.name();
}
// Check for leaks in test cases (consisting of one or more tests).
void OnTestCaseStart(const testing::TestCase& test_case) override {
- thread_pool_set_before_case_ = ThreadPool::GetInstance();
+ thread_pool_set_before_case_ = ThreadPoolInstance::Get();
}
void OnTestCaseEnd(const testing::TestCase& test_case) override {
- DCHECK_EQ(thread_pool_set_before_case_, ThreadPool::GetInstance())
+ DCHECK_EQ(thread_pool_set_before_case_, ThreadPoolInstance::Get())
<< " in case " << test_case.name();
}
private:
- ThreadPool* thread_pool_set_before_test_ = nullptr;
- ThreadPool* thread_pool_set_before_case_ = nullptr;
+ ThreadPoolInstance* thread_pool_set_before_test_ = nullptr;
+ ThreadPoolInstance* thread_pool_set_before_case_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(CheckForLeakedGlobals);
};
diff --git a/base/test/thread_pool_test_helpers_android.cc b/base/test/thread_pool_test_helpers_android.cc
index 07195be..69f4eddd 100644
--- a/base/test/thread_pool_test_helpers_android.cc
+++ b/base/test/thread_pool_test_helpers_android.cc
@@ -7,8 +7,8 @@
namespace base {
-// ThreadPoolTestHelpers is a friend of ThreadPool which grants access to
-// SetExecutionFenceEnabled.
+// ThreadPoolTestHelpers is a friend of ThreadPoolInstance which grants access
+// to SetCanRun().
class ThreadPoolTestHelpers {
public:
// Enables/disables an execution fence that prevents tasks from running.
@@ -19,19 +19,19 @@
// static
void ThreadPoolTestHelpers::SetThreadPoolExecutionFenceEnabledForTesting(
bool execution_fence_enabled) {
- ThreadPool::GetInstance()->SetCanRun(!execution_fence_enabled);
+ ThreadPoolInstance::Get()->SetCanRun(!execution_fence_enabled);
}
} // namespace base
void JNI_ThreadPoolTestHelpers_EnableThreadPoolExecutionForTesting(
JNIEnv* env) {
- base::ThreadPoolTestHelpers::SetThreadPoolExecutionFenceEnabledForTesting(
- false);
+ base::ThreadPoolTestHelpers::
+ SetThreadPoolExecutionFenceEnabledForTesting(false);
}
void JNI_ThreadPoolTestHelpers_DisableThreadPoolExecutionForTesting(
JNIEnv* env) {
- base::ThreadPoolTestHelpers::SetThreadPoolExecutionFenceEnabledForTesting(
- true);
+ base::ThreadPoolTestHelpers::
+ SetThreadPoolExecutionFenceEnabledForTesting(true);
}
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
index d328f05..1ec75dd 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -53,8 +53,8 @@
// Avoid using allowances outside of unit tests. In unit tests, use allowances
// with the suffix "ForTesting".
//
-// Prefer making blocking calls from tasks posted to base::ThreadPool with
-// base::MayBlock().
+// Prefer making blocking calls from tasks posted to base::ThreadPoolInstance
+// with base::MayBlock().
//
// Instead of waiting on a WaitableEvent or a ConditionVariable, prefer putting
// the work that should happen after the wait in a continuation callback and
diff --git a/base/win/com_init_check_hook.h b/base/win/com_init_check_hook.h
index 6b91955..304e62a 100644
--- a/base/win/com_init_check_hook.h
+++ b/base/win/com_init_check_hook.h
@@ -41,7 +41,7 @@
// For components that cannot use COM_INIT_CHECK_HOOK_DISABLED, call
// DisableCOMChecksForProcess() below. This should only be for code that calls
// into Windows components that don't explicitly initialize the MTA in the
- // Windows threadpool.
+ // Windows thread pool.
friend class device::XrDeviceService;
static void DisableCOMChecksForProcess();