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

Side by Side Diff: net/ssl/threaded_ssl_private_key.h

Issue 2103883004: Remove dependency of SSLPlatformKeyTaskRunner on single-threaded SequencedWorkerPool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_hook
Patch Set: fix fwd-decls Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « net/ssl/ssl_platform_key_task_runner.cc ('k') | net/ssl/threaded_ssl_private_key.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_THREADED_SSL_PRIVATE_KEY_H_ 5 #ifndef NET_SSL_THREADED_SSL_PRIVATE_KEY_H_
6 #define NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ 6 #define NET_SSL_THREADED_SSL_PRIVATE_KEY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "net/ssl/ssl_private_key.h" 18 #include "net/ssl/ssl_private_key.h"
19 19
20 namespace base { 20 namespace base {
21 class TaskRunner; 21 class SingleThreadTaskRunner;
22 } 22 }
23 23
24 namespace net { 24 namespace net {
25 25
26 // An SSLPrivateKey implementation which offloads key operations to a background 26 // An SSLPrivateKey implementation which offloads key operations to a background
27 // task runner. 27 // task runner.
28 class ThreadedSSLPrivateKey : public SSLPrivateKey { 28 class ThreadedSSLPrivateKey : public SSLPrivateKey {
29 public: 29 public:
30 // Interface for consumers to implement to perform the actual signing 30 // Interface for consumers to implement to perform the actual signing
31 // operation. 31 // operation.
(...skipping 13 matching lines...) Expand all
45 // error code. It will only be called on the task runner passed to the 45 // error code. It will only be called on the task runner passed to the
46 // owning ThreadedSSLPrivateKey. 46 // owning ThreadedSSLPrivateKey.
47 virtual Error SignDigest(Hash hash, 47 virtual Error SignDigest(Hash hash,
48 const base::StringPiece& input, 48 const base::StringPiece& input,
49 std::vector<uint8_t>* signature) = 0; 49 std::vector<uint8_t>* signature) = 0;
50 50
51 private: 51 private:
52 DISALLOW_COPY_AND_ASSIGN(Delegate); 52 DISALLOW_COPY_AND_ASSIGN(Delegate);
53 }; 53 };
54 54
55 ThreadedSSLPrivateKey(std::unique_ptr<Delegate> delegate, 55 ThreadedSSLPrivateKey(
56 scoped_refptr<base::TaskRunner> task_runner); 56 std::unique_ptr<Delegate> delegate,
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
57 58
58 // SSLPrivateKey implementation. 59 // SSLPrivateKey implementation.
59 Type GetType() override; 60 Type GetType() override;
60 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override; 61 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override;
61 size_t GetMaxSignatureLengthInBytes() override; 62 size_t GetMaxSignatureLengthInBytes() override;
62 void SignDigest(Hash hash, 63 void SignDigest(Hash hash,
63 const base::StringPiece& input, 64 const base::StringPiece& input,
64 const SignCallback& callback) override; 65 const SignCallback& callback) override;
65 66
66 private: 67 private:
67 ~ThreadedSSLPrivateKey() override; 68 ~ThreadedSSLPrivateKey() override;
68 class Core; 69 class Core;
69 70
70 scoped_refptr<Core> core_; 71 scoped_refptr<Core> core_;
71 scoped_refptr<base::TaskRunner> task_runner_; 72 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
72 base::WeakPtrFactory<ThreadedSSLPrivateKey> weak_factory_; 73 base::WeakPtrFactory<ThreadedSSLPrivateKey> weak_factory_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(ThreadedSSLPrivateKey); 75 DISALLOW_COPY_AND_ASSIGN(ThreadedSSLPrivateKey);
75 }; 76 };
76 77
77 } // namespace net 78 } // namespace net
78 79
79 #endif // NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ 80 #endif // NET_SSL_THREADED_SSL_PRIVATE_KEY_H_
OLDNEW
« no previous file with comments | « net/ssl/ssl_platform_key_task_runner.cc ('k') | net/ssl/threaded_ssl_private_key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698