OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" | 9 #include "app/sql/meta_table.h" |
10 #include "app/sql/statement.h" | 10 #include "app/sql/statement.h" |
11 #include "app/sql/transaction.h" | 11 #include "app/sql/transaction.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/thread.h" | 20 #include "base/threading/thread.h" |
21 #include "chrome/browser/browser_thread.h" | 21 #include "chrome/browser/browser_thread.h" |
22 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" | 22 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
23 | 23 |
24 using base::Time; | 24 using base::Time; |
25 | 25 |
26 // This class is designed to be shared between any calling threads and the | 26 // This class is designed to be shared between any calling threads and the |
27 // database thread. It batches operations and commits them on a timer. | 27 // database thread. It batches operations and commits them on a timer. |
28 class SQLitePersistentCookieStore::Backend | 28 class SQLitePersistentCookieStore::Backend |
29 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { | 29 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { |
30 public: | 30 public: |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 if (backend_.get()) | 493 if (backend_.get()) |
494 backend_->SetClearLocalStateOnExit(clear_local_state); | 494 backend_->SetClearLocalStateOnExit(clear_local_state); |
495 } | 495 } |
496 | 496 |
497 void SQLitePersistentCookieStore::Flush(Task* completion_task) { | 497 void SQLitePersistentCookieStore::Flush(Task* completion_task) { |
498 if (backend_.get()) | 498 if (backend_.get()) |
499 backend_->Flush(completion_task); | 499 backend_->Flush(completion_task); |
500 else if (completion_task) | 500 else if (completion_task) |
501 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 501 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
502 } | 502 } |
OLD | NEW |