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

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

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 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/threaded_ssl_private_key.h ('k') | net/test/embedded_test_server/default_handlers.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 #include "net/ssl/threaded_ssl_private_key.h" 5 #include "net/ssl/threaded_ssl_private_key.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 Error error) { 23 Error error) {
24 if (!key) 24 if (!key)
25 return; 25 return;
26 callback.Run(error, *signature); 26 callback.Run(error, *signature);
27 } 27 }
28 } 28 }
29 29
30 class ThreadedSSLPrivateKey::Core 30 class ThreadedSSLPrivateKey::Core
31 : public base::RefCountedThreadSafe<ThreadedSSLPrivateKey::Core> { 31 : public base::RefCountedThreadSafe<ThreadedSSLPrivateKey::Core> {
32 public: 32 public:
33 Core(scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate) 33 Core(std::unique_ptr<ThreadedSSLPrivateKey::Delegate> delegate)
34 : delegate_(std::move(delegate)) {} 34 : delegate_(std::move(delegate)) {}
35 35
36 ThreadedSSLPrivateKey::Delegate* delegate() { return delegate_.get(); } 36 ThreadedSSLPrivateKey::Delegate* delegate() { return delegate_.get(); }
37 37
38 Error SignDigest(SSLPrivateKey::Hash hash, 38 Error SignDigest(SSLPrivateKey::Hash hash,
39 const base::StringPiece& input, 39 const base::StringPiece& input,
40 std::vector<uint8_t>* signature) { 40 std::vector<uint8_t>* signature) {
41 return delegate_->SignDigest(hash, input, signature); 41 return delegate_->SignDigest(hash, input, signature);
42 } 42 }
43 43
44 private: 44 private:
45 friend class base::RefCountedThreadSafe<Core>; 45 friend class base::RefCountedThreadSafe<Core>;
46 ~Core() {} 46 ~Core() {}
47 47
48 scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate_; 48 std::unique_ptr<ThreadedSSLPrivateKey::Delegate> delegate_;
49 }; 49 };
50 50
51 ThreadedSSLPrivateKey::ThreadedSSLPrivateKey( 51 ThreadedSSLPrivateKey::ThreadedSSLPrivateKey(
52 scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate, 52 std::unique_ptr<ThreadedSSLPrivateKey::Delegate> delegate,
53 scoped_refptr<base::TaskRunner> task_runner) 53 scoped_refptr<base::TaskRunner> task_runner)
54 : core_(new Core(std::move(delegate))), 54 : core_(new Core(std::move(delegate))),
55 task_runner_(std::move(task_runner)), 55 task_runner_(std::move(task_runner)),
56 weak_factory_(this) {} 56 weak_factory_(this) {}
57 57
58 SSLPrivateKey::Type ThreadedSSLPrivateKey::GetType() { 58 SSLPrivateKey::Type ThreadedSSLPrivateKey::GetType() {
59 return core_->delegate()->GetType(); 59 return core_->delegate()->GetType();
60 } 60 }
61 61
62 std::vector<SSLPrivateKey::Hash> ThreadedSSLPrivateKey::GetDigestPreferences() { 62 std::vector<SSLPrivateKey::Hash> ThreadedSSLPrivateKey::GetDigestPreferences() {
(...skipping 13 matching lines...) Expand all
76 task_runner_.get(), FROM_HERE, 76 task_runner_.get(), FROM_HERE,
77 base::Bind(&ThreadedSSLPrivateKey::Core::SignDigest, core_, hash, 77 base::Bind(&ThreadedSSLPrivateKey::Core::SignDigest, core_, hash,
78 input.as_string(), base::Unretained(signature)), 78 input.as_string(), base::Unretained(signature)),
79 base::Bind(&DoCallback, weak_factory_.GetWeakPtr(), callback, 79 base::Bind(&DoCallback, weak_factory_.GetWeakPtr(), callback,
80 base::Owned(signature))); 80 base::Owned(signature)));
81 } 81 }
82 82
83 ThreadedSSLPrivateKey::~ThreadedSSLPrivateKey() {} 83 ThreadedSSLPrivateKey::~ThreadedSSLPrivateKey() {}
84 84
85 } // namespace net 85 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/threaded_ssl_private_key.h ('k') | net/test/embedded_test_server/default_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698