Skip to content

Move all one-time WebEnginePart initialiation in a single place

Move all one-time WebEnginePart initialiation in a single place

WebEnginePart constructor contains several initialization steps which affect all WebEnginePart instances (because they affect the profile) and so should only be performed once and not once for every WebEnginePart instance.

Currently, they're done directly from the constructor, with a check for each of them to ensure they haven't already been done. This commit creates a singleton class, WebEnginePartControls, and moves all this one-time initialization steps there. This way, WebEnginePart constructor only needs to check whether this object has been initialized and do it if it hasn't been done.

While these changes don't add any new functionality, it provides better organization.

In theory, the correct way to do this would be to derive a class from QWebEngineProfile and doing all this in its constructor, then creating a static object for this profile. However, it seems that doing so increases a bit Konqueror startup time, because there are two profiles which are created: the default one and our custom one.

Merge request reports