From b69da78438492af157bb03d5d76a701538db5470 Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Wed, 20 Nov 2013 16:18:11 +0100
Subject: [PATCH] Get rid of the intermediate "shared" static library.

It is not necessary anymore since QtWebEngineProcess dynamically
links to the core library which will now contain those symbols.

Change-Id: I3475347bab41a00b943f934a5e341326c66dc726
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 lib/browser_context_qt.h                      |  3 +-
 .../chromium_overrides.cpp                    |  2 +-
 .../chromium_overrides.h                      | 12 ++-----
 lib/download_manager_delegate_qt.cpp          |  2 +-
 lib/lib.pro                                   |  5 ++-
 lib/qtwebenginecoreglobal.h                   |  8 +++++
 lib/render_widget_host_view_qt.cpp            |  3 +-
 lib/render_widget_host_view_qt.h              |  1 -
 {shared => lib}/resource_bundle_qt.cpp        |  0
 lib/web_engine_context.cpp                    |  1 -
 qtwebengine.gyp                               |  1 -
 qtwebengine.pro                               |  4 +--
 shared/shared.pro                             | 33 -------------------
 13 files changed, 19 insertions(+), 56 deletions(-)
 rename shared/shared_globals.cpp => lib/chromium_overrides.cpp (99%)
 rename shared/shared_globals.h => lib/chromium_overrides.h (82%)
 rename {shared => lib}/resource_bundle_qt.cpp (100%)
 delete mode 100644 shared/shared.pro

diff --git a/lib/browser_context_qt.h b/lib/browser_context_qt.h
index 88bba1e9e..382b08ff3 100644
--- a/lib/browser_context_qt.h
+++ b/lib/browser_context_qt.h
@@ -46,8 +46,6 @@
 
 #include "base/files/scoped_temp_dir.h"
 
-#include "shared/shared_globals.h"
-
 #include "base/time/time.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/content_browser_client.h"
@@ -65,6 +63,7 @@
 #include <QStringBuilder>
 
 #include "download_manager_delegate_qt.h"
+#include "qtwebenginecoreglobal.h"
 #include "resource_context_qt.h"
 #include "type_conversion.h"
 #include "url_request_context_getter_qt.h"
diff --git a/shared/shared_globals.cpp b/lib/chromium_overrides.cpp
similarity index 99%
rename from shared/shared_globals.cpp
rename to lib/chromium_overrides.cpp
index 3d20ad45d..383fc6587 100644
--- a/shared/shared_globals.cpp
+++ b/lib/chromium_overrides.cpp
@@ -39,7 +39,7 @@
 **
 ****************************************************************************/
 
-#include "shared_globals.h"
+#include "chromium_overrides.h"
 
 #include "base/message_loop/message_pump_gtk.h"
 #include "content/browser/renderer_host/render_widget_host_view_base.h"
diff --git a/shared/shared_globals.h b/lib/chromium_overrides.h
similarity index 82%
rename from shared/shared_globals.h
rename to lib/chromium_overrides.h
index 6ad97e181..cda4d7e66 100644
--- a/shared/shared_globals.h
+++ b/lib/chromium_overrides.h
@@ -39,20 +39,12 @@
 **
 ****************************************************************************/
 
-#ifndef SHARED_GLOBALS_H
-#define SHARED_GLOBALS_H
+#ifndef CHROMIUM_OVERRIDES_H
+#define CHROMIUM_OVERRIDES_H
 
 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
 #include <QtGlobal>
 
-#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
-
 QT_BEGIN_NAMESPACE
 class QWindow;
 QT_END_NAMESPACE
diff --git a/lib/download_manager_delegate_qt.cpp b/lib/download_manager_delegate_qt.cpp
index 633d203ae..27b61b1c9 100644
--- a/lib/download_manager_delegate_qt.cpp
+++ b/lib/download_manager_delegate_qt.cpp
@@ -44,7 +44,6 @@
 #include "content/public/browser/download_item.h"
 #include "content/public/browser/save_page_type.h"
 #include "content/public/browser/web_contents.h"
-#include "shared/shared_globals.h"
 
 #include <QDir>
 #include <QFile>
@@ -53,6 +52,7 @@
 #include <QStandardPaths>
 
 #include "type_conversion.h"
+#include "qtwebenginecoreglobal.h"
 
 // Helper class to track currently ongoing downloads to prevent file name
 // clashes / overwriting of files.
diff --git a/lib/lib.pro b/lib/lib.pro
index 9e51b3c58..c1266626b 100644
--- a/lib/lib.pro
+++ b/lib/lib.pro
@@ -2,7 +2,7 @@
 # We want the gyp generation step to happen after all the other config steps. For that we need to prepend
 # our gyp_generator.prf feature to the CONFIG variable since it is processed backwards
 CONFIG = gyp_generator $$CONFIG
-GYPDEPENDENCIES += ../shared/shared.gyp:qtwebengine_shared <(chromium_src_dir)/content/browser/devtools/devtools_resources.gyp:devtools_resources
+GYPDEPENDENCIES += <(chromium_src_dir)/content/browser/devtools/devtools_resources.gyp:devtools_resources
 GYPINCLUDES += ../qtwebengine.gypi
 
 TEMPLATE = lib
@@ -40,6 +40,7 @@ INCLUDEPATH += $$[QT_INSTALL_HEADERS]
 
 SOURCES = \
         backing_store_qt.cpp \
+        chromium_overrides.cpp \
         content_client_qt.cpp \
         content_browser_client_qt.cpp \
         delegated_frame_node.cpp \
@@ -49,6 +50,7 @@ SOURCES = \
         javascript_dialog_manager_qt.cpp \
         process_main.cpp \
         render_widget_host_view_qt.cpp \
