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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); | 186 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); |
187 | 187 |
188 // This method should be called only once per instance. | 188 // This method should be called only once per instance. |
189 DCHECK(!db_.get()); | 189 DCHECK(!db_.get()); |
190 | 190 |
191 base::TimeTicks start = base::TimeTicks::Now(); | 191 base::TimeTicks start = base::TimeTicks::Now(); |
192 | 192 |
193 // Ensure the parent directory for storing certs is created before reading | 193 // Ensure the parent directory for storing certs is created before reading |
194 // from it. | 194 // from it. |
195 const base::FilePath dir = path_.DirName(); | 195 const base::FilePath dir = path_.DirName(); |
196 if (!base::PathExists(dir) && !file_util::CreateDirectory(dir)) | 196 if (!base::PathExists(dir) && !base::CreateDirectory(dir)) |
197 return; | 197 return; |
198 | 198 |
199 int64 db_size = 0; | 199 int64 db_size = 0; |
200 if (file_util::GetFileSize(path_, &db_size)) | 200 if (file_util::GetFileSize(path_, &db_size)) |
201 UMA_HISTOGRAM_COUNTS("DomainBoundCerts.DBSizeInKB", db_size / 1024 ); | 201 UMA_HISTOGRAM_COUNTS("DomainBoundCerts.DBSizeInKB", db_size / 1024 ); |
202 | 202 |
203 db_.reset(new sql::Connection); | 203 db_.reset(new sql::Connection); |
204 db_->set_histogram_tag("DomainBoundCerts"); | 204 db_->set_histogram_tag("DomainBoundCerts"); |
205 | 205 |
206 // Unretained to avoid a ref loop with db_. | 206 // Unretained to avoid a ref loop with db_. |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 630 |
631 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { | 631 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { |
632 backend_->SetForceKeepSessionState(); | 632 backend_->SetForceKeepSessionState(); |
633 } | 633 } |
634 | 634 |
635 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { | 635 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { |
636 backend_->Close(); | 636 backend_->Close(); |
637 // We release our reference to the Backend, though it will probably still have | 637 // We release our reference to the Backend, though it will probably still have |
638 // a reference if the background thread has not run Close() yet. | 638 // a reference if the background thread has not run Close() yet. |
639 } | 639 } |
OLD | NEW |