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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp

Issue 2811463002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/exported (Closed)
Patch Set: rebase Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 WebCryptoKeyPrivate(std::unique_ptr<WebCryptoKeyHandle> handle, 44 WebCryptoKeyPrivate(std::unique_ptr<WebCryptoKeyHandle> handle,
45 WebCryptoKeyType type, 45 WebCryptoKeyType type,
46 bool extractable, 46 bool extractable,
47 const WebCryptoKeyAlgorithm& algorithm, 47 const WebCryptoKeyAlgorithm& algorithm,
48 WebCryptoKeyUsageMask usages) 48 WebCryptoKeyUsageMask usages)
49 : handle(std::move(handle)), 49 : handle(std::move(handle)),
50 type(type), 50 type(type),
51 extractable(extractable), 51 extractable(extractable),
52 algorithm(algorithm), 52 algorithm(algorithm),
53 usages(usages) { 53 usages(usages) {
54 ASSERT(!algorithm.IsNull()); 54 DCHECK(!algorithm.IsNull());
55 } 55 }
56 56
57 const std::unique_ptr<WebCryptoKeyHandle> handle; 57 const std::unique_ptr<WebCryptoKeyHandle> handle;
58 const WebCryptoKeyType type; 58 const WebCryptoKeyType type;
59 const bool extractable; 59 const bool extractable;
60 const WebCryptoKeyAlgorithm algorithm; 60 const WebCryptoKeyAlgorithm algorithm;
61 const WebCryptoKeyUsageMask usages; 61 const WebCryptoKeyUsageMask usages;
62 }; 62 };
63 63
64 WebCryptoKey WebCryptoKey::Create(WebCryptoKeyHandle* handle, 64 WebCryptoKey WebCryptoKey::Create(WebCryptoKeyHandle* handle,
65 WebCryptoKeyType type, 65 WebCryptoKeyType type,
66 bool extractable, 66 bool extractable,
67 const WebCryptoKeyAlgorithm& algorithm, 67 const WebCryptoKeyAlgorithm& algorithm,
68 WebCryptoKeyUsageMask usages) { 68 WebCryptoKeyUsageMask usages) {
69 WebCryptoKey key; 69 WebCryptoKey key;
70 key.private_ = AdoptRef(new WebCryptoKeyPrivate( 70 key.private_ = AdoptRef(new WebCryptoKeyPrivate(
71 WTF::WrapUnique(handle), type, extractable, algorithm, usages)); 71 WTF::WrapUnique(handle), type, extractable, algorithm, usages));
72 return key; 72 return key;
73 } 73 }
74 74
75 WebCryptoKey WebCryptoKey::CreateNull() { 75 WebCryptoKey WebCryptoKey::CreateNull() {
76 return WebCryptoKey(); 76 return WebCryptoKey();
77 } 77 }
78 78
79 WebCryptoKeyHandle* WebCryptoKey::Handle() const { 79 WebCryptoKeyHandle* WebCryptoKey::Handle() const {
80 ASSERT(!IsNull()); 80 DCHECK(!IsNull());
81 return private_->handle.get(); 81 return private_->handle.get();
82 } 82 }
83 83
84 WebCryptoKeyType WebCryptoKey::GetType() const { 84 WebCryptoKeyType WebCryptoKey::GetType() const {
85 ASSERT(!IsNull()); 85 DCHECK(!IsNull());
86 return private_->type; 86 return private_->type;
87 } 87 }
88 88
89 bool WebCryptoKey::Extractable() const { 89 bool WebCryptoKey::Extractable() const {
90 ASSERT(!IsNull()); 90 DCHECK(!IsNull());
91 return private_->extractable; 91 return private_->extractable;
92 } 92 }
93 93
94 const WebCryptoKeyAlgorithm& WebCryptoKey::Algorithm() const { 94 const WebCryptoKeyAlgorithm& WebCryptoKey::Algorithm() const {
95 ASSERT(!IsNull()); 95 DCHECK(!IsNull());
96 return private_->algorithm; 96 return private_->algorithm;
97 } 97 }
98 98
99 WebCryptoKeyUsageMask WebCryptoKey::Usages() const { 99 WebCryptoKeyUsageMask WebCryptoKey::Usages() const {
100 ASSERT(!IsNull()); 100 DCHECK(!IsNull());
101 return private_->usages; 101 return private_->usages;
102 } 102 }
103 103
104 bool WebCryptoKey::IsNull() const { 104 bool WebCryptoKey::IsNull() const {
105 return private_.IsNull(); 105 return private_.IsNull();
106 } 106 }
107 107
108 bool WebCryptoKey::KeyUsageAllows(const blink::WebCryptoKeyUsage usage) const { 108 bool WebCryptoKey::KeyUsageAllows(const blink::WebCryptoKeyUsage usage) const {
109 return ((private_->usages & usage) != 0); 109 return ((private_->usages & usage) != 0);
110 } 110 }
111 111
112 void WebCryptoKey::Assign(const WebCryptoKey& other) { 112 void WebCryptoKey::Assign(const WebCryptoKey& other) {
113 private_ = other.private_; 113 private_ = other.private_;
114 } 114 }
115 115
116 void WebCryptoKey::Reset() { 116 void WebCryptoKey::Reset() {
117 private_.Reset(); 117 private_.Reset();
118 } 118 }
119 119
120 } // namespace blink 120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698