+        resource_bundle_qt.cpp \
         resource_context_qt.cpp \
         url_request_context_getter_qt.cpp \
         web_contents_adapter.cpp \
@@ -61,6 +63,7 @@ SOURCES = \
 HEADERS = \
         backing_store_qt.h \
         browser_context_qt.h \
+        chromium_overrides.h \
         content_client_qt.h \
         content_browser_client_qt.h \
         delegated_frame_node.h \
diff --git a/lib/qtwebenginecoreglobal.h b/lib/qtwebenginecoreglobal.h
index 3ad62b4b9..b84c321d0 100644
--- a/lib/qtwebenginecoreglobal.h
+++ b/lib/qtwebenginecoreglobal.h
@@ -43,6 +43,14 @@
 
 #include <QtCore/qglobal.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
+
 #ifndef QT_STATIC
 #  if defined(BUILDING_CHROMIUM)
 #      define QWEBENGINE_EXPORT Q_DECL_EXPORT
diff --git a/lib/render_widget_host_view_qt.cpp b/lib/render_widget_host_view_qt.cpp
index 84192bef0..91e9ab585 100644
--- a/lib/render_widget_host_view_qt.cpp
+++ b/lib/render_widget_host_view_qt.cpp
@@ -42,13 +42,12 @@
 #include "render_widget_host_view_qt.h"
 
 #include "backing_store_qt.h"
+#include "chromium_overrides.h"
 #include "delegated_frame_node.h"
 #include "render_widget_host_view_qt_delegate.h"
 #include "type_conversion.h"
 #include "web_event_factory.h"
 
-#include "shared/shared_globals.h"
-
 #include "cc/output/compositor_frame_ack.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/renderer_host/ui_events_helper.h"
diff --git a/lib/render_widget_host_view_qt.h b/lib/render_widget_host_view_qt.h
index bf29938c6..c6ca93657 100644
--- a/lib/render_widget_host_view_qt.h
+++ b/lib/render_widget_host_view_qt.h
@@ -43,7 +43,6 @@
 #define RENDER_WIDGET_HOST_VIEW_QT_H
 
 #include "render_widget_host_view_qt_delegate.h"
-#include "shared/shared_globals.h"
 
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
diff --git a/shared/resource_bundle_qt.cpp b/lib/resource_bundle_qt.cpp
similarity index 100%
rename from shared/resource_bundle_qt.cpp
rename to lib/resource_bundle_qt.cpp
diff --git a/lib/web_engine_context.cpp b/lib/web_engine_context.cpp
index fe557b86c..e26027207 100644
--- a/lib/web_engine_context.cpp
+++ b/lib/web_engine_context.cpp
@@ -41,7 +41,6 @@
 
 #include "web_engine_context.h"
 
-#include "shared/shared_globals.h"
 #include <math.h>
 
 #include "base/command_line.h"
diff --git a/qtwebengine.gyp b/qtwebengine.gyp
index f7cabf26a..0ddf816da 100644
--- a/qtwebengine.gyp
+++ b/qtwebengine.gyp
@@ -4,7 +4,6 @@
     'target_name': 'qtwebengine',
     'type': 'none',
     'dependencies': [
-      'shared/shared.gyp:*',
       'lib/lib.gyp:*',
     ],
   }
diff --git a/qtwebengine.pro b/qtwebengine.pro
index 8604551a0..bc0151536 100644
--- a/qtwebengine.pro
+++ b/qtwebengine.pro
@@ -7,7 +7,6 @@ TEMPLATE = subdirs
 qmake_extras.subdir = build/qmake_extras
 
 # Phony pro files that generate gyp files. Will be built by ninja.
-shared.depends = qmake_extras
 lib.depends = qmake_extras
 
 # API libraries
@@ -29,11 +28,10 @@ sub_examples.depends = quick_plugin_lib quick_experimental_plugin_lib
 sub_tests.depends = quick_plugin_lib quick_experimental_plugin_lib
 
 # This is where we use the generated gypi files and run gyp_qtwebengine
-build.depends = resources shared lib
+build.depends = resources lib
 
 SUBDIRS += qmake_extras \
           resources \
-          shared \
           lib \
           process \
           build \
diff --git a/shared/shared.pro b/shared/shared.pro
deleted file mode 100644
index 6c35063a8..000000000
--- a/shared/shared.pro
+++ /dev/null
@@ -1,33 +0,0 @@
-# This is a dummy .pro file used to extract some aspects of the used configuration and feed them to gyp
-# We want the gyp generation step to happen after all the other config steps. For that we need to prepend
-# our gyp_generator.prf feature to the CONFIG variable since it is processed backwards
-CONFIG = gyp_generator $$CONFIG
-GYPINCLUDES += ../qtwebengine.gypi
-
-TEMPLATE = lib
-CONFIG += static
-
-TARGET = qtwebengine_shared
-
-# Defining keywords such as 'signal' clashes with the chromium code base.
-DEFINES += QT_NO_KEYWORDS \
-           Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS
-
-# something fishy with qmake in 5.2 ?
-INCLUDEPATH += $$[QT_INSTALL_HEADERS]
-
-# We need a way to tap into gyp´s Debug vs. Release configuration
-PER_CONFIG_DEFINES = QTWEBENGINEPROCESS_PATH=\\\"$$getOutDir()/%config/$$QTWEBENGINEPROCESS_NAME\\\"
-
-# Keep Skia happy
-CONFIG(release, debug|release): DEFINES += NDEBUG
-
-QT += gui
-QT_PRIVATE += gui-private
-
-SOURCES = \
-        resource_bundle_qt.cpp \
-        shared_globals.cpp
-
-HEADERS = \
-        shared_globals.h
-- 
GitLab