From 5a0318af6cb5c7807b817cd773a3c18ef66c2299 Mon Sep 17 00:00:00 2001 From: Soner Yuksel Date: Fri, 4 Jun 2021 12:26:37 -0400 Subject: [PATCH] Deleting removed files --- Client/Frontend/Browser/FrecencyQuery.swift | 45 --------------------- 1 file changed, 45 deletions(-) delete mode 100644 Client/Frontend/Browser/FrecencyQuery.swift diff --git a/Client/Frontend/Browser/FrecencyQuery.swift b/Client/Frontend/Browser/FrecencyQuery.swift deleted file mode 100644 index 94f919ec82e..00000000000 --- a/Client/Frontend/Browser/FrecencyQuery.swift +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 The Brave Authors. All rights reserved. -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import Foundation -import Shared -import Storage -import Data - -class FrecencyQuery { - private static let queue = DispatchQueue(label: "frecency-query-queue") - private static var cancellable: DispatchWorkItem? - - public static func sitesByFrecency(containing query: String? = nil, - completion: @escaping (Set) -> Void) { - cancellable?.cancel() - cancellable = nil - - cancellable = DispatchWorkItem { - // brave-core fetch can be slow over 200ms per call, - // a cancellable serial queue is used for it. - - Historyv2.byFrequency(query: query) { historyList in - let historySites = historyList - .map { Site(url: $0.url ?? "", title: $0.title ?? "") } - - Bookmarkv2.byFrequency(query: query) { bookmarkList in - let bookmarkSites = bookmarkList - .map { Site(url: $0.url ?? "", title: $0.title ?? "", bookmarked: true) } - - let result = Set(historySites + bookmarkSites) - - DispatchQueue.main.async { - completion(result) - } - } - } - } - - if let task = cancellable { - queue.async(execute: task) - } - } -}