|
|
Chromium Code Reviews|
Created:
4 years, 2 months ago by vakh (use Gerrit instead) Modified:
4 years, 2 months ago Reviewers:
Scott Hess - ex-Googler CC:
chromium-reviews, vakh+watch_chromium.org, Nathan Parker Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionDestroy store on task runner. That's where all store operations happen.
BUG=656215, 656005
Committed: https://crrev.com/b8eecb024bdb6569e20e5fd93af9027a3a6a75ee
Cr-Commit-Position: refs/heads/master@{#426077}
Patch Set 1 #
Total comments: 3
Patch Set 2 : shess@feedback. WaitForTasksOnTaskRunner at the end of the test that calls ApplyUpdate and expects … #
Depends on Patchset: Messages
Total messages: 25 (14 generated)
The CQ bit was checked by vakh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
vakh@chromium.org changed reviewers: + shess@chromium.org
LGTM, minor suggestion you can ignore if you don't agree. https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... components/safe_browsing_db/v4_database.cc:146: (*store_map_)[identifier] = std::move(new_store); Does this work? I mean, I think it probably does, but I'm having troubles describing how. I'll just throw this out there, but leave it in your hands whether you want to go there: std::swap((*store_map_)[identifier], new_store); if (new_store) { V4Store::Destroy(std::move(new_store)); } Of course, abusing new_store as temp storage like this is optional, and I haven't read Destroy() yet to see if that's where the null handling should be. https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... File components/safe_browsing_db/v4_store.cc (right): https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... components/safe_browsing_db/v4_store.cc:214: } OK, yeah, same pattern as V4Database, makes sense.
https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... components/safe_browsing_db/v4_database.cc:146: (*store_map_)[identifier] = std::move(new_store); On 2016/10/18 02:57:01, Scott Hess wrote: > std::swap((*store_map_)[identifier], new_store); Or, of course: (*store_map_)[identifier].swap(new_store);
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
On 2016/10/18 02:57:55, Scott Hess wrote: > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > File components/safe_browsing_db/v4_database.cc (right): > > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > components/safe_browsing_db/v4_database.cc:146: (*store_map_)[identifier] = > std::move(new_store); > On 2016/10/18 02:57:01, Scott Hess wrote: > > std::swap((*store_map_)[identifier], new_store); > > Or, of course: > > (*store_map_)[identifier].swap(new_store); The next line, as you mentioned, would be: V4Store::Destroy(std::move(new_store)); I agree that this approach looks attractive (fewer lines of code), but I think calling Destroy on the new_store (which by then is the old store) seems counter-intuitive. I feel that the current patch is more readable because the reader doesn't see anything they don't expect.
Description was changed from ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005, 543161 ========== to ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005 ==========
On 2016/10/18 20:10:27, vakh (Varun Khaneja) wrote: > On 2016/10/18 02:57:55, Scott Hess wrote: > > > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > > File components/safe_browsing_db/v4_database.cc (right): > > > > > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > > components/safe_browsing_db/v4_database.cc:146: (*store_map_)[identifier] = > > std::move(new_store); > > On 2016/10/18 02:57:01, Scott Hess wrote: > > > std::swap((*store_map_)[identifier], new_store); > > > > Or, of course: > > > > (*store_map_)[identifier].swap(new_store); > > The next line, as you mentioned, would be: > V4Store::Destroy(std::move(new_store)); > > I agree that this approach looks attractive (fewer lines of code), but I think > calling Destroy on the new_store (which by then is the old store) seems > counter-intuitive. I feel that the current patch is more readable because the > reader doesn't see anything they don't expect. Yeah, maybe I'm just having cognitive dissonance WRT move semantics. Having the indeterminate state living in the store_map_ bothers me more than having it live in a scoped variable, though they are the same thing in the end when exceptions are disabled.
shess@feedback. WaitForTasksOnTaskRunner at the end of the test that calls ApplyUpdate and expects new stores since the old stores would get deleted later.
The CQ bit was checked by vakh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/10/18 20:19:19, Scott Hess wrote: > On 2016/10/18 20:10:27, vakh (Varun Khaneja) wrote: > > On 2016/10/18 02:57:55, Scott Hess wrote: > > > > > > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > > > File components/safe_browsing_db/v4_database.cc (right): > > > > > > > > > https://codereview.chromium.org/2425703004/diff/1/components/safe_browsing_db... > > > components/safe_browsing_db/v4_database.cc:146: (*store_map_)[identifier] = > > > std::move(new_store); > > > On 2016/10/18 02:57:01, Scott Hess wrote: > > > > std::swap((*store_map_)[identifier], new_store); > > > > > > Or, of course: > > > > > > (*store_map_)[identifier].swap(new_store); > > > > The next line, as you mentioned, would be: > > V4Store::Destroy(std::move(new_store)); > > > > I agree that this approach looks attractive (fewer lines of code), but I think > > calling Destroy on the new_store (which by then is the old store) seems > > counter-intuitive. I feel that the current patch is more readable because the > > reader doesn't see anything they don't expect. > > Yeah, maybe I'm just having cognitive dissonance WRT move semantics. Having the > indeterminate state living in the store_map_ bothers me more than having it live > in a scoped variable, though they are the same thing in the end when exceptions > are disabled. Fair enough. I'm convinced. I've uploaded a new patch. It also fixes the asan failures. Thanks.
The CQ bit was checked by vakh@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from shess@chromium.org Link to the patchset: https://codereview.chromium.org/2425703004/#ps20001 (title: "shess@feedback. WaitForTasksOnTaskRunner at the end of the test that calls ApplyUpdate and expects …")
The CQ bit was unchecked by commit-bot@chromium.org
This CL has an open dependency (Issue 2427863002 Patch 20001). Please resolve the dependency and try again. If you are sure that there is no real dependency, please use one of the options listed in https://goo.gl/9Es4OR to land the CL.
The CQ bit was checked by vakh@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005 ========== to ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005 ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Description was changed from ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005 ========== to ========== Destroy store on task runner. That's where all store operations happen. BUG=656215, 656005 Committed: https://crrev.com/b8eecb024bdb6569e20e5fd93af9027a3a6a75ee Cr-Commit-Position: refs/heads/master@{#426077} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/b8eecb024bdb6569e20e5fd93af9027a3a6a75ee Cr-Commit-Position: refs/heads/master@{#426077} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
