Merge pull request #926 from correia/correia/limit-webview-queue-size
Limit the size of the queue maintained by DetailViewControllerWebViewProvider.
This commit is contained in:
commit
80a8559823
|
@ -263,6 +263,10 @@ class DetailViewControllerWebViewProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
func enqueueWebView(_ webView: WKWebView) {
|
func enqueueWebView(_ webView: WKWebView) {
|
||||||
|
guard queue.count < maximumQueueDepth else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
webView.uiDelegate = nil
|
webView.uiDelegate = nil
|
||||||
webView.navigationDelegate = nil
|
webView.navigationDelegate = nil
|
||||||
|
|
||||||
|
@ -275,6 +279,7 @@ class DetailViewControllerWebViewProvider {
|
||||||
// MARK: Private
|
// MARK: Private
|
||||||
|
|
||||||
private let minimumQueueDepth = 3
|
private let minimumQueueDepth = 3
|
||||||
|
private let maximumQueueDepth = 6
|
||||||
private var queue: [WKWebView] = []
|
private var queue: [WKWebView] = []
|
||||||
|
|
||||||
private init() {
|
private init() {
|
||||||
|
|
Loading…
Reference in New Issue