| 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_persistent_cookie_store.h" | 5 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "app/sql/meta_table.h" | |
| 10 #include "app/sql/statement.h" | |
| 11 #include "app/sql/transaction.h" | |
| 12 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 13 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 14 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 15 #include "base/logging.h" | 12 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 19 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 20 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 21 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 22 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" | 19 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 23 #include "content/browser/browser_thread.h" | 20 #include "content/browser/browser_thread.h" |
| 24 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "sql/meta_table.h" |
| 23 #include "sql/statement.h" |
| 24 #include "sql/transaction.h" |
| 25 | 25 |
| 26 using base::Time; | 26 using base::Time; |
| 27 | 27 |
| 28 // This class is designed to be shared between any calling threads and the | 28 // This class is designed to be shared between any calling threads and the |
| 29 // database thread. It batches operations and commits them on a timer. | 29 // database thread. It batches operations and commits them on a timer. |
| 30 class SQLitePersistentCookieStore::Backend | 30 class SQLitePersistentCookieStore::Backend |
| 31 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { | 31 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { |
| 32 public: | 32 public: |
| 33 explicit Backend(const FilePath& path) | 33 explicit Backend(const FilePath& path) |
| 34 : path_(path), | 34 : path_(path), |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 if (backend_.get()) | 511 if (backend_.get()) |
| 512 backend_->SetClearLocalStateOnExit(clear_local_state); | 512 backend_->SetClearLocalStateOnExit(clear_local_state); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void SQLitePersistentCookieStore::Flush(Task* completion_task) { | 515 void SQLitePersistentCookieStore::Flush(Task* completion_task) { |
| 516 if (backend_.get()) | 516 if (backend_.get()) |
| 517 backend_->Flush(completion_task); | 517 backend_->Flush(completion_task); |
| 518 else if (completion_task) | 518 else if (completion_task) |
| 519 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 519 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
| 520 } | 520 } |
| OLD | NEW |