| OLD | NEW |
| 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 "content/child/webcrypto/webcrypto_impl.h" | 5 #include "content/child/webcrypto/webcrypto_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Ownership of the State object is passed between the crypto thread and the | 164 // Ownership of the State object is passed between the crypto thread and the |
| 165 // Blink thread. Under normal completion it is destroyed on the Blink thread. | 165 // Blink thread. Under normal completion it is destroyed on the Blink thread. |
| 166 // However it may also be destroyed on the crypto thread if the Blink thread | 166 // However it may also be destroyed on the crypto thread if the Blink thread |
| 167 // has vanished (which can happen for Blink web worker threads). | 167 // has vanished (which can happen for Blink web worker threads). |
| 168 | 168 |
| 169 struct BaseState { | 169 struct BaseState { |
| 170 explicit BaseState(const blink::WebCryptoResult& result) | 170 explicit BaseState(const blink::WebCryptoResult& result) |
| 171 : origin_thread(GetCurrentBlinkThread()), result(result) {} | 171 : origin_thread(GetCurrentBlinkThread()), result(result) {} |
| 172 | 172 |
| 173 bool cancelled() { | 173 bool cancelled() { |
| 174 #ifdef WEBCRYPTO_RESULT_HAS_CANCELLED | |
| 175 return result.cancelled(); | 174 return result.cancelled(); |
| 176 #else | |
| 177 return false; | |
| 178 #endif | |
| 179 } | 175 } |
| 180 | 176 |
| 181 scoped_refptr<base::TaskRunner> origin_thread; | 177 scoped_refptr<base::TaskRunner> origin_thread; |
| 182 | 178 |
| 183 webcrypto::Status status; | 179 webcrypto::Status status; |
| 184 blink::WebCryptoResult result; | 180 blink::WebCryptoResult result; |
| 185 | 181 |
| 186 protected: | 182 protected: |
| 187 // Since there is no virtual destructor, must not delete directly as a | 183 // Since there is no virtual destructor, must not delete directly as a |
| 188 // BaseState. | 184 // BaseState. |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 &key); | 766 &key); |
| 771 } | 767 } |
| 772 | 768 |
| 773 bool WebCryptoImpl::serializeKeyForClone( | 769 bool WebCryptoImpl::serializeKeyForClone( |
| 774 const blink::WebCryptoKey& key, | 770 const blink::WebCryptoKey& key, |
| 775 blink::WebVector<unsigned char>& key_data) { | 771 blink::WebVector<unsigned char>& key_data) { |
| 776 return webcrypto::SerializeKeyForClone(key, &key_data); | 772 return webcrypto::SerializeKeyForClone(key, &key_data); |
| 777 } | 773 } |
| 778 | 774 |
| 779 } // namespace content | 775 } // namespace content |
| OLD | NEW |