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

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)

Created:
3 years, 6 months ago by Randy Smith (Not in Mondays)
Modified:
3 years, 6 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, net-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Shift cookie system callbacks to OnceCallback to match mojo. Mojo provides OnceCallbacks to services for notification of completion of operations (which makes sense--operations can't conceptually complete multiple times). Unfortunately, CookieStore, while asynchronous, uses the default repeating callbacks. This CL shifts the CookieStore over to using OnceCallbacks, so that a cookie service may be layered on top of it. This change is made simpler and smaller by the fact that there is an automatic cast from a repeated Callback to a OnceCallback, so consumers of the CookieStore interface do not need to be converted. However, all subclasses of CookieStore do. See https://docs.google.com/document/d/1jsaJAT-WbFS2ZwLEPkAgGcMTQ6MQLIQlyQfd1JeEupg/edit#heading=h.5ztx0u98smg8 for details on OnceCallback and conversions. A couple of things to note about conversions: * OnceCallbacks can't be copied, they need to be moved (std::move). * Bind produces Callbacks, BindOnce produces OnceCallbacks. * If you Bind a OnceCallback, that's similar to binding a unique_ptr<>; you have to use Passed() and it's not clear what happens if you call the result multiple times. BindOnce() Just Works, and correctly expresses the semantics (since if a repeating Callback actually used a OnceCallback, it's not clear what the repeating Callback would do on the next call). BUG=721395 Review-Url: https://codereview.chromium.org/2937963003 Cr-Commit-Position: refs/heads/master@{#481573} Committed: https://chromium.googlesource.com/chromium/src/+/7ac8171e75097750531a69f5eadf32b03f481f96

Patch Set 1 #

Patch Set 2 : Fixed all compile errors from building chrome and headless. #

Patch Set 3 : Next round of compile errors. #

Patch Set 4 : Fix incorrect use of OnceCallback. #

Patch Set 5 : Fixed more compile errors #

Patch Set 6 : Switch missed args line. #

Patch Set 7 : Another tweak to AW. #

Patch Set 8 : Fix RunCallbackOnClientThread signature. #

Patch Set 9 : RunCallbackOnClientThread -> BindOnce #

Patch Set 10 : CreateWrappedClosureCallback -> BindOnce #

Patch Set 11 : Results of self review and description update. #

Patch Set 12 : Rebased on top of http://codereview.chromium.org/2882063002 #

Patch Set 13 : Finish Merge #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+563 lines, -557 lines) Patch
M android_webview/browser/net/aw_cookie_store_wrapper.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +30 lines, -29 lines 0 comments Download
M android_webview/browser/net/aw_cookie_store_wrapper.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +80 lines, -78 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_cookie_helper.h View 1 2 3 1 chunk +1 line, -2 lines 2 comments Download
M chrome/browser/browsing_data/browsing_data_cookie_helper.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/browsing_data/mock_browsing_data_cookie_helper.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/api/cookies/cookies_helpers.h View 1 1 chunk +3 lines, -4 lines 0 comments Download
M chrome/browser/extensions/api/cookies/cookies_helpers.cc View 1 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/net/quota_policy_cookie_store.h View 1 1 chunk +1 line, -1 line 0 comments Download
M content/browser/net/quota_policy_cookie_store.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M headless/public/util/testing/generic_url_request_mocks.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +15 lines, -16 lines 0 comments Download
M headless/public/util/testing/generic_url_request_mocks.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +29 lines, -30 lines 0 comments Download
M ios/net/cookies/cookie_store_ios.h View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +24 lines, -26 lines 0 comments Download
M ios/net/cookies/cookie_store_ios.mm View 1 2 3 4 5 6 7 8 9 10 11 19 chunks +73 lines, -73 lines 0 comments Download
M ios/net/cookies/cookie_store_ios_persistent.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -14 lines 0 comments Download
M ios/net/cookies/cookie_store_ios_persistent.mm View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +34 lines, -30 lines 0 comments Download
M ios/net/cookies/cookie_store_ios_persistent_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -3 lines 0 comments Download
M ios/net/cookies/cookie_store_ios_test_util.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M ios/net/cookies/cookie_store_ios_test_util.mm View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M ios/net/cookies/cookie_store_ios_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -2 lines 0 comments Download
M net/cookies/cookie_monster.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +17 lines, -19 lines 0 comments Download
M net/cookies/cookie_monster.cc View 1 2 3 4 5 6 7 8 9 10 11 12 29 chunks +106 lines, -101 lines 2 comments Download
M net/cookies/cookie_monster_store_test.h View 2 chunks +2 lines, -2 lines 0 comments Download
M net/cookies/cookie_monster_store_test.cc View 2 chunks +6 lines, -4 lines 0 comments Download
M net/cookies/cookie_monster_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -4 lines 0 comments Download
M net/cookies/cookie_store.h View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +38 lines, -38 lines 0 comments Download
M net/cookies/cookie_store.cc View 1 chunk +6 lines, -6 lines 0 comments Download
M net/cookies/cookie_store_test_helpers.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +17 lines, -19 lines 0 comments Download
M net/cookies/cookie_store_test_helpers.cc View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +27 lines, -26 lines 0 comments Download
M net/extras/sqlite/sqlite_persistent_cookie_store.h View 1 chunk +1 line, -1 line 0 comments Download
M net/extras/sqlite/sqlite_persistent_cookie_store.cc View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +16 lines, -16 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 81 (67 generated)
tzik
On 2017/06/17 21:39:07, commit-bot: I haz the power wrote: > Dry run: Try jobs failed ...
3 years, 6 months ago (2017-06-19 02:18:13 UTC) #58
Ryan Sleevi
LGTM. I tried to refrain from noting too many odd things in this CL, but ...
3 years, 6 months ago (2017-06-19 07:34:06 UTC) #64
kinuko
Drive-by (just saw this on net-dev and took a look to learn some) https://codereview.chromium.org/2937963003/diff/240001/net/cookies/cookie_monster.cc File ...
3 years, 6 months ago (2017-06-19 10:52:08 UTC) #65
Randy Smith (Not in Mondays)
Thanks, all! A quick meta-comment, which is that I think a lot of time could ...
3 years, 6 months ago (2017-06-21 17:54:53 UTC) #66
Randy Smith (Not in Mondays)
Now seeking owners stamps: * android_webview: sgurun@ * chrome/browser/browsing_data: mkwst@ * chrome/browser/extensions/api/cookies: rdevlin.cronin@ * content/browser/net: ...
3 years, 6 months ago (2017-06-21 18:00:09 UTC) #68
Mike West
Thanks, this is valuable cleanup. chrome/browser/browsing_data and chrome/browser/extensions/api/cookies LGTM. I agree with kinuko@'s suggestion above, ...
3 years, 6 months ago (2017-06-21 18:15:26 UTC) #69
Devlin
On 2017/06/21 18:00:09, Randy Smith (Not in Mondays) wrote: > Now seeking owners stamps: > ...
3 years, 6 months ago (2017-06-21 18:17:14 UTC) #70
sgurun-gerrit only
On 2017/06/21 18:17:14, Devlin wrote: > On 2017/06/21 18:00:09, Randy Smith (Not in Mondays) wrote: ...
3 years, 6 months ago (2017-06-21 21:27:24 UTC) #71
alex clarke (OOO till 29th)
headless/ LGTM
3 years, 6 months ago (2017-06-21 21:38:37 UTC) #72
kinuko
I can stamp for content/browser/net then :) (don't we have owners file there?) - lgtm
3 years, 6 months ago (2017-06-22 00:28:18 UTC) #73
Randy Smith (Not in Mondays)
On 2017/06/22 00:28:18, kinuko wrote: > I can stamp for content/browser/net then :) (don't we ...
3 years, 6 months ago (2017-06-22 15:30:04 UTC) #74
droger
lgtm
3 years, 6 months ago (2017-06-22 15:37:10 UTC) #76
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2937963003/240001
3 years, 6 months ago (2017-06-22 15:43:53 UTC) #78
commit-bot: I haz the power
3 years, 6 months ago (2017-06-22 17:10:15 UTC) #81
Message was sent while issue was closed.
Committed patchset #13 (id:240001) as
https://chromium.googlesource.com/chromium/src/+/7ac8171e75097750531a69f5eadf...

Powered by Google App Engine
This is Rietveld 408576698