|
@@ -211,6 +211,19 @@ export class LargeVideoBackground extends Component<Props> {
|
211
|
211
|
* @returns {void}
|
212
|
212
|
*/
|
213
|
213
|
_updateCanvas() {
|
|
214
|
+ // On Electron 7 there is a memory leak if we try to draw into a hidden canvas that is part of the DOM tree.
|
|
215
|
+ // See: https://github.com/electron/electron/issues/22417
|
|
216
|
+ // Trying to detect all the cases when the page will be hidden because of something not in our control
|
|
217
|
+ // (for example when the page is loaded in an iframe which is hidden due to the host page styles) to solve
|
|
218
|
+ // the memory leak. Currently we are not handling the use case when the page is hidden with visibility:hidden
|
|
219
|
+ // because we don't have a good way to do it.
|
|
220
|
+ // All other cases when the canvas is not visible are handled trough the component props
|
|
221
|
+ // (hidden, _shouldDisplayTileView).
|
|
222
|
+ if (!this._canvasEl || this._canvasEl.offsetParent === null
|
|
223
|
+ || window.innerHeight === 0 || window.innerWidth === 0) {
|
|
224
|
+ return;
|
|
225
|
+ }
|
|
226
|
+
|
214
|
227
|
const { videoElement } = this.props;
|
215
|
228
|
const { videoWidth, videoHeight } = videoElement;
|
216
|
229
|
const {
|