From 700877fab0fd04130815e75c935b8440f447b211 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Tue, 16 Apr 2019 15:01:15 +0200
Subject: [PATCH] Cleanup coding style in src/core/api

Change-Id: I1c235d49a9520088142fbc89d21fc589d4037a4f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
---
 src/core/api/qtwebenginecoreglobal.cpp        |  4 +-
 src/core/api/qwebenginecallback.h             | 20 ++---
 src/core/api/qwebenginecallback_p.h           | 85 +++++++++----------
 .../api/qwebengineclientcertificatestore.cpp  |  5 +-
 .../api/qwebengineclientcertificatestore.h    |  2 +-
 src/core/api/qwebenginecookiestore.cpp        | 21 ++---
 src/core/api/qwebenginecookiestore.h          |  4 +-
 src/core/api/qwebenginecookiestore_p.h        |  6 +-
 src/core/api/qwebenginehttprequest.cpp        | 42 +++------
 src/core/api/qwebenginehttprequest.h          | 19 ++---
 .../api/qwebenginemessagepumpscheduler_p.h    |  3 +-
 src/core/api/qwebenginenotification.cpp       |  6 +-
 src/core/api/qwebenginequotarequest.cpp       |  3 +-
 src/core/api/qwebenginequotarequest.h         |  3 +-
 ...ebengineregisterprotocolhandlerrequest.cpp |  2 +-
 ...qwebengineregisterprotocolhandlerrequest.h |  6 +-
 src/core/api/qwebengineurlrequestinfo.cpp     | 27 +++---
 src/core/api/qwebengineurlrequestinfo.h       |  2 +-
 src/core/api/qwebengineurlrequestinfo_p.h     | 11 +--
 .../api/qwebengineurlrequestinterceptor.h     |  8 +-
 src/core/api/qwebengineurlrequestjob.cpp      |  5 +-
 src/core/api/qwebengineurlrequestjob.h        |  4 +-
 src/core/api/qwebengineurlscheme.cpp          | 10 +--
 src/core/api/qwebengineurlscheme.h            |  4 +-
 src/core/api/qwebengineurlschemehandler.h     |  2 +-
 25 files changed, 131 insertions(+), 173 deletions(-)

diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index d857d4f12..ad52d09ad 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -58,7 +58,8 @@ QT_END_NAMESPACE
 
 #ifndef QT_NO_OPENGL
 #ifdef Q_OS_MACOS
-static bool needsOfflineRendererWorkaround() {
+static bool needsOfflineRendererWorkaround()
+{
     size_t hwmodelsize = 0;
 
     if (sysctlbyname("hw.model", nullptr, &hwmodelsize, nullptr, 0) == -1)
@@ -131,4 +132,3 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize()
 #endif // QT_NO_OPENGL
 }
 } // namespace QtWebEngineCore
-
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
index b981b2afb..49efc50b2 100644
--- a/src/core/api/qwebenginecallback.h
+++ b/src/core/api/qwebenginecallback.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
 
 namespace QtWebEnginePrivate {
 
-template <typename T>
+template<typename T>
 class QWebEngineCallbackPrivateBase : public QSharedData {
 public:
     QWebEngineCallbackPrivateBase() {}
@@ -62,32 +62,32 @@ public:
     virtual void operator()(T) = 0;
 };
 
-template <typename T, typename F>
+template<typename T, typename F>
 class QWebEngineCallbackPrivate : public QWebEngineCallbackPrivateBase<T> {
 public:
-    QWebEngineCallbackPrivate(F callable)
-        : m_callable(callable)
-    {}
+    QWebEngineCallbackPrivate(F callable) : m_callable(callable) {}
     void operator()(T value) override { m_callable(value); }
+
 private:
     F m_callable;
 };
 
 } // namespace QtWebEnginePrivate
 
