Skip to content

Commit

Permalink
Fix lottie high Windowserver load (#2595)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1177771139624306/1207024603216659/f

**Description**:
Force use of .mainThread to prevent high WindowServer Usage (Pending Fix
with newer Lottie versions)
  • Loading branch information
afterxleep authored and samsymons committed Apr 11, 2024
1 parent b44fa7f commit b1d6a97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

PrivacyFeatures.httpsUpgrade.loadDataAsync()
bookmarksManager.loadBookmarks()

// Force use of .mainThread to prevent high WindowServer Usage
// Pending Fix with newer Lottie versions
// https://app.asana.com/0/1177771139624306/1207024603216659/f
LottieConfiguration.shared.renderingEngine = .mainThread

if case .normal = NSApp.runType {
FaviconManager.shared.loadFavicons()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,13 @@ final class AddressBarButtonsViewController: NSViewController {
}

private func setupAnimationViews() {
func addAndLayoutAnimationViewIfNeeded(animationView: LottieAnimationView?, animationName: String, renderingEngine: Lottie.RenderingEngineOption = .automatic) -> LottieAnimationView {

func addAndLayoutAnimationViewIfNeeded(animationView: LottieAnimationView?,
animationName: String,
// Default use of .mainThread to prevent high WindowServer Usage
// Pending Fix with newer Lottie versions
// https://app.asana.com/0/1177771139624306/1207024603216659/f
renderingEngine: Lottie.RenderingEngineOption = .mainThread) -> LottieAnimationView {
if let animationView = animationView, animationView.identifier?.rawValue == animationName {
return animationView
}
Expand Down

0 comments on commit b1d6a97

Please sign in to comment.