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 "chrome/browser/net/sqlite_origin_bound_cert_store.h" | 5 #include "chrome/browser/net/sqlite_origin_bound_cert_store.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 { | 351 { |
352 base::AutoLock locked(lock_); | 352 base::AutoLock locked(lock_); |
353 pending_.push_back(po.release()); | 353 pending_.push_back(po.release()); |
354 num_pending = ++num_pending_; | 354 num_pending = ++num_pending_; |
355 } | 355 } |
356 | 356 |
357 if (num_pending == 1) { | 357 if (num_pending == 1) { |
358 // We've gotten our first entry for this batch, fire off the timer. | 358 // We've gotten our first entry for this batch, fire off the timer. |
359 BrowserThread::PostDelayedTask( | 359 BrowserThread::PostDelayedTask( |
360 BrowserThread::DB, FROM_HERE, | 360 BrowserThread::DB, FROM_HERE, |
361 base::Bind(&Backend::Commit, this), kCommitIntervalMs); | 361 base::Bind(&Backend::Commit, this), |
| 362 base::TimeDelta::FromMilliseconds(kCommitIntervalMs)); |
362 } else if (num_pending == kCommitAfterBatchSize) { | 363 } else if (num_pending == kCommitAfterBatchSize) { |
363 // We've reached a big enough batch, fire off a commit now. | 364 // We've reached a big enough batch, fire off a commit now. |
364 BrowserThread::PostTask( | 365 BrowserThread::PostTask( |
365 BrowserThread::DB, FROM_HERE, | 366 BrowserThread::DB, FROM_HERE, |
366 base::Bind(&Backend::Commit, this)); | 367 base::Bind(&Backend::Commit, this)); |
367 } | 368 } |
368 } | 369 } |
369 | 370 |
370 void SQLiteOriginBoundCertStore::Backend::Commit() { | 371 void SQLiteOriginBoundCertStore::Backend::Commit() { |
371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 372 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 if (backend_.get()) | 507 if (backend_.get()) |
507 backend_->SetClearLocalStateOnExit(clear_local_state); | 508 backend_->SetClearLocalStateOnExit(clear_local_state); |
508 } | 509 } |
509 | 510 |
510 void SQLiteOriginBoundCertStore::Flush(const base::Closure& completion_task) { | 511 void SQLiteOriginBoundCertStore::Flush(const base::Closure& completion_task) { |
511 if (backend_.get()) | 512 if (backend_.get()) |
512 backend_->Flush(completion_task); | 513 backend_->Flush(completion_task); |
513 else if (!completion_task.is_null()) | 514 else if (!completion_task.is_null()) |
514 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 515 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
515 } | 516 } |
OLD | NEW |