Track buffer lines memory

This commit is contained in:
Maxime Coste 2015-01-10 12:56:09 +00:00
parent 9f9156a752
commit 9adb97ea28

View File

@ -167,15 +167,16 @@ private:
void on_option_changed(const Option& option) override; void on_option_changed(const Option& option) override;
struct LineList : std::vector<InternedString> using LineListBase = Vector<InternedString, MemoryDomain::BufferContent>;
struct LineList : LineListBase
{ {
[[gnu::always_inline]] [[gnu::always_inline]]
InternedString& operator[](LineCount line) InternedString& operator[](LineCount line)
{ return std::vector<InternedString>::operator[]((int)line); } { return LineListBase::operator[]((int)line); }
[[gnu::always_inline]] [[gnu::always_inline]]
const InternedString& operator[](LineCount line) const const InternedString& operator[](LineCount line) const
{ return std::vector<InternedString>::operator[]((int)line); } { return LineListBase::operator[]((int)line); }
}; };
LineList m_lines; LineList m_lines;
@ -189,16 +190,17 @@ private:
using UndoGroup = std::vector<Modification>; using UndoGroup = std::vector<Modification>;
friend class UndoGroupOptimizer; friend class UndoGroupOptimizer;
std::vector<UndoGroup> m_history; using History = Vector<UndoGroup, MemoryDomain::BufferMeta>;
std::vector<UndoGroup>::iterator m_history_cursor; History m_history;
UndoGroup m_current_undo_group; History::iterator m_history_cursor;
UndoGroup m_current_undo_group;
void apply_modification(const Modification& modification); void apply_modification(const Modification& modification);
void revert_modification(const Modification& modification); void revert_modification(const Modification& modification);
size_t m_last_save_undo_index; size_t m_last_save_undo_index;
std::vector<Change> m_changes; Vector<Change, MemoryDomain::BufferMeta> m_changes;
time_t m_fs_timestamp; time_t m_fs_timestamp;