OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl/default_server_bound_cert_store.h" | 5 #include "net/ssl/default_server_bound_cert_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; | 45 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; |
46 | 46 |
47 private: | 47 private: |
48 std::string server_identifier_; | 48 std::string server_identifier_; |
49 GetCertCallback callback_; | 49 GetCertCallback callback_; |
50 }; | 50 }; |
51 | 51 |
52 DefaultServerBoundCertStore::GetServerBoundCertTask::GetServerBoundCertTask( | 52 DefaultServerBoundCertStore::GetServerBoundCertTask::GetServerBoundCertTask( |
53 const std::string& server_identifier, | 53 const std::string& server_identifier, |
54 const GetCertCallback& callback) | 54 const GetCertCallback& callback) |
55 : server_identifier_(server_identifier), | 55 : server_identifier_(server_identifier), callback_(callback) { |
56 callback_(callback) { | |
57 } | 56 } |
58 | 57 |
59 DefaultServerBoundCertStore::GetServerBoundCertTask::~GetServerBoundCertTask() { | 58 DefaultServerBoundCertStore::GetServerBoundCertTask::~GetServerBoundCertTask() { |
60 } | 59 } |
61 | 60 |
62 void DefaultServerBoundCertStore::GetServerBoundCertTask::Run( | 61 void DefaultServerBoundCertStore::GetServerBoundCertTask::Run( |
63 DefaultServerBoundCertStore* store) { | 62 DefaultServerBoundCertStore* store) { |
64 base::Time expiration_time; | 63 base::Time expiration_time; |
65 std::string private_key_result; | 64 std::string private_key_result; |
66 std::string cert_result; | 65 std::string cert_result; |
67 int err = store->GetServerBoundCert( | 66 int err = store->GetServerBoundCert(server_identifier_, |
68 server_identifier_, &expiration_time, &private_key_result, | 67 &expiration_time, |
69 &cert_result, GetCertCallback()); | 68 &private_key_result, |
| 69 &cert_result, |
| 70 GetCertCallback()); |
70 DCHECK(err != ERR_IO_PENDING); | 71 DCHECK(err != ERR_IO_PENDING); |
71 | 72 |
72 InvokeCallback(base::Bind(callback_, err, server_identifier_, | 73 InvokeCallback(base::Bind(callback_, |
73 expiration_time, private_key_result, cert_result)); | 74 err, |
| 75 server_identifier_, |
| 76 expiration_time, |
| 77 private_key_result, |
| 78 cert_result)); |
74 } | 79 } |
75 | 80 |
76 // -------------------------------------------------------------------------- | 81 // -------------------------------------------------------------------------- |
77 // SetServerBoundCertTask | 82 // SetServerBoundCertTask |
78 class DefaultServerBoundCertStore::SetServerBoundCertTask | 83 class DefaultServerBoundCertStore::SetServerBoundCertTask |
79 : public DefaultServerBoundCertStore::Task { | 84 : public DefaultServerBoundCertStore::Task { |
80 public: | 85 public: |
81 SetServerBoundCertTask(const std::string& server_identifier, | 86 SetServerBoundCertTask(const std::string& server_identifier, |
82 base::Time creation_time, | 87 base::Time creation_time, |
83 base::Time expiration_time, | 88 base::Time expiration_time, |
(...skipping 21 matching lines...) Expand all Loading... |
105 expiration_time_(expiration_time), | 110 expiration_time_(expiration_time), |
106 private_key_(private_key), | 111 private_key_(private_key), |
107 cert_(cert) { | 112 cert_(cert) { |
108 } | 113 } |
109 | 114 |
110 DefaultServerBoundCertStore::SetServerBoundCertTask::~SetServerBoundCertTask() { | 115 DefaultServerBoundCertStore::SetServerBoundCertTask::~SetServerBoundCertTask() { |
111 } | 116 } |
112 | 117 |
113 void DefaultServerBoundCertStore::SetServerBoundCertTask::Run( | 118 void DefaultServerBoundCertStore::SetServerBoundCertTask::Run( |
114 DefaultServerBoundCertStore* store) { | 119 DefaultServerBoundCertStore* store) { |
115 store->SyncSetServerBoundCert(server_identifier_, creation_time_, | 120 store->SyncSetServerBoundCert(server_identifier_, |
116 expiration_time_, private_key_, cert_); | 121 creation_time_, |
| 122 expiration_time_, |
| 123 private_key_, |
| 124 cert_); |
117 } | 125 } |
118 | 126 |
119 // -------------------------------------------------------------------------- | 127 // -------------------------------------------------------------------------- |
120 // DeleteServerBoundCertTask | 128 // DeleteServerBoundCertTask |
121 class DefaultServerBoundCertStore::DeleteServerBoundCertTask | 129 class DefaultServerBoundCertStore::DeleteServerBoundCertTask |
122 : public DefaultServerBoundCertStore::Task { | 130 : public DefaultServerBoundCertStore::Task { |
123 public: | 131 public: |
124 DeleteServerBoundCertTask(const std::string& server_identifier, | 132 DeleteServerBoundCertTask(const std::string& server_identifier, |
125 const base::Closure& callback); | 133 const base::Closure& callback); |
126 virtual ~DeleteServerBoundCertTask(); | 134 virtual ~DeleteServerBoundCertTask(); |
127 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; | 135 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; |
128 | 136 |
129 private: | 137 private: |
130 std::string server_identifier_; | 138 std::string server_identifier_; |
131 base::Closure callback_; | 139 base::Closure callback_; |
132 }; | 140 }; |
133 | 141 |
134 DefaultServerBoundCertStore::DeleteServerBoundCertTask:: | 142 DefaultServerBoundCertStore::DeleteServerBoundCertTask:: |
135 DeleteServerBoundCertTask( | 143 DeleteServerBoundCertTask(const std::string& server_identifier, |
136 const std::string& server_identifier, | 144 const base::Closure& callback) |
137 const base::Closure& callback) | 145 : server_identifier_(server_identifier), callback_(callback) { |
138 : server_identifier_(server_identifier), | |
139 callback_(callback) { | |
140 } | 146 } |
141 | 147 |
142 DefaultServerBoundCertStore::DeleteServerBoundCertTask:: | 148 DefaultServerBoundCertStore::DeleteServerBoundCertTask:: |
143 ~DeleteServerBoundCertTask() { | 149 ~DeleteServerBoundCertTask() { |
144 } | 150 } |
145 | 151 |
146 void DefaultServerBoundCertStore::DeleteServerBoundCertTask::Run( | 152 void DefaultServerBoundCertStore::DeleteServerBoundCertTask::Run( |
147 DefaultServerBoundCertStore* store) { | 153 DefaultServerBoundCertStore* store) { |
148 store->SyncDeleteServerBoundCert(server_identifier_); | 154 store->SyncDeleteServerBoundCert(server_identifier_); |
149 | 155 |
(...skipping 11 matching lines...) Expand all Loading... |
161 virtual ~DeleteAllCreatedBetweenTask(); | 167 virtual ~DeleteAllCreatedBetweenTask(); |
162 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; | 168 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; |
163 | 169 |
164 private: | 170 private: |
165 base::Time delete_begin_; | 171 base::Time delete_begin_; |
166 base::Time delete_end_; | 172 base::Time delete_end_; |
167 base::Closure callback_; | 173 base::Closure callback_; |
168 }; | 174 }; |
169 | 175 |
170 DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask:: | 176 DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask:: |
171 DeleteAllCreatedBetweenTask( | 177 DeleteAllCreatedBetweenTask(base::Time delete_begin, |
172 base::Time delete_begin, | 178 base::Time delete_end, |
173 base::Time delete_end, | 179 const base::Closure& callback) |
174 const base::Closure& callback) | 180 : delete_begin_(delete_begin), |
175 : delete_begin_(delete_begin), | 181 delete_end_(delete_end), |
176 delete_end_(delete_end), | 182 callback_(callback) { |
177 callback_(callback) { | |
178 } | 183 } |
179 | 184 |
180 DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask:: | 185 DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask:: |
181 ~DeleteAllCreatedBetweenTask() { | 186 ~DeleteAllCreatedBetweenTask() { |
182 } | 187 } |
183 | 188 |
184 void DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::Run( | 189 void DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::Run( |
185 DefaultServerBoundCertStore* store) { | 190 DefaultServerBoundCertStore* store) { |
186 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); | 191 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); |
187 | 192 |
188 InvokeCallback(callback_); | 193 InvokeCallback(callback_); |
189 } | 194 } |
190 | 195 |
191 // -------------------------------------------------------------------------- | 196 // -------------------------------------------------------------------------- |
192 // GetAllServerBoundCertsTask | 197 // GetAllServerBoundCertsTask |
193 class DefaultServerBoundCertStore::GetAllServerBoundCertsTask | 198 class DefaultServerBoundCertStore::GetAllServerBoundCertsTask |
194 : public DefaultServerBoundCertStore::Task { | 199 : public DefaultServerBoundCertStore::Task { |
195 public: | 200 public: |
196 explicit GetAllServerBoundCertsTask(const GetCertListCallback& callback); | 201 explicit GetAllServerBoundCertsTask(const GetCertListCallback& callback); |
197 virtual ~GetAllServerBoundCertsTask(); | 202 virtual ~GetAllServerBoundCertsTask(); |
198 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; | 203 virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE; |
199 | 204 |
200 private: | 205 private: |
201 std::string server_identifier_; | 206 std::string server_identifier_; |
202 GetCertListCallback callback_; | 207 GetCertListCallback callback_; |
203 }; | 208 }; |
204 | 209 |
205 DefaultServerBoundCertStore::GetAllServerBoundCertsTask:: | 210 DefaultServerBoundCertStore::GetAllServerBoundCertsTask:: |
206 GetAllServerBoundCertsTask(const GetCertListCallback& callback) | 211 GetAllServerBoundCertsTask(const GetCertListCallback& callback) |
207 : callback_(callback) { | 212 : callback_(callback) { |
208 } | 213 } |
209 | 214 |
210 DefaultServerBoundCertStore::GetAllServerBoundCertsTask:: | 215 DefaultServerBoundCertStore::GetAllServerBoundCertsTask:: |
211 ~GetAllServerBoundCertsTask() { | 216 ~GetAllServerBoundCertsTask() { |
212 } | 217 } |
213 | 218 |
214 void DefaultServerBoundCertStore::GetAllServerBoundCertsTask::Run( | 219 void DefaultServerBoundCertStore::GetAllServerBoundCertsTask::Run( |
215 DefaultServerBoundCertStore* store) { | 220 DefaultServerBoundCertStore* store) { |
216 ServerBoundCertList cert_list; | 221 ServerBoundCertList cert_list; |
217 store->SyncGetAllServerBoundCerts(&cert_list); | 222 store->SyncGetAllServerBoundCerts(&cert_list); |
218 | 223 |
219 InvokeCallback(base::Bind(callback_, cert_list)); | 224 InvokeCallback(base::Bind(callback_, cert_list)); |
220 } | 225 } |
221 | 226 |
222 // -------------------------------------------------------------------------- | 227 // -------------------------------------------------------------------------- |
223 // DefaultServerBoundCertStore | 228 // DefaultServerBoundCertStore |
224 | 229 |
225 // static | 230 // static |
226 const size_t DefaultServerBoundCertStore::kMaxCerts = 3300; | 231 const size_t DefaultServerBoundCertStore::kMaxCerts = 3300; |
227 | 232 |
228 DefaultServerBoundCertStore::DefaultServerBoundCertStore( | 233 DefaultServerBoundCertStore::DefaultServerBoundCertStore(PersistentStore* store) |
229 PersistentStore* store) | |
230 : initialized_(false), | 234 : initialized_(false), |
231 loaded_(false), | 235 loaded_(false), |
232 store_(store), | 236 store_(store), |
233 weak_ptr_factory_(this) {} | 237 weak_ptr_factory_(this) { |
| 238 } |
234 | 239 |
235 int DefaultServerBoundCertStore::GetServerBoundCert( | 240 int DefaultServerBoundCertStore::GetServerBoundCert( |
236 const std::string& server_identifier, | 241 const std::string& server_identifier, |
237 base::Time* expiration_time, | 242 base::Time* expiration_time, |
238 std::string* private_key_result, | 243 std::string* private_key_result, |
239 std::string* cert_result, | 244 std::string* cert_result, |
240 const GetCertCallback& callback) { | 245 const GetCertCallback& callback) { |
241 DCHECK(CalledOnValidThread()); | 246 DCHECK(CalledOnValidThread()); |
242 InitIfNecessary(); | 247 InitIfNecessary(); |
243 | 248 |
(...skipping 16 matching lines...) Expand all Loading... |
260 return OK; | 265 return OK; |
261 } | 266 } |
262 | 267 |
263 void DefaultServerBoundCertStore::SetServerBoundCert( | 268 void DefaultServerBoundCertStore::SetServerBoundCert( |
264 const std::string& server_identifier, | 269 const std::string& server_identifier, |
265 base::Time creation_time, | 270 base::Time creation_time, |
266 base::Time expiration_time, | 271 base::Time expiration_time, |
267 const std::string& private_key, | 272 const std::string& private_key, |
268 const std::string& cert) { | 273 const std::string& cert) { |
269 RunOrEnqueueTask(scoped_ptr<Task>(new SetServerBoundCertTask( | 274 RunOrEnqueueTask(scoped_ptr<Task>(new SetServerBoundCertTask( |
270 server_identifier, creation_time, expiration_time, private_key, | 275 server_identifier, creation_time, expiration_time, private_key, cert))); |
271 cert))); | |
272 } | 276 } |
273 | 277 |
274 void DefaultServerBoundCertStore::DeleteServerBoundCert( | 278 void DefaultServerBoundCertStore::DeleteServerBoundCert( |
275 const std::string& server_identifier, | 279 const std::string& server_identifier, |
276 const base::Closure& callback) { | 280 const base::Closure& callback) { |
277 RunOrEnqueueTask(scoped_ptr<Task>( | 281 RunOrEnqueueTask(scoped_ptr<Task>( |
278 new DeleteServerBoundCertTask(server_identifier, callback))); | 282 new DeleteServerBoundCertTask(server_identifier, callback))); |
279 } | 283 } |
280 | 284 |
281 void DefaultServerBoundCertStore::DeleteAllCreatedBetween( | 285 void DefaultServerBoundCertStore::DeleteAllCreatedBetween( |
282 base::Time delete_begin, | 286 base::Time delete_begin, |
283 base::Time delete_end, | 287 base::Time delete_end, |
284 const base::Closure& callback) { | 288 const base::Closure& callback) { |
285 RunOrEnqueueTask(scoped_ptr<Task>( | 289 RunOrEnqueueTask(scoped_ptr<Task>( |
286 new DeleteAllCreatedBetweenTask(delete_begin, delete_end, callback))); | 290 new DeleteAllCreatedBetweenTask(delete_begin, delete_end, callback))); |
287 } | 291 } |
288 | 292 |
289 void DefaultServerBoundCertStore::DeleteAll( | 293 void DefaultServerBoundCertStore::DeleteAll(const base::Closure& callback) { |
290 const base::Closure& callback) { | |
291 DeleteAllCreatedBetween(base::Time(), base::Time(), callback); | 294 DeleteAllCreatedBetween(base::Time(), base::Time(), callback); |
292 } | 295 } |
293 | 296 |
294 void DefaultServerBoundCertStore::GetAllServerBoundCerts( | 297 void DefaultServerBoundCertStore::GetAllServerBoundCerts( |
295 const GetCertListCallback& callback) { | 298 const GetCertListCallback& callback) { |
296 RunOrEnqueueTask(scoped_ptr<Task>(new GetAllServerBoundCertsTask(callback))); | 299 RunOrEnqueueTask(scoped_ptr<Task>(new GetAllServerBoundCertsTask(callback))); |
297 } | 300 } |
298 | 301 |
299 int DefaultServerBoundCertStore::GetCertCount() { | 302 int DefaultServerBoundCertStore::GetCertCount() { |
300 DCHECK(CalledOnValidThread()); | 303 DCHECK(CalledOnValidThread()); |
(...skipping 10 matching lines...) Expand all Loading... |
311 } | 314 } |
312 | 315 |
313 DefaultServerBoundCertStore::~DefaultServerBoundCertStore() { | 316 DefaultServerBoundCertStore::~DefaultServerBoundCertStore() { |
314 DeleteAllInMemory(); | 317 DeleteAllInMemory(); |
315 } | 318 } |
316 | 319 |
317 void DefaultServerBoundCertStore::DeleteAllInMemory() { | 320 void DefaultServerBoundCertStore::DeleteAllInMemory() { |
318 DCHECK(CalledOnValidThread()); | 321 DCHECK(CalledOnValidThread()); |
319 | 322 |
320 for (ServerBoundCertMap::iterator it = server_bound_certs_.begin(); | 323 for (ServerBoundCertMap::iterator it = server_bound_certs_.begin(); |
321 it != server_bound_certs_.end(); ++it) { | 324 it != server_bound_certs_.end(); |
| 325 ++it) { |
322 delete it->second; | 326 delete it->second; |
323 } | 327 } |
324 server_bound_certs_.clear(); | 328 server_bound_certs_.clear(); |
325 } | 329 } |
326 | 330 |
327 void DefaultServerBoundCertStore::InitStore() { | 331 void DefaultServerBoundCertStore::InitStore() { |
328 DCHECK(CalledOnValidThread()); | 332 DCHECK(CalledOnValidThread()); |
329 DCHECK(store_.get()) << "Store must exist to initialize"; | 333 DCHECK(store_.get()) << "Store must exist to initialize"; |
330 DCHECK(!loaded_); | 334 DCHECK(!loaded_); |
331 | 335 |
332 store_->Load(base::Bind(&DefaultServerBoundCertStore::OnLoaded, | 336 store_->Load(base::Bind(&DefaultServerBoundCertStore::OnLoaded, |
333 weak_ptr_factory_.GetWeakPtr())); | 337 weak_ptr_factory_.GetWeakPtr())); |
334 } | 338 } |
335 | 339 |
336 void DefaultServerBoundCertStore::OnLoaded( | 340 void DefaultServerBoundCertStore::OnLoaded( |
337 scoped_ptr<ScopedVector<ServerBoundCert> > certs) { | 341 scoped_ptr<ScopedVector<ServerBoundCert> > certs) { |
338 DCHECK(CalledOnValidThread()); | 342 DCHECK(CalledOnValidThread()); |
339 | 343 |
340 for (std::vector<ServerBoundCert*>::const_iterator it = certs->begin(); | 344 for (std::vector<ServerBoundCert*>::const_iterator it = certs->begin(); |
341 it != certs->end(); ++it) { | 345 it != certs->end(); |
| 346 ++it) { |
342 DCHECK(server_bound_certs_.find((*it)->server_identifier()) == | 347 DCHECK(server_bound_certs_.find((*it)->server_identifier()) == |
343 server_bound_certs_.end()); | 348 server_bound_certs_.end()); |
344 server_bound_certs_[(*it)->server_identifier()] = *it; | 349 server_bound_certs_[(*it)->server_identifier()] = *it; |
345 } | 350 } |
346 certs->weak_clear(); | 351 certs->weak_clear(); |
347 | 352 |
348 loaded_ = true; | 353 loaded_ = true; |
349 | 354 |
350 base::TimeDelta wait_time; | 355 base::TimeDelta wait_time; |
351 if (!waiting_tasks_.empty()) | 356 if (!waiting_tasks_.empty()) |
352 wait_time = base::TimeTicks::Now() - waiting_tasks_start_time_; | 357 wait_time = base::TimeTicks::Now() - waiting_tasks_start_time_; |
353 DVLOG(1) << "Task delay " << wait_time.InMilliseconds(); | 358 DVLOG(1) << "Task delay " << wait_time.InMilliseconds(); |
354 UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.TaskMaxWaitTime", | 359 UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.TaskMaxWaitTime", |
355 wait_time, | 360 wait_time, |
356 base::TimeDelta::FromMilliseconds(1), | 361 base::TimeDelta::FromMilliseconds(1), |
357 base::TimeDelta::FromMinutes(1), | 362 base::TimeDelta::FromMinutes(1), |
358 50); | 363 50); |
359 UMA_HISTOGRAM_COUNTS_100("DomainBoundCerts.TaskWaitCount", | 364 UMA_HISTOGRAM_COUNTS_100("DomainBoundCerts.TaskWaitCount", |
360 waiting_tasks_.size()); | 365 waiting_tasks_.size()); |
361 | 366 |
362 | |
363 for (ScopedVector<Task>::iterator i = waiting_tasks_.begin(); | 367 for (ScopedVector<Task>::iterator i = waiting_tasks_.begin(); |
364 i != waiting_tasks_.end(); ++i) | 368 i != waiting_tasks_.end(); |
| 369 ++i) |
365 (*i)->Run(this); | 370 (*i)->Run(this); |
366 waiting_tasks_.clear(); | 371 waiting_tasks_.clear(); |
367 } | 372 } |
368 | 373 |
369 void DefaultServerBoundCertStore::SyncSetServerBoundCert( | 374 void DefaultServerBoundCertStore::SyncSetServerBoundCert( |
370 const std::string& server_identifier, | 375 const std::string& server_identifier, |
371 base::Time creation_time, | 376 base::Time creation_time, |
372 base::Time expiration_time, | 377 base::Time expiration_time, |
373 const std::string& private_key, | 378 const std::string& private_key, |
374 const std::string& cert) { | 379 const std::string& cert) { |
375 DCHECK(CalledOnValidThread()); | 380 DCHECK(CalledOnValidThread()); |
376 DCHECK(loaded_); | 381 DCHECK(loaded_); |
377 | 382 |
378 InternalDeleteServerBoundCert(server_identifier); | 383 InternalDeleteServerBoundCert(server_identifier); |
379 InternalInsertServerBoundCert( | 384 InternalInsertServerBoundCert(server_identifier, |
380 server_identifier, | 385 new ServerBoundCert(server_identifier, |
381 new ServerBoundCert( | 386 creation_time, |
382 server_identifier, creation_time, expiration_time, private_key, | 387 expiration_time, |
383 cert)); | 388 private_key, |
| 389 cert)); |
384 } | 390 } |
385 | 391 |
386 void DefaultServerBoundCertStore::SyncDeleteServerBoundCert( | 392 void DefaultServerBoundCertStore::SyncDeleteServerBoundCert( |
387 const std::string& server_identifier) { | 393 const std::string& server_identifier) { |
388 DCHECK(CalledOnValidThread()); | 394 DCHECK(CalledOnValidThread()); |
389 DCHECK(loaded_); | 395 DCHECK(loaded_); |
390 InternalDeleteServerBoundCert(server_identifier); | 396 InternalDeleteServerBoundCert(server_identifier); |
391 } | 397 } |
392 | 398 |
393 void DefaultServerBoundCertStore::SyncDeleteAllCreatedBetween( | 399 void DefaultServerBoundCertStore::SyncDeleteAllCreatedBetween( |
(...skipping 14 matching lines...) Expand all Loading... |
408 server_bound_certs_.erase(cur); | 414 server_bound_certs_.erase(cur); |
409 } | 415 } |
410 } | 416 } |
411 } | 417 } |
412 | 418 |
413 void DefaultServerBoundCertStore::SyncGetAllServerBoundCerts( | 419 void DefaultServerBoundCertStore::SyncGetAllServerBoundCerts( |
414 ServerBoundCertList* cert_list) { | 420 ServerBoundCertList* cert_list) { |
415 DCHECK(CalledOnValidThread()); | 421 DCHECK(CalledOnValidThread()); |
416 DCHECK(loaded_); | 422 DCHECK(loaded_); |
417 for (ServerBoundCertMap::iterator it = server_bound_certs_.begin(); | 423 for (ServerBoundCertMap::iterator it = server_bound_certs_.begin(); |
418 it != server_bound_certs_.end(); ++it) | 424 it != server_bound_certs_.end(); |
| 425 ++it) |
419 cert_list->push_back(*it->second); | 426 cert_list->push_back(*it->second); |
420 } | 427 } |
421 | 428 |
422 void DefaultServerBoundCertStore::EnqueueTask(scoped_ptr<Task> task) { | 429 void DefaultServerBoundCertStore::EnqueueTask(scoped_ptr<Task> task) { |
423 DCHECK(CalledOnValidThread()); | 430 DCHECK(CalledOnValidThread()); |
424 DCHECK(!loaded_); | 431 DCHECK(!loaded_); |
425 if (waiting_tasks_.empty()) | 432 if (waiting_tasks_.empty()) |
426 waiting_tasks_start_time_ = base::TimeTicks::Now(); | 433 waiting_tasks_start_time_ = base::TimeTicks::Now(); |
427 waiting_tasks_.push_back(task.release()); | 434 waiting_tasks_.push_back(task.release()); |
428 } | 435 } |
(...skipping 30 matching lines...) Expand all Loading... |
459 const std::string& server_identifier, | 466 const std::string& server_identifier, |
460 ServerBoundCert* cert) { | 467 ServerBoundCert* cert) { |
461 DCHECK(CalledOnValidThread()); | 468 DCHECK(CalledOnValidThread()); |
462 DCHECK(loaded_); | 469 DCHECK(loaded_); |
463 | 470 |
464 if (store_.get()) | 471 if (store_.get()) |
465 store_->AddServerBoundCert(*cert); | 472 store_->AddServerBoundCert(*cert); |
466 server_bound_certs_[server_identifier] = cert; | 473 server_bound_certs_[server_identifier] = cert; |
467 } | 474 } |
468 | 475 |
469 DefaultServerBoundCertStore::PersistentStore::PersistentStore() {} | 476 DefaultServerBoundCertStore::PersistentStore::PersistentStore() { |
| 477 } |
470 | 478 |
471 DefaultServerBoundCertStore::PersistentStore::~PersistentStore() {} | 479 DefaultServerBoundCertStore::PersistentStore::~PersistentStore() { |
| 480 } |
472 | 481 |
473 } // namespace net | 482 } // namespace net |
OLD | NEW |