-template <typename T>
+template<typename T>
 class QWebEngineCallback {
 public:
-    template <typename F>
+    template<typename F>
     QWebEngineCallback(F f)
         : d(new QtWebEnginePrivate::QWebEngineCallbackPrivate<T, F>(f))
-    { }
-    QWebEngineCallback() { }
+    {}
+    QWebEngineCallback() {}
     void swap(QWebEngineCallback &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
     operator bool() const { return d; }
+
 private:
     friend class QtWebEngineCore::CallbackDirectory;
-    QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> > d;
+    QExplicitlySharedDataPointer<QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T>> d;
 };
 
 Q_DECLARE_SHARED(QWebEngineCallback<int>)
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 24b4495df..133a86f6d 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -62,11 +62,11 @@
 #include <type_traits>
 
 // keep in sync with Q_DECLARE_SHARED... in qwebenginecallback.h
-#define FOR_EACH_TYPE(F) \
-    F(bool) \
-    F(int) \
-    F(const QString &) \
-    F(const QByteArray &) \
+#define FOR_EACH_TYPE(F)                                                                                               \
+    F(bool)                                                                                                            \
+    F(int)                                                                                                             \
+    F(const QString &)                                                                                                 \
+    F(const QByteArray &)                                                                                              \
     F(const QVariant &)
 
 namespace QtWebEngineCore {
@@ -82,7 +82,7 @@ public:
     {
         // "Cancel" pending callbacks by calling them with an invalid value.
         // This guarantees that each callback is called exactly once.
-        for (CallbackSharedDataPointerBase * const sharedPtrBase: m_callbackMap) {
+        for (CallbackSharedDataPointerBase *const sharedPtrBase : m_callbackMap) {
             Q_ASSERT(sharedPtrBase);
             sharedPtrBase->invokeEmpty();
             delete sharedPtrBase;
@@ -106,20 +106,18 @@ public:
     template<typename T>
     void invokeEmpty(const QWebEngineCallback<T> &callback);
 
-#define DEFINE_INVOKE_FOR_TYPE(Type) \
-    void invoke(quint64 callbackId, Type result) { \
-        invokeInternal<Type>(callbackId, std::forward<Type>(result)); \
-    }
+#define DEFINE_INVOKE_FOR_TYPE(Type)                                                                                   \
+    void invoke(quint64 callbackId, Type result) { invokeInternal<Type>(callbackId, std::forward<Type>(result)); }
     FOR_EACH_TYPE(DEFINE_INVOKE_FOR_TYPE)
 #undef DEFINE_INVOKE_FOR_TYPE
 
-    template <typename A>
+    template<typename A>
     void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type &> &callback, A &argument)
     {
         return callback.d.data()->operator()(argument);
     }
 
-    template <typename A>
+    template<typename A>
     void invokeDirectly(const QWebEngineCallback<typename std::remove_reference<A>::type> &callback, const A &argument)
     {
         return callback.d.data()->operator()(std::forward<const A &>(argument));
@@ -127,39 +125,45 @@ public:
 
 private:
     struct CallbackSharedDataPointerBase {
-        virtual ~CallbackSharedDataPointerBase() { }
+        virtual ~CallbackSharedDataPointerBase() {}
         virtual void invokeEmpty() = 0;
         virtual void doRef() = 0;
         virtual void doDeref() = 0;
-        virtual operator bool () const = 0;
+        virtual operator bool() const = 0;
     };
 
-    template <typename T>
+    template<typename T>
     struct CallbackSharedDataPointer : public CallbackSharedDataPointerBase {
-        CallbackDirectory* parent;
+        CallbackDirectory *parent;
         QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback;
 
         ~CallbackSharedDataPointer() { doDeref(); }
-        CallbackSharedDataPointer() : parent(0), callback(0) { }
+        CallbackSharedDataPointer() : parent(0), callback(0) {}
         CallbackSharedDataPointer(const CallbackSharedDataPointer<T> &other)
-            : parent(other.parent), callback(other.callback) { doRef(); }
+            : parent(other.parent), callback(other.callback)
+        {
+            doRef();
+        }
         CallbackSharedDataPointer(CallbackDirectory *p, QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *c)
-            : parent(p), callback(c) { Q_ASSERT(callback); doRef(); }
+            : parent(p), callback(c)
+        {
+            Q_ASSERT(callback);
+            doRef();
+        }
 
         void invokeEmpty() override;
-        operator bool () const override { return callback; }
+        operator bool() const override { return callback; }
 
     private:
         void doRef() override;
         void doDeref() override;
     };
 
-    QHash<quint64, CallbackSharedDataPointerBase*> m_callbackMap;
+    QHash<quint64, CallbackSharedDataPointerBase *> m_callbackMap;
 };
 
 template<typename T>
-inline
-void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback)
+inline void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCallback<T> &callback)
 {
     if (!callback.d)
         return;
@@ -167,10 +171,9 @@ void CallbackDirectory::registerCallback(quint64 callbackId, const QWebEngineCal
 }
 
 template<typename T>
-inline
-void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
+inline void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
 {
-    CallbackSharedDataPointerBase * const sharedPtrBase = m_callbackMap.take(callbackId);
+    CallbackSharedDataPointerBase *const sharedPtrBase = m_callbackMap.take(callbackId);
     if (!sharedPtrBase)
         return;
 
@@ -181,8 +184,7 @@ void CallbackDirectory::invokeInternal(quint64 callbackId, T result)
 }
 
 template<typename T>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<T> *callback)
 {
     Q_ASSERT(callback);
     using NoRefT = typename std::remove_reference<T>::type;
@@ -192,24 +194,21 @@ void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallba
 }
 
 template<>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<bool> *callback)
 {
     Q_ASSERT(callback);
     (*callback)(false);
 }
 
 template<>
-inline
-void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<int> *callback)
+inline void CallbackDirectory::invokeEmptyInternal(QtWebEnginePrivate::QWebEngineCallbackPrivateBase<int> *callback)
 {
     Q_ASSERT(callback);
     (*callback)(0);
 }
 
 template<typename T>
