-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Refactor [Tab Tray] Try to improve tab performance issues #30365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,11 +10,13 @@ public protocol TabSessionStore: Sendable { | |
| /// - Parameters: | ||
| /// - tabID: an ID that uniquely identifies the tab | ||
| /// - sessionData: the data associated with a session, encoded as a Data object | ||
| @MainActor | ||
| func saveTabSession(tabID: UUID, sessionData: Data) | ||
|
|
||
| /// Fetches the session data associated with a tab | ||
| /// - Parameter tabID: an ID that uniquely identifies the tab | ||
| /// - Returns: the data associated with a session, encoded as a Data object | ||
| @MainActor | ||
| func fetchTabSession(tabID: UUID) -> Data? | ||
|
|
||
| /// Cleans up any tab session data files for tabs that are no longer open. | ||
|
|
@@ -47,8 +49,6 @@ public final class DefaultTabSessionStore: TabSessionStore { | |
|
|
||
| let path = directory.appendingPathComponent(filePrefix + tabID.uuidString) | ||
| do { | ||
| lock.lock() | ||
| defer { lock.unlock() } | ||
| try sessionData.write(to: path, options: .atomicWrite) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to lock if this work is isolated to the main actor |
||
| } catch { | ||
| logger.log("Failed to save session data with error: \(error.localizedDescription)", | ||
|
|
@@ -67,8 +67,6 @@ public final class DefaultTabSessionStore: TabSessionStore { | |
| } | ||
|
|
||
| do { | ||
| lock.lock() | ||
| defer { lock.unlock() } | ||
| return try Data(contentsOf: path) | ||
| } catch { | ||
| logger.log("Failed to decode session data with error: \(error.localizedDescription)", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1326,7 +1326,6 @@ class BrowserViewController: UIViewController, | |
| } | ||
|
|
||
| updateTabCountUsingTabManager(tabManager, animated: false) | ||
| updateToolbarStateForTraitCollection(traitCollection) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't actually know if we can remove this call from the viewWillAppear but we are calling this in |
||
| updateAddressToolbarContainerPosition(for: traitCollection) | ||
| } | ||
|
|
||
|
|
@@ -4483,8 +4482,6 @@ extension BrowserViewController: TabManagerDelegate { | |
| /// If we are on iPad we need to trigger `willNavigateAway` when switching tabs | ||
| willNavigateAway(from: previousTab) | ||
| topTabsDidChangeTab() | ||
| } else if isSwipingTabsEnabled { | ||
| addressToolbarContainer.updateSkeletonAddressBarsVisibility(tabManager: tabManager) | ||
|
Comment on lines
-4486
to
-4487
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember that this code was added here to help us keep track of the previous and next tab to be able to pre configure the skeleton bars. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @PARAIPAN9 Maybe you could help me figure out the right way to clean up this code since you understand the functionality that
When we select a tab all of these are called. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I will take a look as soon as possible. |
||
| } | ||
|
|
||
| /// If the selectedTab is showing an error page trigger a reload | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this work should probably be asynchronous but it will require more thought since we need the tab session to load the webview