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

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

Issue 1461703009: Switch //components from vector_as_array to vector::data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eroman comment Created 5 years, 1 month 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/algorithms/util.cc ('k') | components/webcrypto/webcrypto_impl.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 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/crypto_data.h" 5 #include "components/webcrypto/crypto_data.h"
6 #include "base/stl_util.h"
7 6
8 namespace webcrypto { 7 namespace webcrypto {
9 8
10 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) { 9 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {
11 } 10 }
12 11
13 CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length) 12 CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length)
14 : bytes_(bytes), byte_length_(byte_length) { 13 : bytes_(bytes), byte_length_(byte_length) {
15 } 14 }
16 15
17 CryptoData::CryptoData(const std::vector<unsigned char>& bytes) 16 CryptoData::CryptoData(const std::vector<unsigned char>& bytes)
18 : bytes_(vector_as_array(&bytes)), 17 : bytes_(bytes.data()),
19 byte_length_(static_cast<unsigned int>(bytes.size())) { 18 byte_length_(static_cast<unsigned int>(bytes.size())) {}
20 }
21 19
22 CryptoData::CryptoData(const std::string& bytes) 20 CryptoData::CryptoData(const std::string& bytes)
23 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) 21 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data())
24 : NULL), 22 : NULL),
25 byte_length_(static_cast<unsigned int>(bytes.size())) { 23 byte_length_(static_cast<unsigned int>(bytes.size())) {
26 } 24 }
27 25
28 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) 26 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes)
29 : bytes_(bytes.data()), 27 : bytes_(bytes.data()),
30 byte_length_(static_cast<unsigned int>(bytes.size())) { 28 byte_length_(static_cast<unsigned int>(bytes.size())) {
31 } 29 }
32 30
33 } // namespace webcrypto 31 } // namespace webcrypto
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/util.cc ('k') | components/webcrypto/webcrypto_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698