-inline
-void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
+inline void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
 {
     if (!callback.d)
         return;
@@ -217,9 +216,8 @@ void CallbackDirectory::invokeEmpty(const QWebEngineCallback<T> &callback)
     invokeEmptyInternal(callback.d.data());
 }
 
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
 {
     if (!callback)
         return;
@@ -227,9 +225,8 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::doRef()
     callback->ref.ref();
 }
 
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
 {
     if (!callback)
         return;
@@ -237,9 +234,8 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::doDeref()
         delete callback;
 }
 
-template <typename T>
-inline
-void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
+template<typename T>
+inline void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
 {
     if (!callback)
         return;
@@ -248,8 +244,7 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty()
     parent->invokeEmptyInternal(callback);
 }
 
-#define CHECK_RELOCATABLE(x) \
-  Q_STATIC_ASSERT((QTypeInfoQuery<QWebEngineCallback< x > >::isRelocatable));
+#define CHECK_RELOCATABLE(x) Q_STATIC_ASSERT((QTypeInfoQuery<QWebEngineCallback<x>>::isRelocatable));
 FOR_EACH_TYPE(CHECK_RELOCATABLE)
 #undef CHECK_RELOCATABLE
 
diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp
index 0c059bcca..84f273328 100644
--- a/src/core/api/qwebengineclientcertificatestore.cpp
+++ b/src/core/api/qwebengineclientcertificatestore.cpp
@@ -61,9 +61,8 @@ QT_BEGIN_NAMESPACE
 */
 
 QWebEngineClientCertificateStore::QWebEngineClientCertificateStore(QtWebEngineCore::ClientCertificateStoreData *storeData)
-        : m_storeData(storeData)
-{
-}
+    : m_storeData(storeData)
+{}
 
 /*!
     Destroys this QWebEngineClientCertificateStore object.
diff --git a/src/core/api/qwebengineclientcertificatestore.h b/src/core/api/qwebengineclientcertificatestore.h
index 68705e80b..a4c83bb2e 100644
--- a/src/core/api/qwebengineclientcertificatestore.h
+++ b/src/core/api/qwebengineclientcertificatestore.h
@@ -49,7 +49,7 @@
 namespace QtWebEngineCore {
 struct ClientCertificateStoreData;
 class ProfileAdapter;
-}
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 3897fb128..40594b9c0 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -47,15 +47,14 @@
 #include <QByteArray>
 #include <QUrl>
 
-
 namespace {
 
-inline GURL toGurl(const QUrl& url)
+inline GURL toGurl(const QUrl &url)
 {
     return GURL(url.toString().toStdString());
 }
 
-}
+} // namespace
 
 QT_BEGIN_NAMESPACE
 
@@ -68,8 +67,7 @@ QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore
     , m_deleteAllCookiesPending(false)
     , m_getAllCookiesPending(false)
     , delegate(0)
-{
-}
+{}
 
 void QWebEngineCookieStorePrivate::processPendingUserCookies()
 {
@@ -112,7 +110,8 @@ void QWebEngineCookieStorePrivate::rejectPendingUserCookies()
     m_pendingUserCookies.clear();
 }
 
-void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin)
+void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie,
+                                             const QUrl &origin)
 {
     const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId);
 
@@ -201,7 +200,7 @@ bool QWebEngineCookieStorePrivate::canAccessCookies(const QUrl &firstPartyUrl, c
                                                                 toGurl(firstPartyUrl),
                                                                 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
 
-    QWebEngineCookieStore::FilterRequest request = { firstPartyUrl, url, thirdParty, false, 0};
+    QWebEngineCookieStore::FilterRequest request = { firstPartyUrl, url, thirdParty, false, 0 };
     return filterCallback(request);
 }
 
@@ -249,10 +248,7 @@ QWebEngineCookieStore::QWebEngineCookieStore(QObject *parent)
     Destroys this QWebEngineCookieStore object.
 */
 
