Skip collecting change information when it isn't needed
This commit is contained in:
parent
e65ad4d413
commit
b5bd00005c
|
@ -161,14 +161,16 @@ void BackgroundCollection::set_table(Table const& table)
|
|||
|
||||
void BackgroundCollection::add_required_change_info(TransactionChangeInfo& info)
|
||||
{
|
||||
if (!do_add_required_change_info(info)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto max = *max_element(begin(m_relevant_tables), end(m_relevant_tables)) + 1;
|
||||
if (max > info.tables_needed.size())
|
||||
info.tables_needed.resize(max, false);
|
||||
for (auto table_ndx : m_relevant_tables) {
|
||||
info.tables_needed[table_ndx] = true;
|
||||
}
|
||||
|
||||
do_add_required_change_info(info);
|
||||
}
|
||||
|
||||
void BackgroundCollection::prepare_handover()
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
virtual void do_detach_from(SharedGroup&) = 0;
|
||||
virtual void do_prepare_handover(SharedGroup&) = 0;
|
||||
virtual bool do_deliver(SharedGroup&) { return true; }
|
||||
virtual void do_add_required_change_info(TransactionChangeInfo&) { }
|
||||
virtual bool do_add_required_change_info(TransactionChangeInfo&) { return true; }
|
||||
virtual bool should_deliver_initial() const noexcept { return false; }
|
||||
|
||||
const std::thread::id m_thread_id = std::this_thread::get_id();
|
||||
|
|
|
@ -69,11 +69,11 @@ void ListNotifier::do_detach_from(SharedGroup& sg)
|
|||
}
|
||||
}
|
||||
|
||||
void ListNotifier::do_add_required_change_info(TransactionChangeInfo& info)
|
||||
bool ListNotifier::do_add_required_change_info(TransactionChangeInfo& info)
|
||||
{
|
||||
REALM_ASSERT(!m_lv_handover);
|
||||
if (!m_lv) {
|
||||
return; // origin row was deleted after the notification was added
|
||||
return false; // origin row was deleted after the notification was added
|
||||
}
|
||||
|
||||
size_t row_ndx = m_lv->get_origin_row_index();
|
||||
|
@ -81,6 +81,7 @@ void ListNotifier::do_add_required_change_info(TransactionChangeInfo& info)
|
|||
info.lists.push_back({table.get_index_in_group(), row_ndx, m_col_ndx, &m_change});
|
||||
|
||||
m_info = &info;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ListNotifier::run()
|
||||
|
|
|
@ -54,7 +54,7 @@ private:
|
|||
void do_detach_from(SharedGroup& sg) override;
|
||||
|
||||
void release_data() noexcept override;
|
||||
void do_add_required_change_info(TransactionChangeInfo& info) override;
|
||||
bool do_add_required_change_info(TransactionChangeInfo& info) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,10 +71,11 @@ static bool map_moves(size_t& idx, CollectionChangeIndices const& changes)
|
|||
//
|
||||
// Separately from the handover data flow, m_target_results is guarded by the target lock
|
||||
|
||||
void ResultsNotifier::do_add_required_change_info(TransactionChangeInfo& info)
|
||||
bool ResultsNotifier::do_add_required_change_info(TransactionChangeInfo& info)
|
||||
{
|
||||
REALM_ASSERT(m_query);
|
||||
m_info = &info;
|
||||
return m_initial_run_complete && have_callbacks();
|
||||
}
|
||||
|
||||
void ResultsNotifier::run()
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
void run() override;
|
||||
void do_prepare_handover(SharedGroup&) override;
|
||||
bool do_deliver(SharedGroup& sg) override;
|
||||
void do_add_required_change_info(TransactionChangeInfo& info) override;
|
||||
bool do_add_required_change_info(TransactionChangeInfo& info) override;
|
||||
|
||||
void release_data() noexcept override;
|
||||
void do_attach_to(SharedGroup& sg) override;
|
||||
|
|
Loading…
Reference in New Issue