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

Unified Diff: net/socket/client_socket_factory.cc

Issue 10749009: Switch the NSS thread from being a base::Thread to a base::SequencedWorkerPool of 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove suppression Created 8 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 | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_factory.cc
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc
index f507f4e94605ac12f07f307a37ac06166d93b5f0..b5b9ca60e20640c261fdaa6f3eedc245cd2212ea 100644
--- a/net/socket/client_socket_factory.cc
+++ b/net/socket/client_socket_factory.cc
@@ -6,7 +6,7 @@
#include "base/lazy_instance.h"
#include "base/thread_task_runner_handle.h"
-#include "base/threading/thread.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "build/build_config.h"
#include "net/base/cert_database.h"
#include "net/socket/client_socket_handle.h"
@@ -47,9 +47,12 @@ class DefaultClientSocketFactory : public ClientSocketFactory,
public:
DefaultClientSocketFactory() {
if (g_use_dedicated_nss_thread) {
- nss_thread_.reset(new base::Thread("NSS SSL Thread"));
- if (nss_thread_->Start())
- nss_thread_task_runner_ = nss_thread_->message_loop_proxy();
+ // Use a single thread for the worker pool.
+ worker_pool_ = new base::SequencedWorkerPool(1, "NSS SSL Thread");
+ nss_thread_task_runner_ =
+ worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
+ worker_pool_->GetSequenceToken(),
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
CertDatabase::AddObserver(this);
@@ -101,7 +104,7 @@ class DefaultClientSocketFactory : public ClientSocketFactory,
// between each test. Because the DefaultClientSocketFactory is leaky, it
// may span multiple tests, and thus the current task runner may change
// from call to call.
- scoped_refptr<base::SingleThreadTaskRunner> nss_task_runner(
+ scoped_refptr<base::SequencedTaskRunner> nss_task_runner(
nss_thread_task_runner_);
if (!nss_task_runner)
nss_task_runner = base::ThreadTaskRunnerHandle::Get();
@@ -139,8 +142,8 @@ class DefaultClientSocketFactory : public ClientSocketFactory,
}
private:
- scoped_ptr<base::Thread> nss_thread_;
- scoped_refptr<base::SingleThreadTaskRunner> nss_thread_task_runner_;
+ scoped_refptr<base::SequencedWorkerPool> worker_pool_;
+ scoped_refptr<base::SequencedTaskRunner> nss_thread_task_runner_;
};
static base::LazyInstance<DefaultClientSocketFactory>::Leaky
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698