summaryrefslogtreecommitdiffstats
path: root/src/core/url_request_custom_job.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-02-04 13:50:57 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-02-04 14:13:39 +0100
commit6722bbbf4ea2ddcdd9194f26a883029ec3afc39a (patch)
treec3290b82fac21c4990be8472ae6cb4ca043205cf /src/core/url_request_custom_job.h
parent41d69eb0fa2375f0da6ba9b35136f5598be4b3a4 (diff)
parent82f4d13a13b40d9cb7710f6dd4190175a272a394 (diff)
Merge branch '5.6' into dev
Diffstat (limited to 'src/core/url_request_custom_job.h')
-rw-r--r--src/core/url_request_custom_job.h41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h
index e6063f485..98e2478c4 100644
--- a/src/core/url_request_custom_job.h
+++ b/src/core/url_request_custom_job.h
@@ -53,6 +53,7 @@ QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler)
namespace QtWebEngineCore {
class URLRequestCustomJobDelegate;
+class URLRequestCustomJobShared;
// A request job that handles reading custom URL schemes
class URLRequestCustomJob : public net::URLRequestJob {
@@ -65,6 +66,25 @@ public:
virtual bool GetCharset(std::string *charset) Q_DECL_OVERRIDE;
virtual bool IsRedirectResponse(GURL* location, int* http_status_code) Q_DECL_OVERRIDE;
+protected:
+ virtual ~URLRequestCustomJob();
+
+private:
+ QWebEngineUrlSchemeHandler *m_schemeHandler;
+ URLRequestCustomJobShared *m_shared;
+
+ friend class URLRequestCustomJobShared;
+
+ DISALLOW_COPY_AND_ASSIGN(URLRequestCustomJob);
+};
+
+// A shared state between URLRequestCustomJob living on the IO thread
+// and URLRequestCustomJobDelegate living on the UI thread.
+class URLRequestCustomJobShared {
+public:
+ URLRequestCustomJobShared(URLRequestCustomJob *job);
+ ~URLRequestCustomJobShared();
+
void setReplyMimeType(const std::string &);
void setReplyCharset(const std::string &);
void setReplyDevice(QIODevice *);
@@ -73,29 +93,28 @@ public:
void fail(int);
void abort();
-protected:
- virtual ~URLRequestCustomJob();
+ void killJob();
+ void unsetJobDelegate();
+
void startAsync();
void notifyStarted();
void notifyFailure();
void notifyCanceled();
-private:
+ GURL requestUrl();
+ std::string requestMethod();
+
QMutex m_mutex;
QPointer<QIODevice> m_device;
- QPointer<URLRequestCustomJobDelegate> m_delegate;
- QWebEngineUrlSchemeHandler *m_schemeHandler;
+ URLRequestCustomJob *m_job;
+ URLRequestCustomJobDelegate *m_delegate;
std::string m_mimeType;
std::string m_charset;
int m_error;
GURL m_redirect;
bool m_started;
- base::WeakPtrFactory<URLRequestCustomJob> m_weakFactoryIO;
- base::WeakPtrFactory<URLRequestCustomJob> m_weakFactoryUI;
-
- friend class URLRequestCustomJobDelegate;
-
- DISALLOW_COPY_AND_ASSIGN(URLRequestCustomJob);
+ bool m_asyncInitialized;
+ base::WeakPtrFactory<URLRequestCustomJobShared> m_weakFactory;
};
} // namespace QtWebEngineCore