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

Unified Diff: net/ssl/ssl_platform_key_task_runner.cc

Issue 2103883004: Remove dependency of SSLPlatformKeyTaskRunner on single-threaded SequencedWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_hook
Patch Set: Clarify API further. Created 4 years, 6 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: net/ssl/ssl_platform_key_task_runner.cc
diff --git a/net/ssl/ssl_platform_key_task_runner.cc b/net/ssl/ssl_platform_key_task_runner.cc
index 7611d60454dccbef7f7ea8f1915e3c124511ebf8..729b7d0131d15c1e1bf91407fdc24ede22772ad2 100644
--- a/net/ssl/ssl_platform_key_task_runner.cc
+++ b/net/ssl/ssl_platform_key_task_runner.cc
@@ -3,29 +3,30 @@
// found in the LICENSE file.
#include "base/lazy_instance.h"
+#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
#include "net/ssl/ssl_platform_key_task_runner.h"
namespace net {
-SSLPlatformKeyTaskRunner::SSLPlatformKeyTaskRunner() {
- worker_pool_ = new base::SequencedWorkerPool(1, "Platform Key Thread");
- task_runner_ = worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
- worker_pool_->GetSequenceToken(),
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
-}
-
-SSLPlatformKeyTaskRunner::~SSLPlatformKeyTaskRunner() {}
-
-scoped_refptr<base::SequencedTaskRunner>
-SSLPlatformKeyTaskRunner::task_runner() {
- return task_runner_;
-}
+namespace {
base::LazyInstance<SSLPlatformKeyTaskRunner>::Leaky g_platform_key_task_runner =
LAZY_INSTANCE_INITIALIZER;
-scoped_refptr<base::SequencedTaskRunner> GetSSLPlatformKeyTaskRunner() {
- return g_platform_key_task_runner.Get().task_runner();
+} // namespace
+
+SSLPlatformKeyTaskRunner::SSLPlatformKeyTaskRunner()
+ : worker_thread_("Platform Key Thread") {
+ worker_thread_.Start();
+}
+
+// static
+scoped_refptr<base::SingleThreadTaskRunner> SSLPlatformKeyTaskRunner::Get() {
+ scoped_refptr<base::SingleThreadTaskRunner> ssl_task_runner =
+ g_platform_key_task_runner.Get().worker_thread_.task_runner();
+ DCHECK(ssl_task_runner);
+ return ssl_task_runner;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698