summaryrefslogtreecommitdiffstats
path: root/src/core/url_request_custom_job.h
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2017-09-04 16:00:47 +0200
committerMichal Klocek <michal.klocek@qt.io>2017-09-11 09:59:06 +0000
commit73286f99b4ecc3f11485e36b1a090849e5efd4ef (patch)
treeb8777d08de2df84bd82701cd4cc710f925d7a41c /src/core/url_request_custom_job.h
parent7a7f5276cc7bbb5138054886b1eadd5d334988a0 (diff)
Simplify URLRequestCustomJob handling
Improve implementation of URLRequestCustomJob: * remove qmutex, pass values using PostTask * do not use base::WeakPtr which is not thread safe and must always be dereferenced on the same thread * add proxy object to handle interactions between threads * do not use QPointer to track IODevice since it does not solve anything for us * QIODevice in reply method is used only by IO thread * do not make shared object to commit suicide, instead use refcounted object * improve documentation about thread safety issue of QIODevice object in reply method Change-Id: Ic29bf262de8082dfd46cb9217a68f3c982d16b9e Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/url_request_custom_job.h')
-rw-r--r--src/core/url_request_custom_job.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h
index 171786c7b..68a834d48 100644
--- a/src/core/url_request_custom_job.h
+++ b/src/core/url_request_custom_job.h
@@ -44,6 +44,8 @@
#include "url/gurl.h"
#include <QtCore/QWeakPointer>
+QT_FORWARD_DECLARE_CLASS(QIODevice)
+
namespace QtWebEngineCore {
class BrowserContextAdapter;
@@ -53,7 +55,10 @@ class URLRequestCustomJobProxy;
// A request job that handles reading custom URL schemes
class URLRequestCustomJob : public net::URLRequestJob {
public:
- URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, const std::string &scheme, QWeakPointer<const BrowserContextAdapter> adapter);
+ URLRequestCustomJob(net::URLRequest *request,
+ net::NetworkDelegate *networkDelegate,
+ const std::string &scheme,
+ QWeakPointer<const BrowserContextAdapter> adapter);
void Start() override;
void Kill() override;
int ReadRawData(net::IOBuffer *buf, int buf_size) override;
@@ -65,9 +70,12 @@ protected:
virtual ~URLRequestCustomJob();
private:
- std::string m_scheme;
- QWeakPointer<const BrowserContextAdapter> m_adapter;
- URLRequestCustomJobProxy *m_proxy;
+ scoped_refptr<URLRequestCustomJobProxy> m_proxy;
+ std::string m_mimeType;
+ std::string m_charset;
+ GURL m_redirect;
+ QIODevice *m_device;
+ int m_error;
friend class URLRequestCustomJobProxy;