Skip to content

Commit 6fb9b81

Browse files
committed
Insert a bunch of cancel point and remove SQLite cache completely
1 parent d6af718 commit 6fb9b81

File tree

6 files changed

+15
-209
lines changed

6 files changed

+15
-209
lines changed

Files/Files.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@
264264
<Compile Include="Helpers\CollectionDebugView.cs" />
265265
<Compile Include="Helpers\DynamicDialogFactory.cs" />
266266
<Compile Include="Helpers\Extension.cs" />
267-
<Compile Include="Helpers\FileListCache\FileListCacheController.cs" />
268-
<Compile Include="Helpers\FileListCache\IFileListCache.cs" />
269-
<Compile Include="Helpers\FileListCache\PersistentSQLiteCacheAdapter.cs" />
270267
<Compile Include="Helpers\ExtensionManager.cs" />
271268
<Compile Include="Helpers\IntervalSampler.cs" />
272269
<Compile Include="Helpers\QuickLookHelpers.cs" />

Files/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using ByteSizeLib;
22
using Files.Extensions;
33
using Files.Helpers;
4-
using Files.Helpers.FileListCache;
54
using Microsoft.Toolkit.Uwp;
65
using System;
76
using System.Collections.Generic;
@@ -19,7 +18,6 @@ namespace Files.Filesystem.StorageEnumerators
1918
{
2019
public static class Win32StorageEnumerator
2120
{
22-
private static IFileListCache fileListCache = FileListCacheController.GetInstance();
2321

2422
public static async Task<List<ListedItem>> ListEntries(
2523
string path,
@@ -117,11 +115,6 @@ CancellationToken cancellationToken
117115
return null;
118116
}
119117
var itemPath = Path.Combine(pathRoot, findData.cFileName);
120-
string itemName = await fileListCache.ReadFileDisplayNameFromCache(itemPath, cancellationToken);
121-
if (string.IsNullOrEmpty(itemName))
122-
{
123-
itemName = findData.cFileName;
124-
}
125118
bool isHidden = (((FileAttributes)findData.dwFileAttributes & FileAttributes.Hidden) == FileAttributes.Hidden);
126119
double opacity = 1;
127120

@@ -133,7 +126,7 @@ CancellationToken cancellationToken
133126
return new ListedItem(null, dateReturnFormat)
134127
{
135128
PrimaryItemAttribute = StorageItemTypes.Folder,
136-
ItemName = itemName,
129+
ItemName = findData.cFileName,
137130
ItemDateModifiedReal = itemModifiedDate,
138131
ItemDateCreatedReal = itemCreatedDate,
139132
ItemType = "FileFolderListItem".GetLocalized(),

Files/Helpers/FileListCache/FileListCacheController.cs

-53
This file was deleted.

Files/Helpers/FileListCache/IFileListCache.cs

-12
This file was deleted.

Files/Helpers/FileListCache/PersistentSQLiteCacheAdapter.cs

-128
This file was deleted.

Files/ViewModels/ItemViewModel.cs

+14-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Files.Filesystem.StorageEnumerators;
99
using Files.Filesystem.StorageItems;
1010
using Files.Helpers;
11-
using Files.Helpers.FileListCache;
1211
using Files.UserControls;
1312
using FluentFTP;
1413
using Microsoft.Toolkit.Mvvm.ComponentModel;
@@ -68,8 +67,6 @@ public class ItemViewModel : ObservableObject, IDisposable
6867

6968
public event EventHandler<List<ListedItem>> OnSelectionRequestedEvent;
7069

71-
private IFileListCache fileListCache = FileListCacheController.GetInstance();
72-
7370
private NamedPipeAsAppServiceConnection connection;
7471

7572
private NamedPipeAsAppServiceConnection Connection
@@ -940,14 +937,17 @@ await Task.Run(async () =>
940937
{
941938
if (!item.IsShortcutItem && !item.IsHiddenItem && !FtpHelpers.IsFtpPath(item.ItemPath))
942939
{
940+
cts.Token.ThrowIfCancellationRequested();
943941
matchingStorageFile = await GetFileFromPathAsync(item.ItemPath);
944942
if (matchingStorageFile != null)
945943
{
944+
cts.Token.ThrowIfCancellationRequested();
946945
await LoadItemThumbnail(item, thumbnailSize, matchingStorageFile, true);
947-
948946
var syncStatus = await CheckCloudDriveSyncStatusAsync(matchingStorageFile);
949947
var fileFRN = await FileTagsHelper.GetFileFRN(matchingStorageFile);
950948
var fileTag = FileTagsHelper.ReadFileTag(item.ItemPath);
949+
950+
cts.Token.ThrowIfCancellationRequested();
951951
await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
952952
{
953953
item.FolderRelativeId = matchingStorageFile.FolderRelativeId;
@@ -969,27 +969,32 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
969969
{
970970
if (!item.IsShortcutItem && !item.IsHiddenItem && !FtpHelpers.IsFtpPath(item.ItemPath))
971971
{
972+
cts.Token.ThrowIfCancellationRequested();
972973
BaseStorageFolder matchingStorageFolder = await GetFolderFromPathAsync(item.ItemPath);
973974
if (matchingStorageFolder != null)
974975
{
976+
cts.Token.ThrowIfCancellationRequested();
975977
await LoadItemThumbnail(item, thumbnailSize, matchingStorageFolder, true);
976978
if (matchingStorageFolder.DisplayName != item.ItemName && !matchingStorageFolder.DisplayName.StartsWith("$R"))
977979
{
980+
cts.Token.ThrowIfCancellationRequested();
978981
await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
979982
{
980983
item.ItemName = matchingStorageFolder.DisplayName;
981984
});
982-
await fileListCache.SaveFileDisplayNameToCache(item.ItemPath, matchingStorageFolder.DisplayName);
985+
983986
if (folderSettings.DirectorySortOption == SortOption.Name && !isLoadingItems)
984987
{
985988
await OrderFilesAndFoldersAsync();
986989
await ApplySingleFileChangeAsync(item);
987990
}
988991
}
989992

993+
cts.Token.ThrowIfCancellationRequested();
990994
var syncStatus = await CheckCloudDriveSyncStatusAsync(matchingStorageFolder);
991995
var fileFRN = await FileTagsHelper.GetFileFRN(matchingStorageFolder);
992996
var fileTag = FileTagsHelper.ReadFileTag(item.ItemPath);
997+
cts.Token.ThrowIfCancellationRequested();
993998
await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
994999
{
9951000
item.FolderRelativeId = matchingStorageFolder.FolderRelativeId;
@@ -1004,12 +1009,14 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
10041009
}
10051010
if (!wasSyncStatusLoaded)
10061011
{
1012+
cts.Token.ThrowIfCancellationRequested();
10071013
await LoadItemThumbnail(item, thumbnailSize, null, true);
10081014
}
10091015
}
10101016

10111017
if (loadGroupHeaderInfo && isFileTypeGroupMode)
10121018
{
1019+
cts.Token.ThrowIfCancellationRequested();
10131020
groupImage = await GetItemTypeGroupIcon(item, matchingStorageFile);
10141021
}
10151022
}
@@ -1020,6 +1027,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
10201027
{
10211028
if (!wasSyncStatusLoaded)
10221029
{
1030+
cts.Token.ThrowIfCancellationRequested();
10231031
await FilesystemTasks.Wrap(async () =>
10241032
{
10251033
var fileTag = FileTagsHelper.ReadFileTag(item.ItemPath);
@@ -1034,6 +1042,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
10341042

10351043
if (loadGroupHeaderInfo)
10361044
{
1045+
cts.Token.ThrowIfCancellationRequested();
10371046
await FilesystemTasks.Wrap(() => CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
10381047
{
10391048
gp.Model.ImageSource = groupImage;

0 commit comments

Comments
 (0)