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_server_bound_cert_store.h" | 5 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 : backend_(new Backend(path, clear_on_exit_policy)) { | 544 : backend_(new Backend(path, clear_on_exit_policy)) { |
545 } | 545 } |
546 | 546 |
547 bool SQLiteServerBoundCertStore::Load( | 547 bool SQLiteServerBoundCertStore::Load( |
548 std::vector<net::DefaultServerBoundCertStore::ServerBoundCert*>* certs) { | 548 std::vector<net::DefaultServerBoundCertStore::ServerBoundCert*>* certs) { |
549 return backend_->Load(certs); | 549 return backend_->Load(certs); |
550 } | 550 } |
551 | 551 |
552 void SQLiteServerBoundCertStore::AddServerBoundCert( | 552 void SQLiteServerBoundCertStore::AddServerBoundCert( |
553 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) { | 553 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) { |
554 if (backend_.get()) | 554 backend_->AddServerBoundCert(cert); |
555 backend_->AddServerBoundCert(cert); | |
556 } | 555 } |
557 | 556 |
558 void SQLiteServerBoundCertStore::DeleteServerBoundCert( | 557 void SQLiteServerBoundCertStore::DeleteServerBoundCert( |
559 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) { | 558 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) { |
560 if (backend_.get()) | 559 backend_->DeleteServerBoundCert(cert); |
561 backend_->DeleteServerBoundCert(cert); | |
562 } | 560 } |
563 | 561 |
564 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { | 562 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { |
565 if (backend_.get()) | 563 backend_->SetForceKeepSessionState(); |
566 backend_->SetForceKeepSessionState(); | |
567 } | 564 } |
568 | 565 |
569 void SQLiteServerBoundCertStore::Flush(const base::Closure& completion_task) { | 566 void SQLiteServerBoundCertStore::Flush(const base::Closure& completion_task) { |
570 if (backend_.get()) | 567 backend_->Flush(completion_task); |
571 backend_->Flush(completion_task); | |
572 else if (!completion_task.is_null()) | |
573 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | |
574 } | 568 } |
575 | 569 |
576 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { | 570 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { |
577 if (backend_.get()) { | 571 backend_->Close(); |
578 backend_->Close(); | 572 // We release our reference to the Backend, though it will probably still have |
579 // Release our reference, it will probably still have a reference if the | 573 // a reference if the background thread has not run Close() yet. |
580 // background thread has not run Close() yet. | |
581 backend_ = NULL; | |
582 } | |
583 } | 574 } |
OLD | NEW |