| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/common/net/cookie_monster_sqlite.h" | 5 #include "chrome/common/net/cookie_monster_sqlite.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/thread.h" | 13 #include "base/thread.h" |
| 14 #include "chrome/common/sqlite_compiled_statement.h" | 14 #include "chrome/common/sqlite_compiled_statement.h" |
| 15 #include "chrome/common/sqlite_utils.h" | 15 #include "chrome/common/sqlite_utils.h" |
| 16 | 16 |
| 17 using base::Time; |
| 18 |
| 17 // This class is designed to be shared between any calling threads and the | 19 // This class is designed to be shared between any calling threads and the |
| 18 // database thread. It batches operations and commits them on a timer. | 20 // database thread. It batches operations and commits them on a timer. |
| 19 class SQLitePersistentCookieStore::Backend | 21 class SQLitePersistentCookieStore::Backend |
| 20 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { | 22 : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { |
| 21 public: | 23 public: |
| 22 // The passed database pointer must be already-initialized. This object will | 24 // The passed database pointer must be already-initialized. This object will |
| 23 // take ownership. | 25 // take ownership. |
| 24 explicit Backend(sqlite3* db, MessageLoop* loop) | 26 explicit Backend(sqlite3* db, MessageLoop* loop) |
| 25 : db_(db), | 27 : db_(db), |
| 26 background_loop_(loop), | 28 background_loop_(loop), |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 const net::CookieMonster::CanonicalCookie& cc) { | 349 const net::CookieMonster::CanonicalCookie& cc) { |
| 348 if (backend_.get()) | 350 if (backend_.get()) |
| 349 backend_->AddCookie(key, cc); | 351 backend_->AddCookie(key, cc); |
| 350 } | 352 } |
| 351 | 353 |
| 352 void SQLitePersistentCookieStore::DeleteCookie( | 354 void SQLitePersistentCookieStore::DeleteCookie( |
| 353 const net::CookieMonster::CanonicalCookie& cc) { | 355 const net::CookieMonster::CanonicalCookie& cc) { |
| 354 if (backend_.get()) | 356 if (backend_.get()) |
| 355 backend_->DeleteCookie(cc); | 357 backend_->DeleteCookie(cc); |
| 356 } | 358 } |
| 357 | |
| OLD | NEW |