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

Issue 7598001: Remove the old synchronous CookieMonster API. (Closed)

Created:
9 years, 4 months ago by ycxiao
Modified:
9 years ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, kkania, Paweł Hajdan Jr., jam, joi+watch-content_chromium.org, wtc, darin-cc_chromium.org, rkn, estade+watch_chromium.org
Visibility:
Public.

Description

Remove the old synchronous CookieMonster API. Move the cookie loading form IO thread to DB thread in SQLitePersistentCookieStore. Queue the request of CookieMonster while the loading isn't finished, and invoke the queue task when done. BUG=68657 TEST=CookieMonsterTest, SQLitePersistentCookieStoreTest

Patch Set 1 : '' #

Total comments: 50

Patch Set 2 : '' #

Total comments: 6

Patch Set 3 : '' #

Total comments: 20

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 6

Patch Set 7 : '' #

Total comments: 33
Unified diffs Side-by-side diffs Delta from patch set Stats (+1139 lines, -580 lines) Patch
M chrome/browser/automation/automation_util.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/fast_shutdown_interactive_uitest.cc View 1 3 chunks +15 lines, -1 line 3 comments Download
M chrome/browser/net/cookie_policy_browsertest.cc View 1 2 chunks +10 lines, -3 lines 0 comments Download
M chrome/browser/net/sqlite_persistent_cookie_store.h View 1 2 1 chunk +10 lines, -6 lines 0 comments Download
M chrome/browser/net/sqlite_persistent_cookie_store.cc View 1 2 9 chunks +55 lines, -15 lines 2 comments Download
M chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc View 1 5 chunks +27 lines, -4 lines 0 comments Download
M chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc View 1 1 chunk +37 lines, -37 lines 3 comments Download
M content/browser/renderer_host/render_message_filter.cc View 1 1 chunk +4 lines, -3 lines 0 comments Download
M net/base/cookie_monster.h View 1 2 3 4 5 6 15 chunks +112 lines, -54 lines 13 comments Download
M net/base/cookie_monster.cc View 1 2 3 4 5 6 24 chunks +585 lines, -119 lines 12 comments Download
M net/base/cookie_monster_store_test.h View 1 2 2 chunks +7 lines, -9 lines 0 comments Download
M net/base/cookie_monster_store_test.cc View 1 2 chunks +10 lines, -6 lines 0 comments Download
M net/base/cookie_monster_unittest.cc View 1 2 3 4 5 6 64 chunks +244 lines, -249 lines 0 comments Download
M net/base/cookie_store.h View 1 2 3 4 5 4 chunks +9 lines, -43 lines 0 comments Download
M net/base/cookie_store.cc View 1 1 chunk +0 lines, -26 lines 0 comments Download
M net/url_request/url_request_unittest.cc View 1 2 3 chunks +13 lines, -4 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
ycxiao
Hi Erik, PTAL. Thanks!
9 years, 4 months ago (2011-08-09 22:32:14 UTC) #1
erikwright (departed)
Review of cookie_{store,monster}.{h,cc} Still reviewing sqlite_persistent_cookie_store.{h,cc}, *test.cc, and the two modified clients. http://codereview.chromium.org/7598001/diff/7007/chrome/browser/net/sqlite_persistent_cookie_store.h File chrome/browser/net/sqlite_persistent_cookie_store.h ...
9 years, 4 months ago (2011-08-11 13:58:24 UTC) #2
erikwright (departed)
Further comments on patchset 1. http://codereview.chromium.org/7598001/diff/7007/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): http://codereview.chromium.org/7598001/diff/7007/chrome/browser/net/sqlite_persistent_cookie_store.cc#newcode169 chrome/browser/net/sqlite_persistent_cookie_store.cc:169: loaded_callback_ = loaded_callback; DCHECK(loaded_callback_.is_null()); ...
9 years, 4 months ago (2011-08-11 15:13:52 UTC) #3
erikwright (departed)
Further reviews based on patchset 2. http://codereview.chromium.org/7598001/diff/9001/net/base/cookie_monster.cc File net/base/cookie_monster.cc (right): http://codereview.chromium.org/7598001/diff/9001/net/base/cookie_monster.cc#newcode621 net/base/cookie_monster.cc:621: GURL* gurl = ...
9 years, 4 months ago (2011-08-11 15:30:42 UTC) #4
ycxiao
http://codereview.chromium.org/7598001/diff/7007/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): http://codereview.chromium.org/7598001/diff/7007/chrome/browser/net/sqlite_persistent_cookie_store.cc#newcode169 chrome/browser/net/sqlite_persistent_cookie_store.cc:169: loaded_callback_ = loaded_callback; On 2011/08/11 15:13:52, erikwright wrote: > ...
9 years, 4 months ago (2011-08-12 02:35:24 UTC) #5
erikwright (departed)
Looking better. Refer also to our offline discussion about removing the need for task functions ...
9 years, 4 months ago (2011-08-12 16:00:33 UTC) #6
ycxiao
The CookieMonster unittest use DeleteAllAsync(false). Also the uinttest is the only user of DeleteAllAsync. Done ...
9 years, 4 months ago (2011-08-12 17:51:25 UTC) #7
erikwright (departed)
It would be good to remove the unnecessary 'sync_to_store' parameter wherever it occurs. Also, it ...
9 years, 4 months ago (2011-08-12 18:18:42 UTC) #8
ycxiao
http://codereview.chromium.org/7598001/diff/20035/net/base/cookie_monster.cc File net/base/cookie_monster.cc (right): http://codereview.chromium.org/7598001/diff/20035/net/base/cookie_monster.cc#newcode579 net/base/cookie_monster.cc:579: virtual void Run() = 0; On 2011/08/12 18:18:42, erikwright ...
9 years, 4 months ago (2011-08-12 21:47:43 UTC) #9
erikwright (departed)
Hi Randy, Please take a first look at this. It requires a few new tests ...
9 years, 4 months ago (2011-08-19 18:13:04 UTC) #10
Randy Smith (Not in Mondays)
Erik: I'm going to go through and do a more detailed pass now, but I ...
9 years, 4 months ago (2011-08-19 20:54:08 UTC) #11
Randy Smith (Not in Mondays)
More detailed notes. http://codereview.chromium.org/7598001/diff/26008/chrome/browser/fast_shutdown_interactive_uitest.cc File chrome/browser/fast_shutdown_interactive_uitest.cc (right): http://codereview.chromium.org/7598001/diff/26008/chrome/browser/fast_shutdown_interactive_uitest.cc#newcode46 chrome/browser/fast_shutdown_interactive_uitest.cc:46: On 2011/08/19 18:13:05, erikwright wrote: > ...
9 years, 4 months ago (2011-08-19 21:40:04 UTC) #12
erikwright (departed)
On 2011/08/19 20:54:08, rdsmith wrote: > Erik: I'm going to go through and do a ...
9 years, 3 months ago (2011-08-30 15:30:34 UTC) #13
Randy Smith (Not in Mondays)
On 2011/08/30 15:30:34, erikwright wrote: > On 2011/08/19 20:54:08, rdsmith wrote: > > Erik: I'm ...
9 years, 3 months ago (2011-08-30 18:37:58 UTC) #14
erikwright (departed)
Hi Randy, My responses are here, but the CL continues here: http://codereview.chromium.org/7833042/ Cheers, Erik http://codereview.chromium.org/7598001/diff/26008/chrome/browser/fast_shutdown_interactive_uitest.cc ...
9 years, 3 months ago (2011-09-06 17:34:45 UTC) #15
Randy Smith (Not in Mondays)
9 years, 3 months ago (2011-09-07 15:46:27 UTC) #16
Responding on this CL just to answer your comments; starting full review on the
new CL now.