-QWebEngineCookieStore::~QWebEngineCookieStore()
-{
-
-}
+QWebEngineCookieStore::~QWebEngineCookieStore() {}
 
 /*!
     Adds \a cookie to the cookie store.
@@ -298,7 +294,8 @@ void QWebEngineCookieStore::loadAllCookies()
     //TODO: use callbacks or delete dummy ones
     if (d_ptr->m_getAllCookiesPending)
         return;
-    d_ptr->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId, QWebEngineCallback<const QByteArray&>());
+    d_ptr->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId,
+                                              QWebEngineCallback<const QByteArray &>());
     //this will trigger cookieAdded signal
     d_ptr->getAllCookies();
 }
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h
index 36bb64ccf..3d313ac23 100644
--- a/src/core/api/qwebenginecookiestore.h
+++ b/src/core/api/qwebenginecookiestore.h
@@ -52,7 +52,7 @@
 namespace QtWebEngineCore {
 class ProfileAdapter;
 class CookieMonsterDelegateQt;
-}
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
@@ -93,6 +93,6 @@ private:
 
 QT_END_NAMESPACE
 
-Q_DECLARE_METATYPE(QWebEngineCookieStore*)
+Q_DECLARE_METATYPE(QWebEngineCookieStore *)
 
 #endif // QWEBENGINECOOKIESTORE_H
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index 3df0e3590..a79e2b095 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -66,8 +66,7 @@ class CookieMonsterDelegateQt;
 
 QT_BEGIN_NAMESPACE
 
-class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate
-{
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
     Q_DECLARE_PUBLIC(QWebEngineCookieStore)
     struct CookieData {
         quint64 callbackId;
@@ -76,9 +75,10 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate
     };
     friend class QTypeInfo<CookieData>;
     QWebEngineCookieStore *q_ptr;
+
 public:
     QtWebEngineCore::CallbackDirectory callbackDirectory;
-    std::function<bool(const QWebEngineCookieStore::FilterRequest&)> filterCallback;
+    std::function<bool(const QWebEngineCookieStore::FilterRequest &)> filterCallback;
     QVector<CookieData> m_pendingUserCookies;
     quint64 m_nextCallbackId;
     bool m_deleteSessionCookiesPending;
diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp
index b64af4466..3395cc99f 100644
--- a/src/core/api/qwebenginehttprequest.cpp
+++ b/src/core/api/qwebenginehttprequest.cpp
@@ -67,8 +67,7 @@ QT_BEGIN_NAMESPACE
     \value Post The POST method.
 */
 
