OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ | 5 #ifndef NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ |
6 #define NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ | 6 #define NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/thread.h" |
| 11 |
| 12 namespace base { |
| 13 class SingleThreadTaskRunner; |
| 14 } |
10 | 15 |
11 namespace net { | 16 namespace net { |
12 | 17 |
13 // Serialize all the private key operations on a single background | 18 // Serialize all the private key operations on a single background thread to |
14 // thread to avoid problems with buggy smartcards. | 19 // avoid problems with buggy smartcards. Its underlying Thread is non-joinable |
| 20 // and as such provides TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN semantics. |
15 class SSLPlatformKeyTaskRunner { | 21 class SSLPlatformKeyTaskRunner { |
16 public: | 22 public: |
17 SSLPlatformKeyTaskRunner(); | 23 SSLPlatformKeyTaskRunner(); |
18 ~SSLPlatformKeyTaskRunner(); | 24 ~SSLPlatformKeyTaskRunner(); |
19 | 25 |
20 scoped_refptr<base::SequencedTaskRunner> task_runner(); | 26 scoped_refptr<base::SingleThreadTaskRunner> task_runner(); |
21 | 27 |
22 private: | 28 private: |
23 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 29 base::Thread worker_thread_; |
24 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
25 | 30 |
26 DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeyTaskRunner); | 31 DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeyTaskRunner); |
27 }; | 32 }; |
28 | 33 |
29 scoped_refptr<base::SequencedTaskRunner> GetSSLPlatformKeyTaskRunner(); | 34 scoped_refptr<base::SingleThreadTaskRunner> GetSSLPlatformKeyTaskRunner(); |
30 | 35 |
31 } // namespace net | 36 } // namespace net |
32 | 37 |
33 #endif // NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ | 38 #endif // NET_SSL_SSL_PLATFORM_KEY_TASK_RUNNER_H_ |
OLD | NEW |