Limit the size of the queue maintained by DetailViewControllerWebViewProvider.

This commit is contained in:
Jim Correia 2019-08-31 13:16:46 -07:00
parent 8335a5cb48
commit 52ad2623a8
1 changed files with 5 additions and 0 deletions

View File

@ -263,6 +263,10 @@ class DetailViewControllerWebViewProvider {
}
func enqueueWebView(_ webView: WKWebView) {
guard queue.count < maximumQueueDepth else {
return
}
webView.uiDelegate = nil
webView.navigationDelegate = nil
@ -275,6 +279,7 @@ class DetailViewControllerWebViewProvider {
// MARK: Private
private let minimumQueueDepth = 3
private let maximumQueueDepth = 6
private var queue: [WKWebView] = []
private init() {