-class QWebEngineHttpRequestPrivate : public QSharedData
-{
+class QWebEngineHttpRequestPrivate : public QSharedData {
 public:
     QUrl url;
     QWebEngineHttpRequest::Method method;
@@ -77,23 +76,18 @@ public:
     Headers headers;
     QByteArray postData;
 
-    inline QWebEngineHttpRequestPrivate()
-    {
-    }
+    QWebEngineHttpRequestPrivate() {}
 
-    ~QWebEngineHttpRequestPrivate()
-    {
-    }
+    ~QWebEngineHttpRequestPrivate() {}
 
-    QWebEngineHttpRequestPrivate(const QWebEngineHttpRequestPrivate &other)
-        : QSharedData(other)
+    QWebEngineHttpRequestPrivate(const QWebEngineHttpRequestPrivate &other) : QSharedData(other)
     {
         method = other.method;
         url = other.url;
         headers = other.headers;
     }
 
-    inline bool operator==(const QWebEngineHttpRequestPrivate &other) const
+    bool operator==(const QWebEngineHttpRequestPrivate &other) const
     {
         return method == other.method
             && url == other.url
@@ -128,10 +122,7 @@ QWebEngineHttpRequest::QWebEngineHttpRequest(const QUrl &url,
 /*!
     Creates a copy of \a other.
 */
-QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other)
-    : d(other.d)
-{
-}
+QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other) : d(other.d) {}
 
 /*!
     Disposes of the QWebEngineHttpRequest object.
@@ -207,7 +198,6 @@ QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url,
     return result;
 }
 
-
 /*!
     Returns the method this WebEngine request is using.
 
@@ -291,8 +281,7 @@ bool QWebEngineHttpRequest::hasHeader(const QByteArray &headerName) const
 */
 QByteArray QWebEngineHttpRequest::header(const QByteArray &headerName) const
 {
-    QWebEngineHttpRequestPrivate::Headers::ConstIterator it =
-        d->findHeader(headerName);
+    QWebEngineHttpRequestPrivate::Headers::ConstIterator it = d->findHeader(headerName);
     if (it != d->headers.constEnd())
         return it->second;
     return QByteArray();
@@ -334,16 +323,15 @@ void QWebEngineHttpRequest::unsetHeader(const QByteArray &key)
     d->setHeader(key, QByteArray());
 }
 
-QWebEngineHttpRequestPrivate::Headers::ConstIterator
-QWebEngineHttpRequestPrivate::findHeader(const QByteArray &key) const
+QWebEngineHttpRequestPrivate::Headers::ConstIterator QWebEngineHttpRequestPrivate::findHeader(const QByteArray &key) const
 {
     Headers::ConstIterator it = headers.constBegin();
     Headers::ConstIterator end = headers.constEnd();
-    for ( ; it != end; ++it)
+    for (; it != end; ++it)
         if (qstricmp(it->first.constData(), key.constData()) == 0)
             return it;
 
-    return end;                 // not found
+    return end; // not found
 }
 
 QWebEngineHttpRequestPrivate::Headers QWebEngineHttpRequestPrivate::allHeaders() const
@@ -355,9 +343,8 @@ QVector<QByteArray> QWebEngineHttpRequestPrivate::headersKeys() const
 {
     QVector<QByteArray> result;
     result.reserve(headers.size());
-    Headers::ConstIterator it = headers.constBegin(),
-                               end = headers.constEnd();
-    for ( ; it != end; ++it)
+    Headers::ConstIterator it = headers.constBegin(), end = headers.constEnd();
+    for (; it != end; ++it)
         result << it->first;
 
     return result;
@@ -385,8 +372,7 @@ void QWebEngineHttpRequestPrivate::unsetHeader(const QByteArray &key)
     auto firstEqualsKey = [&key](const HeaderPair &header) {
         return qstricmp(header.first.constData(), key.constData()) == 0;
     };
-    headers.erase(std::remove_if(headers.begin(), headers.end(), firstEqualsKey),
-                  headers.end());
+    headers.erase(std::remove_if(headers.begin(), headers.end(), firstEqualsKey), headers.end());
 }
 
 /*!
@@ -408,7 +394,7 @@ void QWebEngineHttpRequestPrivate::setHeaderInternal(const QByteArray &key, cons
     unsetHeader(key);
 
     if (value.isNull())
-        return;                 // only wanted to erase key
+        return; // only wanted to erase key
 
     HeaderPair pair;
     pair.first = key;
diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h
index 8735dfb8e..1c4d7837b 100644
--- a/src/core/api/qwebenginehttprequest.h
+++ b/src/core/api/qwebenginehttprequest.h
@@ -49,11 +49,9 @@
 
 QT_BEGIN_NAMESPACE
 
-
 class QWebEngineHttpRequestPrivate;
 
-class Q_WEBENGINECORE_EXPORT QWebEngineHttpRequest
-{
+class Q_WEBENGINECORE_EXPORT QWebEngineHttpRequest {
 public:
     enum Method {
         Get,
@@ -61,22 +59,23 @@ public:
     };
 
     explicit QWebEngineHttpRequest(const QUrl &url = QUrl(),
-                          const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get);
+                                   const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get);
     QWebEngineHttpRequest(const QWebEngineHttpRequest &other);
     ~QWebEngineHttpRequest();
 #ifdef Q_COMPILER_RVALUE_REFS
-    QWebEngineHttpRequest &operator=(QWebEngineHttpRequest &&other) Q_DECL_NOTHROW { swap(other);
-                                                                                     return *this; }
+    QWebEngineHttpRequest &operator=(QWebEngineHttpRequest &&other) Q_DECL_NOTHROW
+    {
+        swap(other);
+        return *this;
+    }
 #endif
     QWebEngineHttpRequest &operator=(const QWebEngineHttpRequest &other);
 
-    static QWebEngineHttpRequest postRequest(const QUrl &url,
-                                             const QMap<QString, QString> &postData);
+    static QWebEngineHttpRequest postRequest(const QUrl &url, const QMap<QString, QString> &postData);
     void swap(QWebEngineHttpRequest &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
 
     bool operator==(const QWebEngineHttpRequest &other) const;
-    inline bool operator!=(const QWebEngineHttpRequest &other) const
-    { return !operator==(other); }
+    inline bool operator!=(const QWebEngineHttpRequest &other) const { return !operator==(other); }
 
     Method method() const;
     void setMethod(QWebEngineHttpRequest::Method method);
diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h
index 46ed62f54..07b2ca203 100644
--- a/src/core/api/qwebenginemessagepumpscheduler_p.h
+++ b/src/core/api/qwebenginemessagepumpscheduler_p.h
@@ -59,8 +59,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject
-{
+class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject {
     Q_OBJECT
 public:
     QWebEngineMessagePumpScheduler(std::function<void()> callback);
diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp
index 0b1d48ce9..f91eabd25 100644
--- a/src/core/api/qwebenginenotification.cpp
+++ b/src/core/api/qwebenginenotification.cpp
@@ -90,13 +90,11 @@ public:
 */
 QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotificationController> &controller)
     : d_ptr(new QWebEngineNotificationPrivate(this, controller))
-{ }
+{}
 
 /*! \internal
 */
-QWebEngineNotification::~QWebEngineNotification()
-{
-}
+QWebEngineNotification::~QWebEngineNotification() {}
 
 /*!
     Returns \c true if the two notifications belong to the same message chain.
diff --git a/src/core/api/qwebenginequotarequest.cpp b/src/core/api/qwebenginequotarequest.cpp
index 49c9f041f..7686d0806 100644
--- a/src/core/api/qwebenginequotarequest.cpp
+++ b/src/core/api/qwebenginequotarequest.cpp
@@ -64,8 +64,7 @@ QT_BEGIN_NAMESPACE
 /*! \internal */
 QWebEngineQuotaRequest::QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController> controller)
     : d_ptr(controller)
