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 5430004: Refactored cookies persistent store clean-up on shutdown. (Closed)

Created:
10 years ago by pastarmovj
Modified:
9 years, 5 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, Randy Smith (Not in Mondays), ben+cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Refactored cookies persistent store clean-up on shutdown. Changed the static call of SQLitePersistantCookieStore::ClearLocalState to a call of a virtual method PersistantCookieStore::ClearLocalState from inside the destruction sequence of the owning UrlRequestContext. Thus the code will now work with any other persistancy implementation and allow for better parallelism. To test. Enable deleting of cookies and user data on shutdown and check if the Cookies file in the profile directory has been deleted. BUG=64920 TEST=Manual. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=68343

Patch Set 1 #

Patch Set 2 : Whitespace fix. #

Total comments: 19

Patch Set 3 : Added unit test and moved flag to the persistence store itself. #

Total comments: 34

Patch Set 4 : Style fixes. #

Total comments: 24

Patch Set 5 : This is how the patch looks like applied on top of http://codereview.chromium.org/5610003/ . #

Patch Set 6 : Tiny style fixes. #

Total comments: 2

Patch Set 7 : Lock protected the clear on exit flag. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+188 lines, -22 lines) Patch
M chrome/browser/browser_process_impl.cc View 1 2 3 4 2 chunks +0 lines, -3 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.h View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.cc View 1 2 3 4 5 chunks +18 lines, -0 lines 0 comments Download
M chrome/browser/net/sqlite_persistent_cookie_store.h View 1 2 3 4 5 1 chunk +8 lines, -5 lines 0 comments Download
M chrome/browser/net/sqlite_persistent_cookie_store.cc View 1 2 3 4 5 6 7 chunks +22 lines, -8 lines 0 comments Download
A chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc View 1 2 3 4 1 chunk +113 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M net/base/cookie_monster.h View 1 2 3 4 5 2 chunks +14 lines, -6 lines 0 comments Download
M net/base/cookie_monster.cc View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M net/base/cookie_monster_store_test.h View 1 2 3 2 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
pastarmovj
Please review.
10 years ago (2010-12-01 16:53:59 UTC) #1
Mattias Nissler (ping if slow)
Looks pretty good, just a few questions/comments. As I'm not intimately familiar with this part ...
10 years ago (2010-12-01 17:23:24 UTC) #2
Randy Smith (Not in Mondays)
For understanding this change, it would help me to understand the use cases for kClearSiteDataOnExit. ...
10 years ago (2010-12-01 20:39:49 UTC) #3
jochen (gone - plz use gerrit)
On 2010/12/01 20:39:49, rdsmith wrote: > For understanding this change, it would help me to ...
10 years ago (2010-12-02 08:45:18 UTC) #4
jochen (gone - plz use gerrit)
http://codereview.chromium.org/5430004/diff/2001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): http://codereview.chromium.org/5430004/diff/2001/chrome/browser/browser_process_impl.cc#newcode38 chrome/browser/browser_process_impl.cc:38: #include "chrome/browser/net/sqlite_persistent_cookie_store.h" do you still need this? http://codereview.chromium.org/5430004/diff/2001/chrome/browser/net/chrome_url_request_context.h File ...
10 years ago (2010-12-02 08:45:50 UTC) #5
pastarmovj
@Jochen please review. http://codereview.chromium.org/5430004/diff/2001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): http://codereview.chromium.org/5430004/diff/2001/chrome/browser/browser_process_impl.cc#newcode38 chrome/browser/browser_process_impl.cc:38: #include "chrome/browser/net/sqlite_persistent_cookie_store.h" On 2010/12/02 08:45:50, jochen ...
10 years ago (2010-12-02 14:54:35 UTC) #6
jochen (gone - plz use gerrit)
http://codereview.chromium.org/5430004/diff/14001/chrome/browser/net/chrome_url_request_context.cc File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/5430004/diff/14001/chrome/browser/net/chrome_url_request_context.cc#newcode321 chrome/browser/net/chrome_url_request_context.cc:321: nit no empty line plz http://codereview.chromium.org/5430004/diff/14001/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): ...
10 years ago (2010-12-02 15:09:51 UTC) #7
pastarmovj
http://codereview.chromium.org/5430004/diff/14001/chrome/browser/net/chrome_url_request_context.cc File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/5430004/diff/14001/chrome/browser/net/chrome_url_request_context.cc#newcode321 chrome/browser/net/chrome_url_request_context.cc:321: On 2010/12/02 15:09:51, jochen wrote: > nit no empty ...
10 years ago (2010-12-02 16:29:07 UTC) #8
jochen (gone - plz use gerrit)
http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.h File chrome/browser/net/sqlite_persistent_cookie_store.h (right): http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.h#newcode41 chrome/browser/net/sqlite_persistent_cookie_store.h:41: void SetClearLocalStateOnExit(bool clear_local_state) { virtual http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.h#newcode54 chrome/browser/net/sqlite_persistent_cookie_store.h:54: // If ...
10 years ago (2010-12-02 16:48:43 UTC) #9
Randy Smith (Not in Mondays)
http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.cc#newcode272 chrome/browser/net/sqlite_persistent_cookie_store.cc:272: &file_util::Delete, path_, false)); I'm willing to accept this interface, ...
10 years ago (2010-12-02 21:19:26 UTC) #10
pastarmovj
Should be mostly done now. Running the try bots meanwhile... http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store.cc#newcode272 ...
10 years ago (2010-12-03 16:43:01 UTC) #11
pastarmovj
Just a remark about obsoleted comment in my previos post. http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc File chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc (right): http://codereview.chromium.org/5430004/diff/24001/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc#newcode32 ...
10 years ago (2010-12-03 16:46:40 UTC) #12
Randy Smith (Not in Mondays)
LGTM with one final request. http://codereview.chromium.org/5430004/diff/48001/chrome/browser/net/sqlite_persistent_cookie_store.cc File chrome/browser/net/sqlite_persistent_cookie_store.cc (right): http://codereview.chromium.org/5430004/diff/48001/chrome/browser/net/sqlite_persistent_cookie_store.cc#newcode474 chrome/browser/net/sqlite_persistent_cookie_store.cc:474: backend_->SetClearLocalStateOnExit(clear_local_state); Could you protect ...
10 years ago (2010-12-03 18:42:27 UTC) #13
pastarmovj
10 years ago (2010-12-06 08:57:40 UTC) #14
http://codereview.chromium.org/5430004/diff/48001/chrome/browser/net/sqlite_p...
File chrome/browser/net/sqlite_persistent_cookie_store.cc (right):

http://codereview.chromium.org/5430004/diff/48001/chrome/browser/net/sqlite_p...
chrome/browser/net/sqlite_persistent_cookie_store.cc:474:
backend_->SetClearLocalStateOnExit(clear_local_state);
On 2010/12/03 18:42:27, rdsmith wrote:
> Could you protect this with the lock (and modify the comment on the lock to
> indicate it protects this field as well)?  It shouldn't matter--boolean
accesses
> should be atomic so you don't really care who wins the possible races, and I
> can't come up with a case in which the race would actually happen--but I'd
> rather be extra careful around thread safety in chrome since most code is
> single-threaded and hence most developers aren't used to thinking about thread
> safety in detail.

Done. I had exactly the same thoughts and didn't put the lock there because all
calls to this function are routed through the same thread. However maybe it's
more failsafe this way anyhow and I don't see potential for deadlocks here
either.

Powered by Google App Engine
This is Rietveld 408576698