Fixed issue where UI Responsive events were not fired (#603)
* Fixed the WindowIdLog so that it is updated when a new WindowCreated event is fired * Updated the windowidlog check in LogWindowCreated to use IsWindowIdInLog
This commit is contained in:
parent
60c5c39ee5
commit
8106691d7c
@ -163,7 +163,7 @@ void ApplicationViewModel::OnModeChanged()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TraceLogger::GetInstance().LogWindowCreated(m_mode);
|
TraceLogger::GetInstance().LogWindowCreated(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RaisePropertyChanged(ClearMemoryVisibilityPropertyName);
|
RaisePropertyChanged(ClearMemoryVisibilityPropertyName);
|
||||||
|
@ -104,25 +104,18 @@ namespace CalculatorApp
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
// return true if windowId is logged once else return false
|
// return true if windowId is logged once else return false
|
||||||
bool TraceLogger::UpdateWindowIdLog(int windowId)
|
bool TraceLogger::IsWindowIdInLog(int windowId)
|
||||||
{
|
{
|
||||||
// Writer lock for the windowIdLog resource
|
// Writer lock for the windowIdLog resource
|
||||||
reader_writer_lock::scoped_lock lock(s_traceLoggerLock);
|
reader_writer_lock::scoped_lock lock(s_traceLoggerLock);
|
||||||
|
|
||||||
if (windowIdLog.find(windowId) == windowIdLog.end())
|
if (find(windowIdLog.begin(), windowIdLog.end(), windowId) == windowIdLog.end())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (windowIdLog[windowId] == false)
|
|
||||||
{
|
|
||||||
windowIdLog[windowId] = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TraceLogger::LogVisualStateChanged(ViewMode mode, wstring_view state) const
|
void TraceLogger::LogVisualStateChanged(ViewMode mode, wstring_view state) const
|
||||||
{
|
{
|
||||||
@ -139,8 +132,14 @@ namespace CalculatorApp
|
|||||||
LogLevel2Event(EVENT_NAME_VISUAL_STATE_CHANGED, fields);
|
LogLevel2Event(EVENT_NAME_VISUAL_STATE_CHANGED, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceLogger::LogWindowCreated(ViewMode mode) const
|
void TraceLogger::LogWindowCreated(ViewMode mode, int windowId)
|
||||||
{
|
{
|
||||||
|
// store windowId in windowIdLog which says we have logged mode for the present windowId.
|
||||||
|
if (!IsWindowIdInLog(windowId))
|
||||||
|
{
|
||||||
|
windowIdLog.push_back(windowId);
|
||||||
|
}
|
||||||
|
|
||||||
if (!GetTraceLoggingProviderEnabled())
|
if (!GetTraceLoggingProviderEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ namespace CalculatorApp
|
|||||||
void LogButtonUsage();
|
void LogButtonUsage();
|
||||||
void LogDateCalculationModeUsed(bool AddSubtractMode);
|
void LogDateCalculationModeUsed(bool AddSubtractMode);
|
||||||
void UpdateWindowCount(size_t windowCount = 0);
|
void UpdateWindowCount(size_t windowCount = 0);
|
||||||
bool UpdateWindowIdLog(int windowId);
|
bool IsWindowIdInLog(int windowId);
|
||||||
void LogVisualStateChanged(CalculatorApp::Common::ViewMode mode, std::wstring_view state) const;
|
void LogVisualStateChanged(CalculatorApp::Common::ViewMode mode, std::wstring_view state) const;
|
||||||
void LogWindowCreated(CalculatorApp::Common::ViewMode mode) const;
|
void LogWindowCreated(CalculatorApp::Common::ViewMode mode, int windowId);
|
||||||
void LogConverterInputReceived(CalculatorApp::Common::ViewMode mode) const;
|
void LogConverterInputReceived(CalculatorApp::Common::ViewMode mode) const;
|
||||||
void LogNavBarOpened() const;
|
void LogNavBarOpened() const;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace CalculatorApp
|
|||||||
winrt::Windows::Foundation::Diagnostics::LoggingChannel g_calculatorProvider;
|
winrt::Windows::Foundation::Diagnostics::LoggingChannel g_calculatorProvider;
|
||||||
|
|
||||||
std::vector<ButtonLog> buttonLog;
|
std::vector<ButtonLog> buttonLog;
|
||||||
std::map<int, bool> windowIdLog;
|
std::vector<int> windowIdLog;
|
||||||
|
|
||||||
GUID sessionGuid;
|
GUID sessionGuid;
|
||||||
size_t currentWindowCount = 0;
|
size_t currentWindowCount = 0;
|
||||||
|
@ -135,7 +135,7 @@ void Calculator::OnLoaded(_In_ Object ^, _In_ RoutedEventArgs ^)
|
|||||||
WeakReference weakThis(this);
|
WeakReference weakThis(this);
|
||||||
this->Dispatcher->RunAsync(
|
this->Dispatcher->RunAsync(
|
||||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]() {
|
CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]() {
|
||||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
if (TraceLogger::GetInstance().IsWindowIdInLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||||
{
|
{
|
||||||
auto refThis = weakThis.Resolve<Calculator>();
|
auto refThis = weakThis.Resolve<Calculator>();
|
||||||
if (refThis != nullptr)
|
if (refThis != nullptr)
|
||||||
|
@ -251,7 +251,7 @@ void MainPage::OnPageLoaded(_In_ Object ^, _In_ RoutedEventArgs ^ args)
|
|||||||
// Delay load things later when we get a chance.
|
// Delay load things later when we get a chance.
|
||||||
this->Dispatcher->RunAsync(
|
this->Dispatcher->RunAsync(
|
||||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() {
|
CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() {
|
||||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
if (TraceLogger::GetInstance().IsWindowIdInLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||||
{
|
{
|
||||||
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
||||||
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
||||||
|
Loading…
Reference in New Issue
Block a user