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

Side by Side Diff: components/webcrypto/webcrypto_impl.cc

Issue 2142783002: Use std::unique_ptr to pass around WebCryptoDigestor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « components/webcrypto/webcrypto_impl.h ('k') | third_party/WebKit/Source/platform/Crypto.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/webcrypto/webcrypto_impl.h" 5 #include "components/webcrypto/webcrypto_impl.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 blink::WebCryptoResult result) { 756 blink::WebCryptoResult result) {
757 std::unique_ptr<DeriveKeyState> state( 757 std::unique_ptr<DeriveKeyState> state(
758 new DeriveKeyState(algorithm, base_key, import_algorithm, 758 new DeriveKeyState(algorithm, base_key, import_algorithm,
759 key_length_algorithm, extractable, usages, result)); 759 key_length_algorithm, extractable, usages, result));
760 if (!CryptoThreadPool::PostTask( 760 if (!CryptoThreadPool::PostTask(
761 FROM_HERE, base::Bind(DoDeriveKey, base::Passed(&state)))) { 761 FROM_HERE, base::Bind(DoDeriveKey, base::Passed(&state)))) {
762 CompleteWithThreadPoolError(&result); 762 CompleteWithThreadPoolError(&result);
763 } 763 }
764 } 764 }
765 765
766 blink::WebCryptoDigestor* WebCryptoImpl::createDigestor( 766 std::unique_ptr<blink::WebCryptoDigestor> WebCryptoImpl::createDigestor(
767 blink::WebCryptoAlgorithmId algorithm_id) { 767 blink::WebCryptoAlgorithmId algorithm_id) {
768 return webcrypto::CreateDigestor(algorithm_id).release(); 768 return webcrypto::CreateDigestor(algorithm_id);
769 } 769 }
770 770
771 bool WebCryptoImpl::deserializeKeyForClone( 771 bool WebCryptoImpl::deserializeKeyForClone(
772 const blink::WebCryptoKeyAlgorithm& algorithm, 772 const blink::WebCryptoKeyAlgorithm& algorithm,
773 blink::WebCryptoKeyType type, 773 blink::WebCryptoKeyType type,
774 bool extractable, 774 bool extractable,
775 blink::WebCryptoKeyUsageMask usages, 775 blink::WebCryptoKeyUsageMask usages,
776 const unsigned char* key_data, 776 const unsigned char* key_data,
777 unsigned key_data_size, 777 unsigned key_data_size,
778 blink::WebCryptoKey& key) { 778 blink::WebCryptoKey& key) {
779 return webcrypto::DeserializeKeyForClone( 779 return webcrypto::DeserializeKeyForClone(
780 algorithm, type, extractable, usages, 780 algorithm, type, extractable, usages,
781 webcrypto::CryptoData(key_data, key_data_size), &key); 781 webcrypto::CryptoData(key_data, key_data_size), &key);
782 } 782 }
783 783
784 bool WebCryptoImpl::serializeKeyForClone( 784 bool WebCryptoImpl::serializeKeyForClone(
785 const blink::WebCryptoKey& key, 785 const blink::WebCryptoKey& key,
786 blink::WebVector<unsigned char>& key_data) { 786 blink::WebVector<unsigned char>& key_data) {
787 return webcrypto::SerializeKeyForClone(key, &key_data); 787 return webcrypto::SerializeKeyForClone(key, &key_data);
788 } 788 }
789 789
790 } // namespace webcrypto 790 } // namespace webcrypto
OLDNEW
« no previous file with comments | « components/webcrypto/webcrypto_impl.h ('k') | third_party/WebKit/Source/platform/Crypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698