Hi, My name is Markus and this is my first blog post on labs :-)
Since some time ago we integrated a change into QNetworkAccessManager that makes HTTP requests run in a separate thread.
Someone asked for clarification on that, so here it goes :)
The reason behind this was the way QtWebKit (based on WebKit1) works. A web browser typically has a lot of work to do.
It needs to parse HTML and CSS, it needs to decode images from JPEG or PNG to something that can be displayed,
While all this work is happening the network processing is not progressing if it is happening in the same thread as the rest
of the browser. What we have seen from network traces is that what we call "synchronization points" is happening: While
QtWebKit is busy in the main thread and blocking its event loop, no new network requests are sent out. In really bad cases the HTTP servers stop sending new data. This is especially relevant where you have lower processing power and higher network latency than on the classic desktop PC (Hello mobile device world!).
There are several solutions for this:
What we have done is 3.
Technically this works by putting another layer inside QNetworkAccessManager. The actual HTTP protocol code does not change at all, only the way how QNetworkAccessManager is using it. Also your code and QtWebKit's code do not need to change. This means from Qt 4.8 on you get those benefits without needing to enable anything special.
If you want to use it already now please take a look at our earth team repository and make sure to report bugs :)
If you want to take a look at the code, one relevant new (internal) class is the QHttpThreadDelegate (which lives in the HTTP thread) and controls the HTTP code. It is directed by the (internal) QNetworkAccessHttpBackend (which lives in the user thread) via signals and slots.
PS: A lot of things are happening inside Qt these days and will continue to happen, even though rumor on the streets says otherwise... While you read this we are making the whole QtWebKit experience even more asynchronous with WebKit2 power! :)
Stay up to date with the latest marketing, sales and service tips and news.
Download the latest release here: www.qt.io/download.
Qt 5.12 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu