OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 |
11 #include "webrtc/rtc_base/rtccertificategenerator.h" | 11 #include "webrtc/rtc_base/rtccertificategenerator.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/rtc_base/checks.h" | 16 #include "webrtc/rtc_base/checks.h" |
17 #include "webrtc/rtc_base/sslidentity.h" | 17 #include "webrtc/rtc_base/sslidentity.h" |
18 | 18 |
19 namespace rtc { | 19 namespace rtc { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // A certificates' subject and issuer name. | 23 // A certificates' subject and issuer name. |
24 const char kIdentityName[] = "WebRTC"; | 24 const char kIdentityName[] = "WebRTC"; |
25 | 25 |
26 uint64_t kYearInSeconds = 365 * 24 * 60 * 60; | 26 const uint64_t kYearInSeconds = 365 * 24 * 60 * 60; |
27 | 27 |
28 enum { | 28 enum { |
29 MSG_GENERATE, | 29 MSG_GENERATE, |
30 MSG_GENERATE_DONE, | 30 MSG_GENERATE_DONE, |
31 }; | 31 }; |
32 | 32 |
33 // Helper class for generating certificates asynchronously; a single task | 33 // Helper class for generating certificates asynchronously; a single task |
34 // instance is responsible for a single asynchronous certificate generation | 34 // instance is responsible for a single asynchronous certificate generation |
35 // request. We are using a separate helper class so that a generation request | 35 // request. We are using a separate helper class so that a generation request |
36 // can outlive the |RTCCertificateGenerator| that spawned it. | 36 // can outlive the |RTCCertificateGenerator| that spawned it. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data = | 151 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data = |
152 new ScopedRefMessageData<RTCCertificateGenerationTask>( | 152 new ScopedRefMessageData<RTCCertificateGenerationTask>( |
153 new RefCountedObject<RTCCertificateGenerationTask>( | 153 new RefCountedObject<RTCCertificateGenerationTask>( |
154 signaling_thread_, worker_thread_, key_params, expires_ms, | 154 signaling_thread_, worker_thread_, key_params, expires_ms, |
155 callback)); | 155 callback)); |
156 worker_thread_->Post(RTC_FROM_HERE, msg_data->data().get(), MSG_GENERATE, | 156 worker_thread_->Post(RTC_FROM_HERE, msg_data->data().get(), MSG_GENERATE, |
157 msg_data); | 157 msg_data); |
158 } | 158 } |
159 | 159 |
160 } // namespace rtc | 160 } // namespace rtc |
OLD | NEW |