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 "net/quic/chromium/crypto/channel_id_chromium.h" | 5 #include "net/quic/chromium/crypto/channel_id_chromium.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "crypto/ec_private_key.h" | 12 #include "crypto/ec_private_key.h" |
13 #include "crypto/ec_signature_creator.h" | 13 #include "crypto/ec_signature_creator.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/cert/asn1_util.h" | 15 #include "net/cert/asn1_util.h" |
16 #include "net/ssl/channel_id_service.h" | 16 #include "net/ssl/channel_id_service.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 ChannelIDKeyChromium::ChannelIDKeyChromium( | 20 ChannelIDKeyChromium::ChannelIDKeyChromium( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 channel_id_key_.reset( | 193 channel_id_key_.reset( |
194 new ChannelIDKeyChromium(std::move(channel_id_crypto_key_))); | 194 new ChannelIDKeyChromium(std::move(channel_id_crypto_key_))); |
195 return result; | 195 return result; |
196 } | 196 } |
197 | 197 |
198 ChannelIDSourceChromium::ChannelIDSourceChromium( | 198 ChannelIDSourceChromium::ChannelIDSourceChromium( |
199 ChannelIDService* channel_id_service) | 199 ChannelIDService* channel_id_service) |
200 : channel_id_service_(channel_id_service) {} | 200 : channel_id_service_(channel_id_service) {} |
201 | 201 |
202 ChannelIDSourceChromium::~ChannelIDSourceChromium() { | 202 ChannelIDSourceChromium::~ChannelIDSourceChromium() { |
203 base::STLDeleteElements(&active_jobs_); | |
204 } | 203 } |
205 | 204 |
206 QuicAsyncStatus ChannelIDSourceChromium::GetChannelIDKey( | 205 QuicAsyncStatus ChannelIDSourceChromium::GetChannelIDKey( |
207 const std::string& hostname, | 206 const std::string& hostname, |
208 std::unique_ptr<ChannelIDKey>* channel_id_key, | 207 std::unique_ptr<ChannelIDKey>* channel_id_key, |
209 ChannelIDSourceCallback* callback) { | 208 ChannelIDSourceCallback* callback) { |
210 std::unique_ptr<Job> job(new Job(this, channel_id_service_)); | 209 std::unique_ptr<Job> job = base::MakeUnique<Job>(this, channel_id_service_); |
211 QuicAsyncStatus status = | 210 QuicAsyncStatus status = |
212 job->GetChannelIDKey(hostname, channel_id_key, callback); | 211 job->GetChannelIDKey(hostname, channel_id_key, callback); |
213 if (status == QUIC_PENDING) { | 212 if (status == QUIC_PENDING) { |
214 active_jobs_.insert(job.release()); | 213 Job* job_ptr = job.get(); |
| 214 active_jobs_[job_ptr] = std::move(job); |
215 } | 215 } |
216 return status; | 216 return status; |
217 } | 217 } |
218 | 218 |
219 void ChannelIDSourceChromium::OnJobComplete(Job* job) { | 219 void ChannelIDSourceChromium::OnJobComplete(Job* job) { |
220 active_jobs_.erase(job); | 220 active_jobs_.erase(job); |
221 delete job; | |
222 } | 221 } |
223 | 222 |
224 } // namespace net | 223 } // namespace net |
OLD | NEW |