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

Issue 1154923003: Fixing an edge case in CRWBrowsingDataStore (Closed)

Created:
5 years, 6 months ago by shreyasv1
Modified:
5 years, 2 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fixing an edge case in CRWBrowsingDataStore Edge case: When there are consecutive makeActive and makeInactive calls and the operations finish fast, each of the callbacks that they receive lead to the changing of the CRWBrowsingDataStore's mode. This can lead to a jarring API as the mode changes frequently when callbacks are received. The correct behavior is to have the mode in |SYNCHRONIZING| until all the callbacks are received. When consecutive |makeActive|, |makeInactive| calls are received, the mode has to change like so: ACTIVE/INACTIVE -> SYNCHRONIZING -> INACTIVE/ACTIVE. The state of pending callbacks is now tracked using an ivar in the .mm The completionHandler API is also vastly improved as a result. The completionHandler now returns a BOOL that indicates if the operation was successful. This is inspired from the |UIView animateWithDuration:|. If multiple |makeActive|, |makeInactive| calls are driven. The completionHandler of all but the last one (incl. the penultimate one) are called with a success=NO. The last completionHandler is the actual one that changes the mode of the CRWBrowsingDataStore and is called with a success=YES. There is a need to override |automaticallyNotifiesObserversForKey| because the default KVO behavior is to call the observer methods even though the internal ivar may not have changed. This affects CRWBrowsingDataStore because a call to setMode:SYNCHRONIZING even though the mode is already SYNCHRONIZING will trigger an observer notification. We want to finely control this observer notification since BrowsingDataPartition will listen to this (in a future CL) and will maintain state accordingly. It will lead to simpler logic in BrowsingDataParition if the observer is notified only when the mode actually changes. An example of an observer is included in the unittest. BUG=480654 Committed: https://crrev.com/c426d7e90a927cf77347d1817fa72b97bc59b1eb Cr-Commit-Position: refs/heads/master@{#332239}

Patch Set 1 #

Patch Set 2 : y #

Total comments: 15

Patch Set 3 : y #

Total comments: 2

Patch Set 4 : y #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -44 lines) Patch
M ios/web/crw_browsing_data_store.mm View 1 2 3 6 chunks +74 lines, -22 lines 0 comments Download
M ios/web/crw_browsing_data_store_unittest.mm View 1 2 3 4 chunks +70 lines, -12 lines 0 comments Download
M ios/web/public/crw_browsing_data_store.h View 1 2 3 1 chunk +15 lines, -10 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
shreyasv1
5 years, 6 months ago (2015-05-29 19:54:38 UTC) #2
Eugene But (OOO till 7-30)
https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm File ios/web/crw_browsing_data_store.mm (right): https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm#newcode207 ios/web/crw_browsing_data_store.mm:207: DCHECK(!_numberOfPendingStashOrRestoreOperations); Optional NIT: s/_numberOfPendingStashOrRestoreOperations/self.numberOfPendingStashOrRestoreOperations For consistency https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm#newcode248 ios/web/crw_browsing_data_store.mm:248: if ...
5 years, 6 months ago (2015-05-29 21:14:26 UTC) #3
shreyasv1
https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm File ios/web/crw_browsing_data_store.mm (right): https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm#newcode207 ios/web/crw_browsing_data_store.mm:207: DCHECK(!_numberOfPendingStashOrRestoreOperations); On 2015/05/29 21:14:26, eugenebut wrote: > Optional NIT: ...
5 years, 6 months ago (2015-05-29 22:22:57 UTC) #4
Eugene But (OOO till 7-30)
lgtm, please go ahead and implement finalizeChangeToMode:callCompletionHandler: or finalizeChangeToMode:andCallCompletionHandler: https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm File ios/web/crw_browsing_data_store.mm (right): https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm#newcode248 ios/web/crw_browsing_data_store.mm:248: ...
5 years, 6 months ago (2015-05-29 22:38:29 UTC) #5
shreyasv1
https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm File ios/web/crw_browsing_data_store.mm (right): https://codereview.chromium.org/1154923003/diff/20001/ios/web/crw_browsing_data_store.mm#newcode248 ios/web/crw_browsing_data_store.mm:248: if (completionHandler) { On 2015/05/29 22:38:28, eugenebut wrote: > ...
5 years, 6 months ago (2015-06-01 18:31:54 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1154923003/60001
5 years, 6 months ago (2015-06-01 18:33:06 UTC) #9
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 6 months ago (2015-06-01 19:29:14 UTC) #10
commit-bot: I haz the power
5 years, 6 months ago (2015-06-01 19:30:15 UTC) #11
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/c426d7e90a927cf77347d1817fa72b97bc59b1eb
Cr-Commit-Position: refs/heads/master@{#332239}

Powered by Google App Engine
This is Rietveld 408576698