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

Issue 2489113002: Remove stl_util's deletion functions from MojoHostResolverImpl. (Closed)

Created:
4 years, 1 month ago by davidben
Modified:
4 years ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove stl_util's deletion functions from MojoHostResolverImpl. //net has many instances where a service object owns a set of Jobs on behalf of consumers. Previously, a manually owned std::set<Job*> was used. Some fixes have included: - std::find_if on the std::set<std::unique_ptr<Job>>. This is the worst of both worlds as it keeps std::set's overhead without ever getting the asymptotics from it. - std::map<Job*, std::unique_ptr<Job>>. This is comparable to the original scheme, but there have been concerns about cache locality. - std::find_if on a std::vector<std::unique_ptr<Job>>. This has good cache locality, but does not scale as the number of requests go up. Starting from first principles, the ideal structure here would be an intrusive linked list, so a Job can remove itself on completion. This avoids extra allocations of intermediate nodes in the std::map and even has better asymptotics than the std::set. The STL doesn't quite provide intrusive containers, but C++11 lets us get pretty close. If we use a std::list<Job> (note no pointer) and only add to the list via emplacement, Jobs need not be copyable and we embed the std::list pointers inside the Job object. However we need to store an extra member in the Job so it can find its own iterator. (This iterator should ultimately be a pointer back to the struct embedding the Job anyway.) BUG=555865 Committed: https://crrev.com/86a6788070f1872e7136d6c1ebe0a0d35e4a2e1c Cr-Commit-Position: refs/heads/master@{#437375}

Patch Set 1 #

Total comments: 4

Patch Set 2 : add missing include, rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -16 lines) Patch
M net/dns/mojo_host_resolver_impl.h View 1 3 chunks +5 lines, -5 lines 0 comments Download
M net/dns/mojo_host_resolver_impl.cc View 8 chunks +17 lines, -11 lines 0 comments Download

Messages

Total messages: 21 (11 generated)
davidben
4 years, 1 month ago (2016-11-09 22:22:24 UTC) #4
davidben
I should mention that, although std::list does allocate a separate node for each entry, anything ...
4 years, 1 month ago (2016-11-09 22:29:53 UTC) #5
Avi (use Gerrit)
lgtm I'd be good with this.
4 years, 1 month ago (2016-11-09 23:04:09 UTC) #6
mmenke
LGTM, some completely optional suggestions. Sorry I didn't get to this yesterday. https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.cc File net/dns/mojo_host_resolver_impl.cc ...
4 years, 1 month ago (2016-11-11 16:15:25 UTC) #10
mmenke
https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h File net/dns/mojo_host_resolver_impl.h (right): https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h#newcode8 net/dns/mojo_host_resolver_impl.h:8: #include <list> While you're here, mind adding <memory>?
4 years, 1 month ago (2016-11-11 16:18:04 UTC) #11
Avi (use Gerrit)
On 2016/11/11 16:18:04, mmenke wrote: > https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h > File net/dns/mojo_host_resolver_impl.h (right): > > https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h#newcode8 > ...
4 years, 1 month ago (2016-11-22 16:59:53 UTC) #12
davidben
https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h File net/dns/mojo_host_resolver_impl.h (right): https://codereview.chromium.org/2489113002/diff/1/net/dns/mojo_host_resolver_impl.h#newcode8 net/dns/mojo_host_resolver_impl.h:8: #include <list> On 2016/11/11 16:18:03, mmenke wrote: > While ...
4 years ago (2016-12-08 21:12:02 UTC) #13
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/2489113002/20001
4 years ago (2016-12-08 21:13:57 UTC) #16
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years ago (2016-12-08 22:43:43 UTC) #19
commit-bot: I haz the power
4 years ago (2016-12-08 22:46:36 UTC) #21
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/86a6788070f1872e7136d6c1ebe0a0d35e4a2e1c
Cr-Commit-Position: refs/heads/master@{#437375}

Powered by Google App Engine
This is Rietveld 408576698