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

Unified Diff: net/cookies/cookie_monster.cc

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: Initialize channel_id_service to nullptr Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/cookie_monster.h ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster.cc
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index f2bd3e4558249f5b0651df1e7d3ab4fe537bd882..94d76d59f5a494477e2b5b688b2918c6f35f321f 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -66,6 +66,7 @@
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
+#include "net/ssl/channel_id_service.h"
#include "url/origin.h"
using base::Time;
@@ -347,11 +348,27 @@ CookieMonster::CookieMonster(PersistentCookieStore* store,
: CookieMonster(
store,
delegate,
+ nullptr,
+ base::TimeDelta::FromSeconds(kDefaultAccessUpdateThresholdSeconds)) {}
+
+CookieMonster::CookieMonster(PersistentCookieStore* store,
+ CookieMonsterDelegate* delegate,
+ ChannelIDService* channel_id_service)
+ : CookieMonster(
+ store,
+ delegate,
+ channel_id_service,
base::TimeDelta::FromSeconds(kDefaultAccessUpdateThresholdSeconds)) {}
CookieMonster::CookieMonster(PersistentCookieStore* store,
CookieMonsterDelegate* delegate,
base::TimeDelta last_access_threshold)
+ : CookieMonster(store, delegate, nullptr, last_access_threshold) {}
+
+CookieMonster::CookieMonster(PersistentCookieStore* store,
+ CookieMonsterDelegate* delegate,
+ ChannelIDService* channel_id_service,
+ base::TimeDelta last_access_threshold)
: initialized_(false),
started_fetching_all_cookies_(false),
finished_fetching_all_cookies_(false),
@@ -360,6 +377,7 @@ CookieMonster::CookieMonster(PersistentCookieStore* store,
store_(store),
last_access_threshold_(last_access_threshold),
delegate_(delegate),
+ channel_id_service_(channel_id_service),
last_statistic_record_time_(base::Time::Now()),
persist_session_cookies_(false),
weak_ptr_factory_(this) {
@@ -862,10 +880,14 @@ void CookieMonster::SetCookieWithDetailsAsync(
void CookieMonster::FlushStore(const base::Closure& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (initialized_ && store_.get())
+ if (initialized_ && store_.get()) {
+ if (channel_id_service_) {
+ channel_id_service_->GetChannelIDStore()->Flush();
+ }
store_->Flush(callback);
- else if (!callback.is_null())
+ } else if (!callback.is_null()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
+ }
}
void CookieMonster::SetForceKeepSessionState() {
« no previous file with comments | « net/cookies/cookie_monster.h ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698