diff options
author | Michal Klocek <michal.klocek@qt.io> | 2017-09-04 16:35:08 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2017-09-11 09:58:55 +0000 |
commit | 7a7f5276cc7bbb5138054886b1eadd5d334988a0 (patch) | |
tree | dd62ea073f302e8368710386cf1de3d77d9c9da5 /src/core/url_request_custom_job.h | |
parent | cccde2776eb261af6af62bf04140a09b533252ff (diff) |
Refactor URLRequestCustomJob
Move URLRequestCustomJobShared to separate file
and rename class to URLRequestCustomJobProxy.
This commit is a groundwork for following one.
Change-Id: I122b2101789e91186a3bffa9a07eed43b7340418
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.h | 54 |
1 files changed, 5 insertions, 49 deletions
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h index 93edb0b8c..171786c7b 100644 --- a/src/core/url_request_custom_job.h +++ b/src/core/url_request_custom_job.h @@ -40,19 +40,15 @@ #ifndef URL_REQUEST_CUSTOM_JOB_H_ #define URL_REQUEST_CUSTOM_JOB_H_ -#include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" - -#include <QtCore/QMutex> -#include <QtCore/QPointer> - -QT_FORWARD_DECLARE_CLASS(QIODevice) +#include "url/gurl.h" +#include <QtCore/QWeakPointer> namespace QtWebEngineCore { class BrowserContextAdapter; class URLRequestCustomJobDelegate; -class URLRequestCustomJobShared; +class URLRequestCustomJobProxy; // A request job that handles reading custom URL schemes class URLRequestCustomJob : public net::URLRequestJob { @@ -71,52 +67,12 @@ protected: private: std::string m_scheme; QWeakPointer<const BrowserContextAdapter> m_adapter; - URLRequestCustomJobShared *m_shared; + URLRequestCustomJobProxy *m_proxy; - friend class URLRequestCustomJobShared; + friend class URLRequestCustomJobProxy; 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 *); - - void redirect(const GURL &url); - void fail(int); - void abort(); - - void killJob(); - void unsetJobDelegate(); - - void startAsync(); - void notifyStarted(); - void notifyFailure(); - void notifyCanceled(); - - GURL requestUrl(); - std::string requestMethod(); - - QMutex m_mutex; - QPointer<QIODevice> m_device; - URLRequestCustomJob *m_job; - URLRequestCustomJobDelegate *m_delegate; - std::string m_mimeType; - std::string m_charset; - int m_error; - GURL m_redirect; - bool m_started; - bool m_asyncInitialized; - base::WeakPtrFactory<URLRequestCustomJobShared> m_weakFactory; -}; - } // namespace QtWebEngineCore #endif // URL_REQUEST_CUSTOM_JOB_H_ |