diff options
author | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-06-03 17:40:47 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-08 10:56:06 +0000 |
commit | bfef77e3ca0d82253fb70ff178ff5a826c671d55 (patch) | |
tree | 16410be11395919549c5d56ee93fa2f2ced4ae1a /src/core/api | |
parent | 8d9623c005c073f102097adcc1555fe93555b359 (diff) |
Add public QtWebEngineCore C++ API
This patch introduces a new public C++ API layer in preparation to make
it possible to integrate with lower level Chromium features related mostly
to networking operations like accessing and blocking cookies, custom
request headers, etc.
This API layer can be used both by Qt Widgets and Qt Quick applications
with a small C++ core. It should contatain API to access features that
usually run on the IO thread to make it possible to perform heavy tasks
that would otherwise require costly context switches to the UI thread.
Furthermore for these features a QML API does either not make sense,
since they are non-UI-related, or a QML API is simply not feasible,
because the API is meant for advanced usecases like web browser
development (i.e. custom protocol handlers, network traffic
interception cookie syncing, etc.).
In the long term this layer could also make it possible to reduce code
duplication in the widgets and quick layers by moving common parts to
the core layer.
The new API is built entirely by qmake as a separate static library which
is then linked into the QtWebEngineCore library built by gyp and ninja,
to prevent the build options passed to Chromium to break the API layer.
As a first step this only contains the global headers for core.
Change-Id: Iccf8544587cde7c0d9c6abd462e4766bf9ec81ae
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
Diffstat (limited to 'src/core/api')
-rw-r--r-- | src/core/api/core_api.pro | 32 | ||||
-rw-r--r-- | src/core/api/dummy.cpp | 1 | ||||
-rw-r--r-- | src/core/api/qtwebenginecoreglobal.h | 50 | ||||
-rw-r--r-- | src/core/api/qtwebenginecoreglobal_p.h | 63 |
4 files changed, 146 insertions, 0 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro new file mode 100644 index 000000000..829b59925 --- /dev/null +++ b/src/core/api/core_api.pro @@ -0,0 +1,32 @@ +TARGET = qtwebenginecoreapi +DESTDIR = $$OUT_PWD/$$getConfigDir() + +TEMPLATE = lib + +CONFIG += staticlib c++11 + +# Don't create .prl file for this intermediate library because +# their contents get used when linking against them, breaking +# "-Wl,-whole-archive -lqtwebenginecoreapi --Wl,-no-whole-archive" +CONFIG -= create_prl + +# Copy this logic from qt_module.prf so that the intermediate library can be +# created to the same rules as the final module linking in core_module.pro. +!host_build:if(win32|mac):!macx-xcode { + contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release + contains(QT_CONFIG, build_all):CONFIG += build_all +} + +DEFINES += BUILDING_CHROMIUM + +CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() +INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \ + $$CHROMIUM_SRC_DIR + +linux-g++*: QMAKE_CXXFLAGS += -Wno-unused-parameter + +HEADERS = \ + qtwebenginecoreglobal.h \ + qtwebenginecoreglobal_p.h \ + +SOURCES = dummy.cpp \ diff --git a/src/core/api/dummy.cpp b/src/core/api/dummy.cpp new file mode 100644 index 000000000..3c2a8e265 --- /dev/null +++ b/src/core/api/dummy.cpp @@ -0,0 +1 @@ +// Used when we need to compile with no source code diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h new file mode 100644 index 000000000..16daaab7d --- /dev/null +++ b/src/core/api/qtwebenginecoreglobal.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTWEBENGINECOREGLOBAL_H +#define QTWEBENGINECOREGLOBAL_H + +#include <QtCore/qglobal.h> + +#if defined(BUILDING_CHROMIUM) +# define QWEBENGINE_EXPORT Q_DECL_EXPORT +#else +# define QWEBENGINE_EXPORT Q_DECL_IMPORT +#endif + +#define ASSERT_ENUMS_MATCH(A, B) Q_STATIC_ASSERT_X(static_cast<int>(A) == static_cast<int>(B), "The enum values must match"); + +#endif // QTWEBENGINECOREGLOBAL_H diff --git a/src/core/api/qtwebenginecoreglobal_p.h b/src/core/api/qtwebenginecoreglobal_p.h new file mode 100644 index 000000000..e93ca9c2c --- /dev/null +++ b/src/core/api/qtwebenginecoreglobal_p.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTWEBENGINECOREGLOBAL_P_H +#define QTWEBENGINECOREGLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qtwebenginecoreglobal.h" + +#ifdef QT_WEBENGINE_LOGGING +#define QT_NOT_YET_IMPLEMENTED fprintf(stderr, "function %s not implemented! - %s:%d\n", __func__, __FILE__, __LINE__); +#define QT_NOT_USED fprintf(stderr, "# function %s should not be used! - %s:%d\n", __func__, __FILE__, __LINE__); Q_UNREACHABLE(); +#else +#define QT_NOT_YET_IMPLEMENTED qt_noop(); +#define QT_NOT_USED Q_UNREACHABLE(); // This will assert in debug. +#endif + +#define QWEBENGINE_PRIVATE_EXPORT QWEBENGINE_EXPORT + +#endif // QTWEBENGINECOREGLOBAL_P_H |