CookieMonster: Don't dispatch change when storing loaded cookies
This introduces a base::Feature which, when enabled, prevents the
CookieMonster from sending a CookieChangeDispatcher notification
when storing cookies loaded from the persistent store. All other
cookie changes still produce a change notification as usual.
This feature is disabled by default.
Bug: 1169280
Change-Id: Ieccfafea1af4f5dc1c078adc7c3f51c7bb1c9e8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2642185
Commit-Queue: Lily Chen <[email protected]>
Reviewed-by: Maksim Orlovich <[email protected]>
Cr-Commit-Position: refs/heads/master@{#857742}
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 990869d..4265075 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -460,13 +460,16 @@
base::Time* creation_date_to_inherit,
CookieInclusionStatus* status);
- // Inserts |cc| into cookies_. Returns an iterator that points to the inserted
- // cookie in cookies_. Guarantee: all iterators to cookies_ remain valid.
+ // Inserts `cc` into cookies_. Returns an iterator that points to the inserted
+ // cookie in `cookies_`. Guarantee: all iterators to `cookies_` remain valid.
+ // Dispatches the change to `change_dispatcher_` iff `dispatch_change` is
+ // true.
CookieMap::iterator InternalInsertCookie(
const std::string& key,
std::unique_ptr<CanonicalCookie> cc,
bool sync_to_store,
- const CookieAccessResult& access_result);
+ const CookieAccessResult& access_result,
+ bool dispatch_change = true);
// Sets all cookies from |list| after deleting any equivalent cookie.
// For data gathering purposes, this routine is treated as if it is