| Index: ios/net/cookies/cookie_store_ios.mm
|
| diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
|
| index 2b00ae245f8f533ed68bbdf87e21111cc4007c11..a7d20d7702c3ec6b21f70219ee2e1f988bbc6d97 100644
|
| --- a/ios/net/cookies/cookie_store_ios.mm
|
| +++ b/ios/net/cookies/cookie_store_ios.mm
|
| @@ -321,7 +321,7 @@ CookieStoreIOS* CookieStoreIOS::CreateCookieStore(
|
| // it from the system's cookie jar.
|
| CookieStoreIOS* cookie_store = new CookieStoreIOS(nullptr, cookie_storage);
|
| cookie_store->synchronization_state_ = SYNCHRONIZED;
|
| - cookie_store->Flush(base::Closure());
|
| + cookie_store->FlushStore(base::Closure());
|
| return cookie_store;
|
| }
|
|
|
| @@ -340,18 +340,6 @@ void CookieStoreIOS::NotifySystemCookiesChanged() {
|
| NotificationTrampoline::GetInstance()->NotifyCookiesChanged();
|
| }
|
|
|
| -void CookieStoreIOS::Flush(const base::Closure& closure) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| -
|
| - if (SystemCookiesAllowed()) {
|
| - // If cookies are disabled, the system store is empty, and the cookies are
|
| - // stashed on disk. Do not delete the cookies on the disk in this case.
|
| - WriteToCookieMonster([system_store_ cookies]);
|
| - }
|
| - cookie_monster_->FlushStore(closure);
|
| - flush_closure_.Cancel();
|
| -}
|
| -
|
| void CookieStoreIOS::UnSynchronize() {
|
| SetSynchronizedWithSystemStore(false);
|
| }
|
| @@ -616,6 +604,18 @@ void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) {
|
| }
|
| }
|
|
|
| +void CookieStoreIOS::FlushStore(const base::Closure& closure) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + if (SystemCookiesAllowed()) {
|
| + // If cookies are disabled, the system store is empty, and the cookies are
|
| + // stashed on disk. Do not delete the cookies on the disk in this case.
|
| + WriteToCookieMonster([system_store_ cookies]);
|
| + }
|
| + cookie_monster_->FlushStore(closure);
|
| + flush_closure_.Cancel();
|
| +}
|
| +
|
| #pragma mark -
|
| #pragma mark Protected methods
|
|
|
| @@ -658,10 +658,10 @@ void CookieStoreIOS::OnSystemCookiePolicyChanged() {
|
| base::Bind(&CookieStoreIOS::AddCookiesToSystemStore, this));
|
| } else {
|
| DCHECK_EQ(NSHTTPCookieAcceptPolicyNever, policy);
|
| - // Flush() does not write the cookies to disk when they are disabled.
|
| + // FlushStore() does not write the cookies to disk when they are disabled.
|
| // Explicitly copy them.
|
| WriteToCookieMonster([system_store_ cookies]);
|
| - Flush(base::Closure());
|
| + FlushStore(base::Closure());
|
| ClearSystemStore();
|
| if (synchronization_state_ == SYNCHRONIZING) {
|
| // If synchronization was in progress, abort it and leave the cookie store
|
| @@ -713,7 +713,7 @@ void CookieStoreIOS::SetSynchronizedWithSystemStore(bool synchronized) {
|
| return;
|
| } else {
|
| // Copy the cookies from the global store to |cookie_monster_|.
|
| - Flush(base::Closure());
|
| + FlushStore(base::Closure());
|
| }
|
| }
|
| synchronization_state_ = synchronized ? SYNCHRONIZED : NOT_SYNCHRONIZED;
|
| @@ -846,7 +846,7 @@ void CookieStoreIOS::OnSystemCookiesChanged() {
|
| if (!flush_closure_.IsCancelled())
|
| return;
|
|
|
| - flush_closure_.Reset(base::Bind(&CookieStoreIOS::Flush,
|
| + flush_closure_.Reset(base::Bind(&CookieStoreIOS::FlushStore,
|
| base::Unretained(this), base::Closure()));
|
| base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
| FROM_HERE, flush_closure_.callback(), flush_delay_);
|
|
|