forked from premiere/premiere-libtorrent
move the file priority vector throught the disk_io_job, to avoid copies
This commit is contained in:
parent
e45df614fe
commit
2ba0e5ae2c
|
@ -172,7 +172,7 @@ namespace libtorrent {
|
||||||
, std::function<void(storage_error const&)> handler) = 0;
|
, std::function<void(storage_error const&)> handler) = 0;
|
||||||
virtual void async_set_file_priority(storage_index_t storage
|
virtual void async_set_file_priority(storage_index_t storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prio
|
, aux::vector<download_priority_t, file_index_t> prio
|
||||||
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler) = 0;
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t>)> handler) = 0;
|
||||||
|
|
||||||
virtual void async_clear_piece(storage_index_t storage, piece_index_t index
|
virtual void async_clear_piece(storage_index_t storage, piece_index_t index
|
||||||
, std::function<void(piece_index_t)> handler) = 0;
|
, std::function<void(piece_index_t)> handler) = 0;
|
||||||
|
|
|
@ -138,7 +138,7 @@ namespace libtorrent {
|
||||||
using check_handler = std::function<void(status_t, storage_error const&)>;
|
using check_handler = std::function<void(status_t, storage_error const&)>;
|
||||||
using rename_handler = std::function<void(std::string, file_index_t, storage_error const&)>;
|
using rename_handler = std::function<void(std::string, file_index_t, storage_error const&)>;
|
||||||
using clear_piece_handler = std::function<void(piece_index_t)>;
|
using clear_piece_handler = std::function<void(piece_index_t)>;
|
||||||
using set_file_prio_handler = std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)>;
|
using set_file_prio_handler = std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t>)>;
|
||||||
|
|
||||||
boost::variant<read_handler
|
boost::variant<read_handler
|
||||||
, write_handler
|
, write_handler
|
||||||
|
|
|
@ -330,7 +330,7 @@ namespace aux {
|
||||||
, std::function<void()> handler = std::function<void()>()) override;
|
, std::function<void()> handler = std::function<void()>()) override;
|
||||||
void async_set_file_priority(storage_index_t storage
|
void async_set_file_priority(storage_index_t storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prio
|
, aux::vector<download_priority_t, file_index_t> prio
|
||||||
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler) override;
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t>)> handler) override;
|
||||||
|
|
||||||
void async_clear_piece(storage_index_t storage, piece_index_t index
|
void async_clear_piece(storage_index_t storage, piece_index_t index
|
||||||
, std::function<void(piece_index_t)> handler) override;
|
, std::function<void(piece_index_t)> handler) override;
|
||||||
|
|
|
@ -569,7 +569,7 @@ namespace libtorrent {
|
||||||
void set_file_priority(file_index_t index, download_priority_t priority);
|
void set_file_priority(file_index_t index, download_priority_t priority);
|
||||||
download_priority_t file_priority(file_index_t index) const;
|
download_priority_t file_priority(file_index_t index) const;
|
||||||
|
|
||||||
void on_file_priority(storage_error const& err, aux::vector<download_priority_t, file_index_t> const& prios);
|
void on_file_priority(storage_error const& err, aux::vector<download_priority_t, file_index_t> prios);
|
||||||
void prioritize_files(aux::vector<download_priority_t, file_index_t> const& files);
|
void prioritize_files(aux::vector<download_priority_t, file_index_t> const& files);
|
||||||
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace libtorrent {
|
||||||
void operator()(disk_io_job::set_file_prio_handler& h) const
|
void operator()(disk_io_job::set_file_prio_handler& h) const
|
||||||
{
|
{
|
||||||
if (!h) return;
|
if (!h) return;
|
||||||
h(m_job.error, boost::get<aux::vector<download_priority_t, file_index_t>>(m_job.argument));
|
h(m_job.error, std::move(boost::get<aux::vector<download_priority_t, file_index_t>>(m_job.argument)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1920,7 +1920,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
|
||||||
|
|
||||||
void disk_io_thread::async_set_file_priority(storage_index_t const storage
|
void disk_io_thread::async_set_file_priority(storage_index_t const storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prios
|
, aux::vector<download_priority_t, file_index_t> prios
|
||||||
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler)
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t>)> handler)
|
||||||
{
|
{
|
||||||
disk_io_job* j = allocate_job(job_action_t::file_priority);
|
disk_io_job* j = allocate_job(job_action_t::file_priority);
|
||||||
j->storage = m_torrents[storage]->shared_from_this();
|
j->storage = m_torrents[storage]->shared_from_this();
|
||||||
|
|
|
@ -5041,12 +5041,12 @@ bool is_downloading_state(int const st)
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::on_file_priority(storage_error const& err
|
void torrent::on_file_priority(storage_error const& err
|
||||||
, aux::vector<download_priority_t, file_index_t> const& prios)
|
, aux::vector<download_priority_t, file_index_t> prios)
|
||||||
{
|
{
|
||||||
COMPLETE_ASYNC("file_priority");
|
COMPLETE_ASYNC("file_priority");
|
||||||
if (m_file_priority != prios)
|
if (m_file_priority != prios)
|
||||||
{
|
{
|
||||||
m_file_priority = prios;
|
m_file_priority = std::move(prios);
|
||||||
update_piece_priorities();
|
update_piece_priorities();
|
||||||
if (m_share_mode)
|
if (m_share_mode)
|
||||||
recalc_share_mode();
|
recalc_share_mode();
|
||||||
|
|
Loading…
Reference in New Issue