|
|
Chromium Code Reviews|
Created:
4 years, 2 months ago by Avi (use Gerrit) Modified:
4 years, 1 month ago Reviewers:
sky CC:
chromium-reviews Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionRemove stl_util's deletion function use from components/history/.
BUG=555865
Committed: https://crrev.com/53aeef9b765f032230f359efc5455dd77e0e188b
Cr-Commit-Position: refs/heads/master@{#427123}
Patch Set 1 #
Total comments: 4
Messages
Total messages: 15 (7 generated)
The CQ bit was checked by avi@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...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
avi@chromium.org changed reviewers: + sky@chromium.org
Oh, you own history! Have at it.
https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... File components/history/core/browser/web_history_service.h (right): https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... components/history/core/browser/web_history_service.h:216: std::map<Request*, std::unique_ptr<Request>> pending_expire_requests_; Using a map purely for the ownership is bizarre. Can you instead use a custom comparison function?
https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... File components/history/core/browser/web_history_service.h (right): https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... components/history/core/browser/web_history_service.h:216: std::map<Request*, std::unique_ptr<Request>> pending_expire_requests_; On 2016/10/24 16:04:10, sky wrote: > Using a map purely for the ownership is bizarre. Can you instead use a custom > comparison function? It's not about comparison functions. In general, I convert to map<pointer, owned pointer> because I've gotten feedback that people don't like losing logarithmic lookup. I can switch to a set, and use find_if if that isn't an issue. The real tricky thing is that you can't extract ownership from the set once you give it to the set. So I'd have to rewrite the functions that do the removal to move the set element deletion to be the last thing. In this case I don't believe it would matter.
LGTM https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... File components/history/core/browser/web_history_service.h (right): https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... components/history/core/browser/web_history_service.h:216: std::map<Request*, std::unique_ptr<Request>> pending_expire_requests_; On 2016/10/24 16:09:01, Avi wrote: > On 2016/10/24 16:04:10, sky wrote: > > Using a map purely for the ownership is bizarre. Can you instead use a custom > > comparison function? > > It's not about comparison functions. > > In general, I convert to map<pointer, owned pointer> because I've gotten > feedback that people don't like losing logarithmic lookup. I can switch to a > set, and use find_if if that isn't an issue. > > The real tricky thing is that you can't extract ownership from the set once you > give it to the set. So I'd have to rewrite the functions that do the removal to > move the set element deletion to be the last thing. In this case I don't believe > it would matter. I was hoping a comparison function would give the logarithmic lookup time. But that would require searches to be done by placing the pointer in a unique_ptr, then doing the search. Which isn't really what you want, and is easy to get wrong (have to be careful to remove the pointer from the unique_ptr after the search). It seems to me trying to use stl containers with unique_ptr to enforce ownership is quirky... Was there ever a discussion of stl containers with unique_ptrs on chromium-dev? I'll approve this since this appears to be the path we're going down, but I think we should consider ways to address the need of containers that own their contents without the quirks that stl + unique_ptr gives you.
https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... File components/history/core/browser/web_history_service.h (right): https://codereview.chromium.org/2441223002/diff/1/components/history/core/bro... components/history/core/browser/web_history_service.h:216: std::map<Request*, std::unique_ptr<Request>> pending_expire_requests_; There was a thread on cxx (https://groups.google.com/a/chromium.org/d/msg/cxx/xJpM3J_gpZY/-EA_DuGdCwAJ) but there were no solid conclusions.
The CQ bit was checked by avi@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.
Committed patchset #1 (id:1)
Message was sent while issue was closed.
Description was changed from ========== Remove stl_util's deletion function use from components/history/. BUG=555865 ========== to ========== Remove stl_util's deletion function use from components/history/. BUG=555865 Committed: https://crrev.com/53aeef9b765f032230f359efc5455dd77e0e188b Cr-Commit-Position: refs/heads/master@{#427123} ==========
Message was sent while issue was closed.
Patchset 1 (id:??) landed as https://crrev.com/53aeef9b765f032230f359efc5455dd77e0e188b Cr-Commit-Position: refs/heads/master@{#427123} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
