mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Notify UserData that view state should be preserved.
This is only active when a trace is loaded from a file (and state should be persistent for future sessions using this trace), or when state is saved to a file (so that future sessions will use current state). No state is preserved by default, i.e. when the trace was not saved to a file.
This commit is contained in:
parent
949c9cb121
commit
dc5444ff0f
@ -10,6 +10,7 @@ namespace tracy
|
|||||||
constexpr auto FileDescription = "description";
|
constexpr auto FileDescription = "description";
|
||||||
|
|
||||||
UserData::UserData()
|
UserData::UserData()
|
||||||
|
: m_preserveState( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,11 @@ bool UserData::SetDescription( const char* description )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserData::StateShouldBePreserved()
|
||||||
|
{
|
||||||
|
m_preserveState = true;
|
||||||
|
}
|
||||||
|
|
||||||
FILE* UserData::OpenFile( const char* filename, bool write )
|
FILE* UserData::OpenFile( const char* filename, bool write )
|
||||||
{
|
{
|
||||||
const auto path = GetSavePath( m_program.c_str(), m_time, filename, write );
|
const auto path = GetSavePath( m_program.c_str(), m_time, filename, write );
|
||||||
|
@ -20,6 +20,8 @@ public:
|
|||||||
const std::string& GetDescription() const { return m_description; }
|
const std::string& GetDescription() const { return m_description; }
|
||||||
bool SetDescription( const char* description );
|
bool SetDescription( const char* description );
|
||||||
|
|
||||||
|
void StateShouldBePreserved();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* OpenFile( const char* filename, bool write );
|
FILE* OpenFile( const char* filename, bool write );
|
||||||
|
|
||||||
@ -27,6 +29,8 @@ private:
|
|||||||
uint64_t m_time;
|
uint64_t m_time;
|
||||||
|
|
||||||
std::string m_description;
|
std::string m_description;
|
||||||
|
|
||||||
|
bool m_preserveState;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,6 +148,7 @@ View::View( FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont,
|
|||||||
|
|
||||||
InitTextEditor();
|
InitTextEditor();
|
||||||
SetViewToLastFrames();
|
SetViewToLastFrames();
|
||||||
|
m_userData.StateShouldBePreserved();
|
||||||
}
|
}
|
||||||
|
|
||||||
View::~View()
|
View::~View()
|
||||||
@ -852,6 +853,7 @@ bool View::DrawConnection()
|
|||||||
}
|
}
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
|
m_userData.StateShouldBePreserved();
|
||||||
m_saveThreadState.store( SaveThreadState::Saving, std::memory_order_relaxed );
|
m_saveThreadState.store( SaveThreadState::Saving, std::memory_order_relaxed );
|
||||||
m_saveThread = std::thread( [this, f{std::move( f )}] {
|
m_saveThread = std::thread( [this, f{std::move( f )}] {
|
||||||
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );
|
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );
|
||||||
|
Loading…
Reference in New Issue
Block a user