-{
-}
+{}
 
 /*!
     Rejects a request for larger persistent storage.
diff --git a/src/core/api/qwebenginequotarequest.h b/src/core/api/qwebenginequotarequest.h
index 1f6333b3b..da72116c8 100644
--- a/src/core/api/qwebenginequotarequest.h
+++ b/src/core/api/qwebenginequotarequest.h
@@ -47,7 +47,7 @@
 namespace QtWebEngineCore {
 class QuotaPermissionContextQt;
 class QuotaRequestController;
-}
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
@@ -63,6 +63,7 @@ public:
     qint64 requestedSize() const;
     bool operator==(const QWebEngineQuotaRequest &that) const { return d_ptr == that.d_ptr; }
     bool operator!=(const QWebEngineQuotaRequest &that) const { return d_ptr != that.d_ptr; }
+
 private:
     QWebEngineQuotaRequest(QSharedPointer<QtWebEngineCore::QuotaRequestController>);
     friend QtWebEngineCore::QuotaPermissionContextQt;
diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
index 1921f78f4..a3960327d 100644
--- a/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
+++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
 
 /*! \internal */
 QWebEngineRegisterProtocolHandlerRequest::QWebEngineRegisterProtocolHandlerRequest(
-    QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr)
+        QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr)
     : d_ptr(std::move(d_ptr))
 {}
 
diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.h b/src/core/api/qwebengineregisterprotocolhandlerrequest.h
index 281e81e73..67caf1590 100644
--- a/src/core/api/qwebengineregisterprotocolhandlerrequest.h
+++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.h
@@ -47,7 +47,7 @@
 namespace QtWebEngineCore {
 class RegisterProtocolHandlerRequestController;
 class WebContentsDelegateQt;
-}
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
@@ -63,9 +63,9 @@ public:
     QString scheme() const;
     bool operator==(const QWebEngineRegisterProtocolHandlerRequest &that) const { return d_ptr == that.d_ptr; }
     bool operator!=(const QWebEngineRegisterProtocolHandlerRequest &that) const { return d_ptr != that.d_ptr; }
