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

Unified Diff: base/threading/worker_pool.cc

Issue 2667513003: Remove some LazyInstance use in base/ (Closed)
Patch Set: no message_window Created 3 years, 11 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
Index: base/threading/worker_pool.cc
diff --git a/base/threading/worker_pool.cc b/base/threading/worker_pool.cc
index 6e07b6ef37e3d1b1c47ace828c6384a10061ddf0..96a391480831144730e774af305739dd81449053 100644
--- a/base/threading/worker_pool.cc
+++ b/base/threading/worker_pool.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/debug/leak_annotations.h"
-#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/task_runner.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -98,9 +97,6 @@ struct TaskRunnerHolder {
scoped_refptr<TaskRunner> taskrunners_[2];
};
-base::LazyInstance<TaskRunnerHolder>::Leaky
- g_taskrunners = LAZY_INSTANCE_INITIALIZER;
-
} // namespace
bool WorkerPool::PostTaskAndReply(const tracked_objects::Location& from_here,
@@ -120,7 +116,8 @@ bool WorkerPool::PostTaskAndReply(const tracked_objects::Location& from_here,
// static
const scoped_refptr<TaskRunner>&
WorkerPool::GetTaskRunner(bool tasks_are_slow) {
- return g_taskrunners.Get().taskrunners_[tasks_are_slow];
+ static auto task_runner_holder = new TaskRunnerHolder();
+ return task_runner_holder->taskrunners_[tasks_are_slow];
}
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698