Skip to content

Commit b91b3ce

Browse files
author
reunion-maestro-bot
committed
Syncing content from committish e6d40aca3643d400bddd622870a3422ccbe5f27c
1 parent 3d10001 commit b91b3ce

File tree

11 files changed

+217
-71
lines changed

11 files changed

+217
-71
lines changed

controls/dev/ItemsView/ItemsView.cpp

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,42 +2083,32 @@ void ItemsView::SetItemsViewItemContainerRevokers(
20832083

20842084
itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, itemContainerRevokers.as<winrt::IInspectable>());
20852085

2086-
m_itemContainersWithRevokers.insert(tracker_ref<winrt::ItemContainer>{ this, itemContainer });
2086+
m_itemContainersWithRevokers.insert(itemContainer);
20872087
}
20882088

20892089
void ItemsView::ClearItemsViewItemContainerRevokers(
20902090
const winrt::ItemContainer& itemContainer)
20912091
{
2092-
const auto& itemContainerRef = tracker_ref<winrt::ItemContainer>{ this, itemContainer };
2093-
const auto& itemContainerSafe = itemContainerRef.safe_get();
2094-
if (itemContainerSafe)
2095-
{
2096-
RevokeItemsViewItemContainerRevokers(itemContainerSafe);
2097-
itemContainerSafe.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
2098-
}
2099-
const bool removed = static_cast<bool>(m_itemContainersWithRevokers.erase(itemContainerRef));
2100-
MUX_ASSERT(removed);
2092+
RevokeItemsViewItemContainerRevokers(itemContainer);
2093+
itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
2094+
m_itemContainersWithRevokers.erase(itemContainer);
21012095
}
21022096

21032097
void ItemsView::ClearAllItemsViewItemContainerRevokers() noexcept
21042098
{
2105-
for (const auto& itemContainerTracker : m_itemContainersWithRevokers)
2099+
for (const auto& itemContainer : m_itemContainersWithRevokers)
21062100
{
2107-
const auto& itemContainer = itemContainerTracker.safe_get();
21082101
// ClearAllItemsViewItemContainerRevokers is only called in the destructor, where exceptions cannot be thrown.
21092102
// If the associated ItemsView items have not yet been cleaned up, we must detach these revokers or risk a call into freed
21102103
// memory being made. However if they have been cleaned up these calls will throw. In this case we can ignore
21112104
// those exceptions.
2112-
if (itemContainer)
2105+
try
2106+
{
2107+
RevokeItemsViewItemContainerRevokers(itemContainer);
2108+
itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
2109+
}
2110+
catch (...)
21132111
{
2114-
try
2115-
{
2116-
RevokeItemsViewItemContainerRevokers(itemContainer);
2117-
itemContainer.SetValue(s_ItemsViewItemContainerRevokersProperty, nullptr);
2118-
}
2119-
catch (...)
2120-
{
2121-
}
21222112
}
21232113
}
21242114
m_itemContainersWithRevokers.clear();

controls/dev/ItemsView/ItemsView.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,5 +399,6 @@ class ItemsView :
399399
tracker_ref<winrt::UIElement> m_bringIntoViewElement{ this };
400400

401401
std::list<winrt::VirtualKey> m_navigationKeysToProcess;
402-
std::set<tracker_ref<winrt::ItemContainer>> m_itemContainersWithRevokers;
402+
std::set<winrt::ItemContainer> m_itemContainersWithRevokers;
403+
std::map<winrt::ItemContainer, std::shared_ptr<PointerInfo<ItemsView>>> m_itemContainersPointerInfos;
403404
};

controls/dev/NavigationView/NavigationView.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,7 @@ void NavigationView::SetNavigationViewItemBaseRevokers(const winrt::NavigationVi
34843484
auto nvibRevokers = winrt::make_self<NavigationViewItemBaseRevokers>();
34853485
nvibRevokers->visibilityRevoker = RegisterPropertyChanged(nvib, winrt::UIElement::VisibilityProperty(), { this, &NavigationView::OnNavigationViewItemBaseVisibilityPropertyChanged });
34863486
nvib.SetValue(s_NavigationViewItemBaseRevokersProperty, nvibRevokers.as<winrt::IInspectable>());
3487-
m_itemsWithRevokerObjects.insert(tracker_ref<winrt::NavigationViewItemBase>{ this, nvib });
3487+
m_itemsWithRevokerObjects.insert(nvib);
34883488
}
34893489

