wxWebView question

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Big Muscle
Experienced Solver
Experienced Solver
Posts: 82
Joined: Sun Jun 27, 2010 6:18 pm

wxWebView question

Post by Big Muscle » Tue Jun 16, 2020 12:16 pm

Hello,
I have a question regarding to wxWebView on GTK+3 (+ libwebkit2gtk-4.0-dev). With only a single page with simple JS animation it takes tens percents of all CPU cores permanently on Raspberry Pi4. KWeb (kiosk browser) takes almost 0% CPU all the time, Chromium is low too with random spikes, even on old RPi 2.

Is there a way to to reduce CPU usage with wxWebView, e.g. by enabling GPU acceleration or something similar?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4245
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView question

Post by ONEEYEMAN » Tue Jun 16, 2020 2:36 pm

Hi,
Did you try to run the web view sample or this is from your project?
Are you running debug or release version?

Big Muscle
Experienced Solver
Experienced Solver
Posts: 82
Joined: Sun Jun 27, 2010 6:18 pm

Re: wxWebView question

Post by Big Muscle » Tue Jun 16, 2020 6:01 pm

It is a custom but very minimal project. Tried compiling with -Ofast. High CPU usage comes from webkit processes that are automatically started.

Code: Select all

#include <wx/wx.h>

#include <wx/webview.h>

class Simple : public wxFrame
{
public:
    Simple(const wxString& title)
		: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
	{
		Centre();
		wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
		wxWebView* web = wxWebView::New(this, wxID_ANY, "https://our url...");
		sizer->Add(web, 1, wxEXPAND);
		SetSizer(sizer);
	}
};

class MyApp : public wxApp
{
public:
	bool OnInit()
	{
		Simple *simple = new Simple(wxT("Simple"));
		simple->ShowFullScreen(true);
		return true;
	}
};

wxIMPLEMENT_APP(MyApp); 

Post Reply