http://codereview.chromium.org/7598001/diff/26008/net/base/cookie_monster.cc
File net/base/cookie_monster.cc (right):

http://codereview.chromium.org/7598001/diff/26008/net/base/cookie_monster.cc#...
net/base/cookie_monster.cc:1230: InternalDeleteCookie(curit, true, 
/*sync_to_store*/
On 2011/09/06 17:34:45, erikwright wrote:
> On 2011/08/19 20:54:08, rdsmith wrote:
> > nit: It isn't completely clear to me what the sync to store comment refers. 
> One
> > arg a line, or maybe put it before the comma?  (Not sure if that's ok by the
> > style guide).
> 
> After looking through this, it's not much work to get rid of sync_to_store now
> (only not true in the destructor) and it will tidy up a bunch of stuff. I'll
do
> that in a follow-up commit.

Excellent news; thanks!  (It's a minor thing, but I've hated sync_to_store for a
long time.)

http://codereview.chromium.org/7598001/diff/26008/net/base/cookie_monster.cc#...
net/base/cookie_monster.cc:1442: void CookieMonster::OnLoaded(const
std::vector<CanonicalCookie*>& cookies) {
On 2011/09/06 17:34:45, erikwright wrote:
> On 2011/08/19 21:40:05, rdsmith wrote:
> > This is a pretty small function; I'd be inclined to combine it with the one
> > after.
> 
> The following function has a function-scoped lock, which must not be held
during
> InvokeQueue. If I combine them I must either:
> 
> 1) Nest the entire current function in a new scope block.
> 2) Manually release the lock at the end of the method, before calling
> InvokeQueue.
> 
> I find both unpalatable, but will defer to your judgement.

Got it.  No strong feelings; this is fine.

http://codereview.chromium.org/7598001/diff/26008/net/base/cookie_monster.h
File net/base/cookie_monster.h (right):

http://codereview.chromium.org/7598001/diff/26008/net/base/cookie_monster.h#n...
net/base/cookie_monster.h:296: friend class SetCookieWithOptionsTask;
On 2011/09/06 17:34:45, erikwright wrote:
> On 2011/08/19 21:40:05, rdsmith wrote:
> > I'm feeling torn about this long list of friend classes, and the creation of
> all
> > of the different tasks.  It's both uglier and heresy, but I'm playing around
> > with the idea of a case statement instead (i.e. have a single object that
can
> be
> > used for all the different operations that has the set union (literally; I'm
> not
> > suggesting a C union) of all the information of all of these objects plus an
> > enum to indicate which operation a particular object refers to, do a single
> > "friend class CookieMonster" inside that class, and then pass objects of
that
> > class into a CookieMonster method (which is where the case statement will
be)
> > for execution.  I think that results in a lot less code, many fewer friends
of
> > the CookieMonster (the CookieMonster should have no friends--more cookies
for
> > it!!  :-}); it's not good object oriented polymorphism, but I think it would
> > still be pretty clear.  I won't insist on the idea, but I wanted to float it
> by
> > you in case it appealed to you over this approach.
> 
> The case statement, IME is more error prone in addition to being uglier and
> heresy :)
> 
> I would prefer to reduce the number of methods that actually need to be
> asynchronous by extracting different smaller classes out of this one. This
will
> have the same effect (in fact, probably even a better outcome).

Ok.

Powered by Google App Engine
This is Rietveld 408576698