diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/net/sqlite_persistent_cookie_store.cc | 29 | ||||
-rw-r--r-- | chrome/browser/net/sqlite_persistent_cookie_store.h | 4 |
2 files changed, 33 insertions, 0 deletions
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc index 9da5c76..9123ea2 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store.cc +++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc @@ -68,6 +68,11 @@ class SQLitePersistentCookieStore::Backend // Batch a cookie deletion. void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc); +#if defined(ANDROID) + // Commit any pending operations. + void Flush(); +#endif + // Commit any pending operations and close the database. This must be called // before the object is destructed. void Close(); @@ -274,6 +279,23 @@ void SQLitePersistentCookieStore::Backend::Commit() { succeeded ? 0 : 1, 2); } +#if defined(ANDROID) +void SQLitePersistentCookieStore::Backend::Flush() { +// Keep this #ifdef when upstreaming to Chromium. +#if defined(ANDROID) + if (!getDbThread()) + return; + MessageLoop* loop = getDbThread()->message_loop(); + loop->PostTask(FROM_HERE, NewRunnableMethod(this, &Backend::Commit)); +#else + DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::DB)); + BrowserThread::PostTask( + BrowserThread::DB, FROM_HERE, + NewRunnableMethod(this, &Backend::Commit)); +#endif +} +#endif + // Fire off a close message to the background thread. We could still have a // pending commit timer that will be holding a reference on us, but if/when // this fires we will already have been cleaned up and it will be ignored. @@ -517,6 +539,13 @@ void SQLitePersistentCookieStore::DeleteCookie( backend_->DeleteCookie(cc); } +#if defined(ANDROID) +void SQLitePersistentCookieStore::Flush() { + if (backend_.get()) + backend_->Flush(); +} +#endif + // static void SQLitePersistentCookieStore::ClearLocalState( const FilePath& path) { diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.h b/chrome/browser/net/sqlite_persistent_cookie_store.h index d3bdfb7..4159e71 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store.h +++ b/chrome/browser/net/sqlite_persistent_cookie_store.h @@ -35,6 +35,10 @@ class SQLitePersistentCookieStore const net::CookieMonster::CanonicalCookie&); virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie&); +#if defined(ANDROID) + virtual void Flush(); +#endif + static void ClearLocalState(const FilePath& path); private: |