+
 private:
-    QWebEngineRegisterProtocolHandlerRequest(
-        QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController>);
+    QWebEngineRegisterProtocolHandlerRequest(QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController>);
     friend QtWebEngineCore::WebContentsDelegateQt;
     QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerRequestController> d_ptr;
 };
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 16b282e74..3cbb4da17 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -68,8 +68,10 @@ ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeLast, content::RESOURCE
 
 ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::LinkNavigation, QWebEngineUrlRequestInfo::NavigationTypeLink)
 ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::TypedNavigation, QWebEngineUrlRequestInfo::NavigationTypeTyped)
-ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::FormSubmittedNavigation, QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted)
-ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::BackForwardNavigation, QWebEngineUrlRequestInfo::NavigationTypeBackForward)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::FormSubmittedNavigation,
+                   QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::BackForwardNavigation,
+                   QWebEngineUrlRequestInfo::NavigationTypeBackForward)
 ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::ReloadNavigation, QWebEngineUrlRequestInfo::NavigationTypeReload)
 ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, QWebEngineUrlRequestInfo::NavigationTypeOther)
 
@@ -124,8 +126,9 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q
     execution of this function is finished.
 */
 
-
-QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu, const QByteArray &m)
+QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
+                                                                 QWebEngineUrlRequestInfo::NavigationType navigation,
+                                                                 const QUrl &u, const QUrl &fpu, const QByteArray &m)
     : resourceType(resource)
     , navigationType(navigation)
     , shouldBlockRequest(false)
@@ -133,31 +136,24 @@ QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRe
     , firstPartyUrl(fpu)
     , method(m)
     , changed(false)
-{
-}
+{}
 
 /*!
     \internal
 */
-QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfo &&p)
-    : d_ptr(p.d_ptr.take())
-{
-}
+QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfo &&p) : d_ptr(p.d_ptr.take()) {}
 
 /*!
     \internal
 */
 
-QWebEngineUrlRequestInfo::~QWebEngineUrlRequestInfo()
-{
-}
+QWebEngineUrlRequestInfo::~QWebEngineUrlRequestInfo() {}
 
 /*!
     \internal
 */
 
-QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPrivate *p)
-    : d_ptr(p)
+QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPrivate *p) : d_ptr(p)
 {
     d_ptr->q_ptr = this;
 }
@@ -247,7 +243,6 @@ QUrl QWebEngineUrlRequestInfo::firstPartyUrl() const
     return d_ptr->firstPartyUrl;
 }
 
-
 /*!
     Returns the HTTP method of the request (for example, GET or POST).
 */
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index f37693cda..cf5a4801d 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -48,7 +48,7 @@
 namespace QtWebEngineCore {
 class NetworkDelegateQt;
 class URLRequestNotification;
-}
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index 9afd04398..9d795b2b5 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -65,15 +65,12 @@ class URLRequest;
 
 QT_BEGIN_NAMESPACE
 
-class QWebEngineUrlRequestInfoPrivate
-{
+class QWebEngineUrlRequestInfoPrivate {
     Q_DECLARE_PUBLIC(QWebEngineUrlRequestInfo)
 public:
-    QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource
-                                    , QWebEngineUrlRequestInfo::NavigationType navigation
-                                    , const QUrl &u
-                                    , const QUrl &fpu
-                                    , const QByteArray &m);
+    QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
+                                    QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu,
+                                    const QByteArray &m);
 
     QWebEngineUrlRequestInfo::ResourceType resourceType;
     QWebEngineUrlRequestInfo::NavigationType navigationType;
diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h
index 027486b40..4d3020306 100644
--- a/src/core/api/qwebengineurlrequestinterceptor.h
+++ b/src/core/api/qwebengineurlrequestinterceptor.h
@@ -50,15 +50,11 @@
 
 QT_BEGIN_NAMESPACE
 
-class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject
-{
+class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject {
     Q_OBJECT
     Q_DISABLE_COPY(QWebEngineUrlRequestInterceptor)
 public:
-    explicit QWebEngineUrlRequestInterceptor(QObject *p = nullptr)
-        : QObject (p)
-    {
-    }
+    explicit QWebEngineUrlRequestInterceptor(QObject *p = nullptr) : QObject(p) {}
 
     virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
 };
diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp
index bc860b3b3..3bb9d1732 100644
--- a/src/core/api/qwebengineurlrequestjob.cpp
+++ b/src/core/api/qwebengineurlrequestjob.cpp
@@ -84,11 +84,10 @@ QT_BEGIN_NAMESPACE
 /*!
     \internal
  */
-QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate * p)
+QWebEngineUrlRequestJob::QWebEngineUrlRequestJob(URLRequestCustomJobDelegate *p)
     : QObject(p) // owned by the jobdelegate and deleted when the job is done
     , d_ptr(p)
