-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bookmarks model not loaded #4588
Conversation
Here is a way how to emulate such case.
Test planPrepare a build with a patch introducing delay in bookmarks loading ^^^ . Start a new sync chain
Connect to existing sync chain
Sync is running after the browser restart
Sync successfully sends the bookmarked site at early point
|
e23b7ca
to
e71adea
Compare
// Methods to run specified actions right after bookmark model was loaded | ||
void RunWhenModelIsLoaded(base::OnceCallback<void()> fn, | ||
const std::string& fn_name); | ||
void CtorBkmLoaded(Profile* profile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't abbreviate things like this in method names. We should use the same terminology everywhere for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, now this is fixed
@@ -280,6 +357,14 @@ void BraveProfileSyncServiceImpl::OnSetupSyncNewToSync( | |||
|
|||
brave_sync_initializing_ = true; | |||
|
|||
RunWhenModelIsLoaded( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about running parts of these methods, but not completing them. I think it's likely to introduce subtle bugs. I think it would be better to just wait on everything so we'd have OnSetupSyncNewToSync
that would call OnSetupSyncNewToSyncImpl
when the bookmark model is loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, now this is redone at 361b930
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks really dangerous to me in terms of introducing new race conditions. I think we need to preserve the order of operations in their entirety instead of piecemeal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except some leftovers, otherwise looks good to me. Please squash some commits if necessary
@@ -826,6 +826,20 @@ TEST_F(BraveSyncServiceTest, OnSyncReadyNewToSync) { | |||
EXPECT_TRUE(profile()->GetPrefs()->GetBoolean(syncer::prefs::kSyncBookmarks)); | |||
} | |||
|
|||
TEST_F(BraveSyncServiceTest, OnSyncReadyModelNotYetLoaded) { | |||
EXPECT_NE(sync_service()->model_, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have better way to test if model is truly loaded not just nullptr
see components/bookmarks/test/test_bookmark_client.cc
, we can have our own create method but not calling DoneLoading
and then after calling OnSyncReady
, we call DoneLoading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thanks for the advise, will redo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redone, though I had to add patch to access private BookmarkModel::DoneLoading
.
cc @bridiver
25ef9c4
to
8e4b6c5
Compare
Updated tests and rebased. |
3f7b8f6
to
30342eb
Compare
CI failed for iOS
|
Have failed tests on CI
|
30342eb
to
6dbf658
Compare
a837357
to
36acb17
Compare
@bridiver , I have addressed your comments, could please re-review? |
CI failed because of version mismatch though version in b-c was correct; deleted branch |
|
36acb17
to
c73e829
Compare
Pushed fix for crashed tests. @bridiver could you look on that please, as this fix reverts on of your review notices, now we check again, whether the observer was set before remove. |
failed iOS build with
failed linux browser test
failed MacOS build
|
c73e829
to
6a5794a
Compare
6a5794a
to
0b659f2
Compare
CI failed because could not apply patch to version, maybe correct chromium src dir wasn't fetched.
removed b-b branch and rebased |
Resolves brave/brave-browser#8178
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
See in comments below
Reviewer Checklist:
After-merge Checklist:
changes has landed on.