Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 // version exists because it is currently implemented in chromium. The 2nd | 63 // version exists because it is currently implemented in chromium. The 2nd |
| 64 // version will become the one and only RequestIdentity as soon as chromium | 64 // version will become the one and only RequestIdentity as soon as chromium |
| 65 // implements the correct version. crbug.com/544902, webrtc:5092. | 65 // implements the correct version. crbug.com/544902, webrtc:5092. |
| 66 virtual void RequestIdentity( | 66 virtual void RequestIdentity( |
| 67 rtc::KeyParams key_params, | 67 rtc::KeyParams key_params, |
| 68 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { | 68 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { |
| 69 // Add default ("null") expiration. | 69 // Add default ("null") expiration. |
| 70 RequestIdentity(key_params, rtc::Optional<uint64_t>(), observer); | 70 RequestIdentity(key_params, rtc::Optional<uint64_t>(), observer); |
| 71 } | 71 } |
| 72 virtual void RequestIdentity( | 72 virtual void RequestIdentity( |
| 73 rtc::KeyParams key_params, | 73 rtc::KeyParams key_params, |
|
tommi
2016/03/04 15:15:35
I think we should also pass KeyParams by const ref
hbos
2016/03/07 11:39:30
Done.
| |
| 74 rtc::Optional<uint64_t> expires, | 74 const rtc::Optional<uint64_t>& expires_ms, |
| 75 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { | 75 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) { |
| 76 // Drop |expires|. | 76 // Drop |expires|. |
| 77 RequestIdentity(key_params, observer); | 77 RequestIdentity(key_params, observer); |
| 78 } | 78 } |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // The WebRTC default implementation of DtlsIdentityStoreInterface. | 81 // The WebRTC default implementation of DtlsIdentityStoreInterface. |
| 82 // Identity generation is performed on the worker thread. | 82 // Identity generation is performed on the worker thread. |
| 83 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, | 83 class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface, |
| 84 public rtc::MessageHandler { | 84 public rtc::MessageHandler { |
| 85 public: | 85 public: |
| 86 // This will start to preemptively generating an RSA identity in the | 86 // This will start to preemptively generating an RSA identity in the |
| 87 // background if the worker thread is not the same as the signaling thread. | 87 // background if the worker thread is not the same as the signaling thread. |
| 88 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, | 88 DtlsIdentityStoreImpl(rtc::Thread* signaling_thread, |
| 89 rtc::Thread* worker_thread); | 89 rtc::Thread* worker_thread); |
| 90 ~DtlsIdentityStoreImpl() override; | 90 ~DtlsIdentityStoreImpl() override; |
| 91 | 91 |
| 92 // DtlsIdentityStoreInterface override; | 92 // DtlsIdentityStoreInterface override; |
| 93 void RequestIdentity( | 93 void RequestIdentity( |
| 94 rtc::KeyParams key_params, | 94 rtc::KeyParams key_params, |
| 95 rtc::Optional<uint64_t> expires, | 95 const rtc::Optional<uint64_t>& expires_ms, |
| 96 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) override; | 96 const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) override; |
| 97 | 97 |
| 98 // rtc::MessageHandler override; | 98 // rtc::MessageHandler override; |
| 99 void OnMessage(rtc::Message* msg) override; | 99 void OnMessage(rtc::Message* msg) override; |
| 100 | 100 |
| 101 // Returns true if there is a free RSA identity, used for unit tests. | 101 // Returns true if there is a free RSA identity, used for unit tests. |
| 102 bool HasFreeIdentityForTesting(rtc::KeyType key_type) const; | 102 bool HasFreeIdentityForTesting(rtc::KeyType key_type) const; |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 void GenerateIdentity( | 105 void GenerateIdentity( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; | 142 rtc::scoped_ptr<rtc::SSLIdentity> free_identity_; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. | 145 // One RequestInfo per KeyType. Only touch on the |signaling_thread_|. |
| 146 RequestInfo request_info_[rtc::KT_LAST]; | 146 RequestInfo request_info_[rtc::KT_LAST]; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace webrtc | 149 } // namespace webrtc |
| 150 | 150 |
| 151 #endif // WEBRTC_API_DTLSIDENTITYSTORE_H_ | 151 #endif // WEBRTC_API_DTLSIDENTITYSTORE_H_ |
| OLD | NEW |