| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" | 17 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "sql/meta_table.h" | 19 #include "sql/meta_table.h" |
| 20 #include "sql/statement.h" | 20 #include "sql/statement.h" |
| 21 #include "sql/transaction.h" | 21 #include "sql/transaction.h" |
| 22 | 22 |
| 23 using content::BrowserThread; |
| 24 |
| 23 // This class is designed to be shared between any calling threads and the | 25 // This class is designed to be shared between any calling threads and the |
| 24 // database thread. It batches operations and commits them on a timer. | 26 // database thread. It batches operations and commits them on a timer. |
| 25 class SQLiteOriginBoundCertStore::Backend | 27 class SQLiteOriginBoundCertStore::Backend |
| 26 : public base::RefCountedThreadSafe<SQLiteOriginBoundCertStore::Backend> { | 28 : public base::RefCountedThreadSafe<SQLiteOriginBoundCertStore::Backend> { |
| 27 public: | 29 public: |
| 28 explicit Backend(const FilePath& path) | 30 explicit Backend(const FilePath& path) |
| 29 : path_(path), | 31 : path_(path), |
| 30 db_(NULL), | 32 db_(NULL), |
| 31 num_pending_(0), | 33 num_pending_(0), |
| 32 clear_local_state_on_exit_(false) { | 34 clear_local_state_on_exit_(false) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 if (backend_.get()) | 397 if (backend_.get()) |
| 396 backend_->SetClearLocalStateOnExit(clear_local_state); | 398 backend_->SetClearLocalStateOnExit(clear_local_state); |
| 397 } | 399 } |
| 398 | 400 |
| 399 void SQLiteOriginBoundCertStore::Flush(Task* completion_task) { | 401 void SQLiteOriginBoundCertStore::Flush(Task* completion_task) { |
| 400 if (backend_.get()) | 402 if (backend_.get()) |
| 401 backend_->Flush(completion_task); | 403 backend_->Flush(completion_task); |
| 402 else if (completion_task) | 404 else if (completion_task) |
| 403 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 405 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
| 404 } | 406 } |
| OLD | NEW |