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 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 switch (msg->message_id) { | 59 switch (msg->message_id) { |
60 case MSG_GENERATE: | 60 case MSG_GENERATE: |
61 RTC_DCHECK(worker_thread_->IsCurrent()); | 61 RTC_DCHECK(worker_thread_->IsCurrent()); |
62 | 62 |
63 // Perform the certificate generation work here on the worker thread. | 63 // Perform the certificate generation work here on the worker thread. |
64 certificate_ = RTCCertificateGenerator::GenerateCertificate( | 64 certificate_ = RTCCertificateGenerator::GenerateCertificate( |
65 key_params_, expires_ms_); | 65 key_params_, expires_ms_); |
66 | 66 |
67 // Handle callbacks on signaling thread. Pass on the |msg->pdata| | 67 // Handle callbacks on signaling thread. Pass on the |msg->pdata| |
68 // (which references |this| with ref counting) to that thread. | 68 // (which references |this| with ref counting) to that thread. |
69 signaling_thread_->Post(this, MSG_GENERATE_DONE, msg->pdata); | 69 signaling_thread_->Post(RTC_FROM_HERE, this, MSG_GENERATE_DONE, |
| 70 msg->pdata); |
70 break; | 71 break; |
71 case MSG_GENERATE_DONE: | 72 case MSG_GENERATE_DONE: |
72 RTC_DCHECK(signaling_thread_->IsCurrent()); | 73 RTC_DCHECK(signaling_thread_->IsCurrent()); |
73 | 74 |
74 // Perform callback with result here on the signaling thread. | 75 // Perform callback with result here on the signaling thread. |
75 if (certificate_) { | 76 if (certificate_) { |
76 callback_->OnSuccess(certificate_); | 77 callback_->OnSuccess(certificate_); |
77 } else { | 78 } else { |
78 callback_->OnFailure(); | 79 callback_->OnFailure(); |
79 } | 80 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 RTC_DCHECK(callback); | 146 RTC_DCHECK(callback); |
146 | 147 |
147 // Create a new |RTCCertificateGenerationTask| for this generation request. It | 148 // Create a new |RTCCertificateGenerationTask| for this generation request. It |
148 // is reference counted and referenced by the message data, ensuring it lives | 149 // is reference counted and referenced by the message data, ensuring it lives |
149 // until the task has completed (independent of |RTCCertificateGenerator|). | 150 // until the task has completed (independent of |RTCCertificateGenerator|). |
150 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data = | 151 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data = |
151 new ScopedRefMessageData<RTCCertificateGenerationTask>( | 152 new ScopedRefMessageData<RTCCertificateGenerationTask>( |
152 new RefCountedObject<RTCCertificateGenerationTask>( | 153 new RefCountedObject<RTCCertificateGenerationTask>( |
153 signaling_thread_, worker_thread_, key_params, expires_ms, | 154 signaling_thread_, worker_thread_, key_params, expires_ms, |
154 callback)); | 155 callback)); |
155 worker_thread_->Post(msg_data->data().get(), MSG_GENERATE, msg_data); | 156 worker_thread_->Post(RTC_FROM_HERE, msg_data->data().get(), MSG_GENERATE, |
| 157 msg_data); |
156 } | 158 } |
157 | 159 |
158 } // namespace rtc | 160 } // namespace rtc |
OLD | NEW |