-{
-}
+{}
 
 /*!
     \internal
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index dee09b6e1..6d4a9e734 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -49,7 +49,7 @@
 namespace QtWebEngineCore {
 class URLRequestCustomJobDelegate;
 class URLRequestCustomJobProxy;
-} // namespace
+} // namespace QtWebEngineCore
 
 QT_BEGIN_NAMESPACE
 
@@ -83,7 +83,7 @@ private:
     QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *);
     friend class QtWebEngineCore::URLRequestCustomJobProxy;
 
-    QtWebEngineCore::URLRequestCustomJobDelegate* d_ptr;
+    QtWebEngineCore::URLRequestCustomJobDelegate *d_ptr;
 };
 
 QT_END_NAMESPACE
diff --git a/src/core/api/qwebengineurlscheme.cpp b/src/core/api/qwebengineurlscheme.cpp
index 9cc5b5056..f4efad717 100644
--- a/src/core/api/qwebengineurlscheme.cpp
+++ b/src/core/api/qwebengineurlscheme.cpp
@@ -48,8 +48,7 @@ QT_BEGIN_NAMESPACE
 ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::Path, url::SCHEME_WITHOUT_AUTHORITY)
 ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::Host, url::SCHEME_WITH_HOST)
 ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostAndPort, url::SCHEME_WITH_HOST_AND_PORT)
-ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostPortAndUserInformation,
-                   url::SCHEME_WITH_HOST_PORT_AND_USER_INFORMATION)
+ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::Syntax::HostPortAndUserInformation, url::SCHEME_WITH_HOST_PORT_AND_USER_INFORMATION)
 
 ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::PortUnspecified, url::PORT_UNSPECIFIED)
 
@@ -193,10 +192,7 @@ public:
   Content-Security-Policy checks.
 */
 
-QWebEngineUrlScheme::QWebEngineUrlScheme(QWebEngineUrlSchemePrivate *d)
-    : d(d)
-{
-}
+QWebEngineUrlScheme::QWebEngineUrlScheme(QWebEngineUrlSchemePrivate *d) : d(d) {}
 
 /*!
   Constructs a web engine URL scheme with default values.
@@ -399,7 +395,7 @@ void QWebEngineUrlScheme::registerScheme(const QWebEngineUrlScheme &scheme)
 */
 QWebEngineUrlScheme QWebEngineUrlScheme::schemeByName(const QByteArray &name)
 {
-    base::StringPiece namePiece{name.data(), static_cast<size_t>(name.size())};
+    base::StringPiece namePiece{ name.data(), static_cast<size_t>(name.size()) };
     if (const url::CustomScheme *cs = url::CustomScheme::FindScheme(namePiece))
         return QWebEngineUrlScheme(new QWebEngineUrlSchemePrivate(*cs));
     return QWebEngineUrlScheme();
diff --git a/src/core/api/qwebengineurlscheme.h b/src/core/api/qwebengineurlscheme.h
index f3ceb0596..095b47320 100644
--- a/src/core/api/qwebengineurlscheme.h
+++ b/src/core/api/qwebengineurlscheme.h
@@ -46,7 +46,9 @@
 #include <QtCore/qobjectdefs.h>
 #include <QtCore/qshareddata.h>
 
-namespace QtWebEngineCore { class WebEngineContext; }
+namespace QtWebEngineCore {
+class WebEngineContext;
+}
 
 QT_BEGIN_NAMESPACE
 
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index be80241f1..09c5b08cb 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -58,7 +58,7 @@ public:
     QWebEngineUrlSchemeHandler(QObject *parent = Q_NULLPTR);
     ~QWebEngineUrlSchemeHandler();
 
-    virtual void requestStarted(QWebEngineUrlRequestJob*) = 0;
+    virtual void requestStarted(QWebEngineUrlRequestJob *) = 0;
 
 private:
     Q_DISABLE_COPY(QWebEngineUrlSchemeHandler)
-- 
GitLab