34903490
void NavigationView::SetNavigationViewItemRevokers(const winrt::NavigationViewItem& nvi)
@@ -3503,22 +3503,15 @@ void NavigationView::SetNavigationViewItemRevokers(const winrt::NavigationViewIt
35033503

35043504
void NavigationView::ClearNavigationViewItemBaseRevokers(const winrt::NavigationViewItemBase& nvib)
35053505
{
3506-
const auto& nvibRef = tracker_ref<winrt::NavigationViewItemBase>{ this, nvib };
3507-
const auto& nvibSafe = nvibRef.safe_get();
3508-
if (nvibSafe)
3509-
{
3510-
RevokeNavigationViewItemBaseRevokers(nvibSafe);
3511-
nvibSafe.SetValue(s_NavigationViewItemBaseRevokersProperty, nullptr);
3512-
}
3513-
const bool removed = static_cast<bool>(m_itemsWithRevokerObjects.erase(nvibRef));
3514-
MUX_ASSERT(removed);
3506+
RevokeNavigationViewItemBaseRevokers(nvib);
3507+
nvib.SetValue(s_NavigationViewItemBaseRevokersProperty, nullptr);
3508+
m_itemsWithRevokerObjects.erase(nvib);
35153509
}
35163510

35173511
void NavigationView::ClearAllNavigationViewItemBaseRevokers() noexcept
35183512
{
3519-
for (const auto& nvibTracker : m_itemsWithRevokerObjects)
3513+
for (const auto& nvib : m_itemsWithRevokerObjects)
35203514
{
3521-
const auto& nvib = nvibTracker.safe_get();
35223515
// ClearAllNavigationViewItemBaseRevokers is only called in the destructor, where exceptions cannot be thrown.
35233516
// If the associated NV has not yet been cleaned up, we must detach these revokers or risk a call into freed
35243517
// memory being made. However if they have been cleaned up these calls will throw. In this case we can ignore

controls/dev/NavigationView/NavigationView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class NavigationView :
194194
void ClearNavigationViewItemBaseRevokers(const winrt::NavigationViewItemBase& nvib);
195195
void ClearAllNavigationViewItemBaseRevokers() noexcept;
196196
void RevokeNavigationViewItemBaseRevokers(const winrt::NavigationViewItemBase& nvib);
197-
std::set<tracker_ref<winrt::NavigationViewItemBase>> m_itemsWithRevokerObjects;
197+
std::set<winrt::NavigationViewItemBase> m_itemsWithRevokerObjects;
198198

199199
void InvalidateTopNavPrimaryLayout();
200200
// Measure functions for top navigation

dxaml/xcp/core/animation/timer.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include "Timemgr.h"
77
#include "TimeSpan.h"
88
#include <UIThreadScheduler.h>
9+
#include "XamlTelemetry.h"
10+
#include <FrameworkUdk/Containment.h>
11+
12+
// Bug 49537618: [1.5 servicing] DispatcherTimer callbacks are taking much longer on Cadmus
13+
#define WINAPPSDK_CHANGEID_49537618 49537618
914

1015
_Check_return_ HRESULT CDispatcherTimer::Create(
1116
_Outptr_ CDependencyObject **ppObject,
@@ -85,6 +90,17 @@ _Check_return_ HRESULT CDispatcherTimer::ComputeStateImpl(
8590
// If we've reached the point where the timer should fire, raise the event and start time over.
8691
if (timeRemainingInMilliseconds <= 0)
8792
{
93+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
94+
{
95+
TraceLoggingProviderWrite(
96+
XamlTelemetry, "DispatcherTimer_Tick",
97+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
98+
TraceLoggingWideString(m_strName.GetBuffer(), "TimerName"),
99+
TraceLoggingUInt64(static_cast<uint64_t>(m_pInterval->m_rTimeSpan * 1000.0), "IntervalInMilliseconds"),
100+
TraceLoggingBoolean(!!m_pEventList, "HasListeners"),
101+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
102+
}
103+
88104
FireTickEvent();
89105

90106
// Snap the time the DispatcherTimer ticked - the next interval is relative to this point.
@@ -167,6 +183,17 @@ _Check_return_ HRESULT CDispatcherTimer::Start()
167183

168184
m_rLastTickTime = pTimeManager->GetEstimatedNextTickTime();
169185

186+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
187+
{
188+
TraceLoggingProviderWrite(
189+
XamlTelemetry, "DispatcherTimer_Start",
190+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
191+
TraceLoggingWideString(m_strName.GetBuffer(), "TimerName"),
192+
TraceLoggingUInt64(static_cast<uint64_t>(m_pInterval->m_rTimeSpan * 1000.0), "IntervalInMilliseconds"),
193+
TraceLoggingUInt64(static_cast<uint64_t>(m_rLastTickTime * 1000.0), "StartTickTimeInMilliseconds"),
194+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
195+
}
196+
170197
// Request a tick to update the timeline.
171198
// The browser host and/or frame scheduler can be NULL during shutdown.
172199
IXcpBrowserHost *pBH = core->GetBrowserHost();
@@ -198,6 +225,16 @@ _Check_return_ HRESULT CDispatcherTimer::Stop()
198225
m_fAddedToManager = FALSE;
199226
}
200227

228+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
229+
{
230+
TraceLoggingProviderWrite(
231+
XamlTelemetry, "DispatcherTimer_Stop",
232+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
233+
TraceLoggingWideString(m_strName.GetBuffer(), "TimerName"),
234+
TraceLoggingUInt64(static_cast<uint64_t>(m_pInterval->m_rTimeSpan * 1000.0), "IntervalInMilliseconds"),
235+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
236+
}
237+
201238
return S_OK;
202239
}
203240

@@ -216,6 +253,17 @@ _Check_return_ HRESULT CDispatcherTimer::WorkComplete()
216253
m_fWorkPending = FALSE;
217254
m_rLastTickTime = pTimeManager->GetEstimatedNextTickTime();
218255

256+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
257+
{
258+
TraceLoggingProviderWrite(
259+
XamlTelemetry, "DispatcherTimer_TickComplete",
260+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
261+
TraceLoggingWideString(m_strName.GetBuffer(), "TimerName"),
262+
TraceLoggingUInt64(static_cast<uint64_t>(m_pInterval->m_rTimeSpan * 1000.0), "IntervalInMilliseconds"),
263+
TraceLoggingUInt64(static_cast<uint64_t>(m_rLastTickTime * 1000.0), "StartTickTimeInMilliseconds"),
264+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
265+
}
266+
219267
// Request a tick to update the timeline.
220268
// The browser host and/or frame scheduler can be NULL during shutdown.
221269
IXcpBrowserHost *pBH = core->GetBrowserHost();

dxaml/xcp/core/compositor/RefreshAlignedClock.cpp

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
#include "precomp.h"
55
#include "RefreshAlignedClock.h"
6+
#include "XamlTelemetry.h"
7+
#include <FrameworkUdk/Containment.h>
8+
9+
// Bug 49537618: [1.5 servicing] DispatcherTimer callbacks are taking much longer on Cadmus
10+
#define WINAPPSDK_CHANGEID_49537618 49537618
611

712
//------------------------------------------------------------------------
813
//
@@ -78,6 +83,16 @@ RefreshAlignedClock::Tick()
7883

7984
m_lastReportedTime = GetNextTickTimeInSeconds();
8085

86+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
87+
{
88+
TraceLoggingProviderWrite(
89+
XamlTelemetry, "RefreshAlignedClock_Tick",
90+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
91+
TraceLoggingUInt64(static_cast<uint64_t>(m_lastReportedTime * 1000.0), "LastReportedTimeInMilliseconds"),
92+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(m_pIClock), "ClockPointer"),
93+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
94+
}
95+
8196
return m_lastReportedTime;
8297
}
8398

@@ -93,31 +108,55 @@ RefreshAlignedClock::GetNextTickTimeInSeconds() const
93108
{
94109
auto guard = m_Lock.lock(); // can be called from ui thread + compositor thread simultaneously
95110

96-
XDOUBLE refreshIntervalInSeconds;
97-
98-
if (m_pRefreshRateInfo != NULL)
111+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_49537618>())
99112
{
100-
refreshIntervalInSeconds = static_cast<XDOUBLE>(m_pRefreshRateInfo->GetRefreshIntervalInMilliseconds()) / 1000.0;
113+
double currentTime = m_pIClock->GetAbsoluteTimeInSeconds();
114+
115+
// Make sure time never flows backwards. If we calculated something less than the last reported time, just return
116+
// the last reported time.
117+
if (currentTime < m_lastReportedTime)
118+
{
119+
TraceLoggingProviderWrite(
120+
XamlTelemetry, "RefreshAlignedClock_GetNextTickTimeInSeconds_TimeMovedBackwards",
121+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(this), "ObjectPointer"),
122+
TraceLoggingUInt64(static_cast<uint64_t>(currentTime * 1000.0), "CurrentTimeInMilliseconds"),
123+
TraceLoggingUInt64(static_cast<uint64_t>(m_lastReportedTime * 1000.0), "LastReportedTimeInMilliseconds"),
124+
TraceLoggingUInt64(reinterpret_cast<uint64_t>(m_pIClock), "ClockPointer"),
125+
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE));
126+
127+
currentTime = m_lastReportedTime;
128+
}
129+
130+
return currentTime;
101131
}
102132
else
103133
{
104-
// The refresh rate can't be read from the system yet.
105-
refreshIntervalInSeconds = static_cast<XDOUBLE>(DefaultRefreshIntervalInMilliseconds) / 1000.0;
134+
XDOUBLE refreshIntervalInSeconds;
135+
136+
if (m_pRefreshRateInfo != NULL)
137+
{
138+
refreshIntervalInSeconds = static_cast<XDOUBLE>(m_pRefreshRateInfo->GetRefreshIntervalInMilliseconds()) / 1000.0;
139+
}
140+
else
141+
{
142+
// The refresh rate can't be read from the system yet.
143+
refreshIntervalInSeconds = static_cast<XDOUBLE>(DefaultRefreshIntervalInMilliseconds) / 1000.0;
144+
}
145+
146+
// Round time forward to the refresh rate interval.
147+
XDOUBLE unroundedTime = static_cast<XDOUBLE>(m_pIClock->GetAbsoluteTimeInSeconds());
148+
XDOUBLE roundedTime = static_cast<XDOUBLE>(XcpCeiling(unroundedTime / refreshIntervalInSeconds)) * refreshIntervalInSeconds;
149+
XDOUBLE tolerance = 0.00001; // allow 0.01ms error
150+
151+
// Make sure we advance time by at least a frame each time the composition thread ticks.
152+
if (roundedTime <= m_lastReportedTime + tolerance)
153+
{
154+
roundedTime = m_lastReportedTime + refreshIntervalInSeconds;
155+
}
156+
157+
ASSERT(roundedTime > m_lastReportedTime);
158+
return roundedTime;
106159
}
107-
108-
// Round time forward to the refresh rate interval.
109-
XDOUBLE unroundedTime = static_cast<XDOUBLE>(m_pIClock->GetAbsoluteTimeInSeconds());
110-
XDOUBLE roundedTime = static_cast<XDOUBLE>(XcpCeiling(unroundedTime / refreshIntervalInSeconds)) * refreshIntervalInSeconds;
111-
XDOUBLE tolerance = 0.00001; // allow 0.01ms error
112-
113-
// Make sure we advance time by at least a frame each time the composition thread ticks.
114-
if (roundedTime <= m_lastReportedTime + tolerance)
115-
{
116-
roundedTime = m_lastReportedTime + refreshIntervalInSeconds;
117-
}
118-
119-
ASSERT(roundedTime > m_lastReportedTime);
120-
return roundedTime;
121160
}
122161

123162
//------------------------------------------------------------------------

dxaml/xcp/core/core/elements/DragEventArgs.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include "Activators.g.h"
77

88
#include <WRLHelper.h>
9+
#include <FrameworkUdk/Containment.h>
10+
11+
// Bug 49668748: [1.5 Servicing] After dragging an FE Home item, all item drops on breadcrumbs don't support Move after first drag
12+
#define LOCAL_WINAPPSDK_CHANGEID_49668748 49668748
13+
914

1015
// Initialize the DragEventArgs with any framework specific context.
1116
_Check_return_ HRESULT CDragEventArgs::Create(_In_ CCoreServices* pCore, _Outptr_ CDragEventArgs** ppArgs, _In_opt_ IInspectable* pWinRtDragInfo, _In_opt_ IInspectable* pDragDropAsyncOperation)
@@ -19,6 +24,16 @@ _Check_return_ HRESULT CDragEventArgs::Create(_In_ CCoreServices* pCore, _Outptr
1924
if(pWinRtDragInfo)
2025
{
2126
IFC_RETURN(spArgs->m_spWinRtDragInfo.reset(pWinRtDragInfo));
27+
if (WinAppSdk::Containment::IsChangeEnabled<LOCAL_WINAPPSDK_CHANGEID_49668748>())
28+
{
29+
wrl::ComPtr<mui::DragDrop::IDragInfo> dragInfo;
30+
if (SUCCEEDED(pWinRtDragInfo->QueryInterface(IID_PPV_ARGS(&dragInfo))))
31+
{
32+
wadt::DataPackageOperation allowedOperations;
33+
IFC_RETURN(dragInfo->get_AllowedOperations(&allowedOperations));
34+
IFC_RETURN(spArgs->put_AllowedOperations(static_cast<DirectUI::DataPackageOperation>(allowedOperations)));
35+
}
36+
}
2237
}
2338

2439
if(pDragDropAsyncOperation)

0 commit comments

Comments
 (0)