Today we use a const std::vector<SavePageItem>&, which might force more copies than necessary. Instead, we could use an approach based on std::move, so that only one copy is made.
However, initial investigations show that it is difficult to make it work with base::Bind() even using the Passed() wrapper.
If wre try to use const vector, it fails because you can't std::move out of a const vector, since std::move modifies the place you are moving from.
However, base::Bind seems to require a const parameter. Maybe
that makes sense, because it is getting passed among threads, and base::Bind wants to make sure it doesn't get changed out from under the callback while it is passing it along different theads.
So, it looks like the combination of trying to do std::move and
base::Bind is a bad one.
So, Bind should provide some workaround for us - Passed()? Owned()?
Passed(std::move(mytype)) is failing to copy a non-const vector
onto a vector deep inside.
bind_unittest.cc seems to show this as possible, but mimicking it
doesn't let me compile.
Maybe try a smart pointer with a vector of SavePageResult?
Comment 1 by bauerb@chromium.org
, Sep 7 2016Status: Assigned (was: Untriaged)