Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: net/cookies/cookie_monster.cc

Issue 18032002: Wait for store flush in CookieMonster::Delete*Task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Portions of this code based on Mozilla: 5 // Portions of this code based on Mozilla:
6 // (netwerk/cookie/src/nsCookieService.cpp) 6 // (netwerk/cookie/src/nsCookieService.cpp)
7 /* ***** BEGIN LICENSE BLOCK ***** 7 /* ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 * 9 *
10 * The contents of this file are subject to the Mozilla Public License Version 10 * The contents of this file are subject to the Mozilla Public License Version
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 Time delete_end_; 584 Time delete_end_;
585 CookieMonster::DeleteCallback callback_; 585 CookieMonster::DeleteCallback callback_;
586 586
587 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenTask); 587 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenTask);
588 }; 588 };
589 589
590 void CookieMonster::DeleteAllCreatedBetweenTask::Run() { 590 void CookieMonster::DeleteAllCreatedBetweenTask::Run() {
591 int num_deleted = this->cookie_monster()-> 591 int num_deleted = this->cookie_monster()->
592 DeleteAllCreatedBetween(delete_begin_, delete_end_); 592 DeleteAllCreatedBetween(delete_begin_, delete_end_);
593 if (!callback_.is_null()) { 593 if (!callback_.is_null()) {
594 this->InvokeCallback(base::Bind(&CookieMonster::DeleteCallback::Run, 594 this->cookie_monster()->FlushStore(base::Bind(callback_, num_deleted));
erikwright (departed) 2013/07/17 16:53:32 Instead of binding (callback_, num_deleted) direct
595 base::Unretained(&callback_), num_deleted));
Randy Smith (Not in Mondays) 2013/06/27 14:30:20 Erik: Why was the base::Unretained() here? It giv
erikwright (departed) 2013/07/17 16:53:32 This was written prior to the ability to re-bind c
596 } 595 }
597 } 596 }
598 597
599 // Task class for DeleteAllForHost call. 598 // Task class for DeleteAllForHost call.
600 class CookieMonster::DeleteAllForHostTask 599 class CookieMonster::DeleteAllForHostTask
601 : public CookieMonster::CookieMonsterTask { 600 : public CookieMonster::CookieMonsterTask {
602 public: 601 public:
603 DeleteAllForHostTask(CookieMonster* cookie_monster, 602 DeleteAllForHostTask(CookieMonster* cookie_monster,
604 const GURL& url, 603 const GURL& url,
605 const CookieMonster::DeleteCallback& callback) 604 const CookieMonster::DeleteCallback& callback)
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 2149
2151 // The system resolution is not high enough, so we can have multiple 2150 // The system resolution is not high enough, so we can have multiple
2152 // set cookies that result in the same system time. When this happens, we 2151 // set cookies that result in the same system time. When this happens, we
2153 // increment by one Time unit. Let's hope computers don't get too fast. 2152 // increment by one Time unit. Let's hope computers don't get too fast.
2154 Time CookieMonster::CurrentTime() { 2153 Time CookieMonster::CurrentTime() {
2155 return std::max(Time::Now(), 2154 return std::max(Time::Now(),
2156 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); 2155 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1));
2157 } 2156 }
2158 2157
2159 } // namespace net 2158 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698