Only export necessary symbols (EWK + v8::*) in libchromium-ewk.so
authorSeungSeop Park <sns.park@samsung.com>
Mon, 9 Feb 2015 09:56:20 +0000 (18:56 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Currently we are providing two shared libraries - libchromium-ewk.so and
libchromium-efl.so, as the former is relying on the latter.
Tizen applications are supposed to use only EWK api, hence would only see
libchromium-ewk.so, which uses in turn libchromium-efl.so in implementing
EWK. However, libchromium-efl.so is over-exporting symbols unnecessary to
EWK apis, resulting in large ROM size and runtime memory.

This patch does three things to fix above mentioned issues.
1. Change libchromium-efl to static library
2. export symbols required for EWK app and WRT in libchromium-ewk.so
   - ewk_ prefixed API
   - v8::*
3. Refactored efl_webprocess executable to link with libchromium-ewk.so.

Test result of .so size in mobile:
- Before: 46M after strip (76M before strip)
- After : 35M after strip (63M before strip)

The test result for runtime memory also showed over 8M reduction
in PSS code section.

Note: This is a partial commit of http://165.213.202.130:8080/#/c/75146/
which contains our effort to reduce memory footprint.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=11607
Reviewed by: Antonio Gomes, Piotr Tworek

Change-Id: I527135ab844428d030477d194e5e5103c5533685
Signed-off-by: SeungSeop Park <sns.park@samsung.com>
tizen_src/build/pkgconfig/chromium-efl.pc.in
tizen_src/ewk/chromium-ewk.filter [new file with mode: 0644]
tizen_src/ewk/chromium-ewk.gyp
tizen_src/ewk/efl_webprocess/efl_webprocess.cc [new file with mode: 0644]
tizen_src/impl/chromium-efl.filter [deleted file]
tizen_src/impl/chromium-efl.gyp
tizen_src/impl/efl_webprocess_main.cc [moved from tizen_src/impl/web_process.cc with 74% similarity]
tizen_src/impl/efl_webprocess_main.h [new file with mode: 0644]
tizen_src/packaging/chromium-efl.spec

index 15c969d..1b9e0bc 100644 (file)
@@ -7,5 +7,5 @@ Name: chromium-efl
 Description: Chromium EFL port
 Version: ?VERSION?
 
-Libs: -L${libdir} -Wl,-rpath-link=${libdir} -lchromium-efl -lchromium-ewk
+Libs: -L${libdir} -Wl,-rpath-link=${libdir} -lchromium-ewk
 Cflags: -I${includedir}/chromium-ewk -I${includedir}/v8
diff --git a/tizen_src/ewk/chromium-ewk.filter b/tizen_src/ewk/chromium-ewk.filter
new file mode 100644 (file)
index 0000000..5d7ed9b
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  global:
+    ewk_*;
+    efl_webprocess_main;
+    extern "C++" {
+      v8::*
+    };
+
+  local: *;
+};
+
index 89fd0f5..806a0d5 100644 (file)
@@ -41,7 +41,6 @@
 
     'dependencies': [
       '<(efl_impl_dir)/chromium-efl.gyp:chromium-efl',
-      '<(efl_impl_dir)/chromium-efl.gyp:efl_webprocess',
       '<(DEPTH)/chrome/chrome_resources.gyp:packed_resources',
     ],
 
     'defines': [
       'HAVE_ECORE_X=<!(if pkg-config ecore-x; then echo 1; fi)',
     ],
+    'cflags': [
+      # Symbol visibility controled by chromium-ewk.filter
+      '-fvisibility=hidden',
+    ],
+    'link_settings': {
+      'ldflags': [
+        '-Wl,--no-undefined',
+        '-Wl,--version-script,<(efl_impl_dir)/../ewk/chromium-ewk.filter',
+      ],
+    },
     'conditions': [
       ['gcc_4_6_x==1', {
         'defines': [
   },
 
   {
+    'target_name': 'efl_webprocess',
+    'type': 'executable',
+    'include_dirs': [
+      '<(efl_impl_dir)',
+    ],
+    'sources': [
+      'efl_webprocess/efl_webprocess.cc',
+    ],
+    'dependencies': [
+      'chromium-ewk',
+    ],
+  },
+
+  {
     'target_name': 'efl_webview_app',
     'type': 'executable',
 
diff --git a/tizen_src/ewk/efl_webprocess/efl_webprocess.cc b/tizen_src/ewk/efl_webprocess/efl_webprocess.cc
new file mode 100644 (file)
index 0000000..fd69556
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "efl_webprocess_main.h"
+
+int main(int argc, const char **argv) {
+  return efl_webprocess_main(argc, argv);
+}
diff --git a/tizen_src/impl/chromium-efl.filter b/tizen_src/impl/chromium-efl.filter
deleted file mode 100644 (file)
index 3e1247a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  global:
-    extern "C++" {
-      EWebView::*;
-      EWebContext::*;
-      content::NotificationControllerEfl::*;
-      ewk_ipc_*;
-    };
-
-    # ContentMain constructor
-    _ZN7content11ContentMainEiPPKcPNS_19ContentMainDelegateE;
-    # vtables for WebProcessContentMainDelegateEfl and ContentMainDelegate
-    _ZTVN7content32WebProcessContentMainDelegateEflE;
-    _ZTVN7content19ContentMainDelegateE;
-
-# TODO: hide all symbols not needed by the embedding API and efl_webprocess
-#  local:
-#    *;
-};
-
index d2c5111..bd532c6 100644 (file)
@@ -5,7 +5,7 @@
     'edje_dir%': '/usr/share/chromium-efl/themes/',
     'locale_dir%': '/usr/share/chromium-efl/locale/',
     'edje_compiler%': 'edje_cc',
-    'chromium_efl_library_type%': 'shared_library',
+    'chromium_efl_library_type%': 'static_library',
   },
   'includes': [
     'chromedriver_efl.gypi',
       'devtools_delegate_efl.h',
       'devtools_manager_delegate_efl.cc',
       'devtools_manager_delegate_efl.h',
+      'efl_webprocess_main.cc',
+      'efl_webprocess_main.h',
       'eweb_context.cc',
       'eweb_context.h',
       'eweb_view.cc',
       # Temporary fix for M40 build
       'third_party/webrtc/system_wrappers/source/cpu_features_tizen.c',
     ],
-    'cflags!': [
-      # Symbol visibility controled by chromium-efl.filter
-      '-fvisibility=hidden',
-    ],
     'link_settings': {
-      'ldflags': [
-        '-Wl,--no-undefined',
-        '-Wl,--version-script,<(efl_impl_dir)/chromium-efl.filter',
-        '-rdynamic',
-      ],
       'conditions': [
         ['_toolset=="target"', {
           'libraries': [ '<!($(echo ${CXX_target:-g++}) -print-libgcc-file-name)', ]
     ],
   },
   {
-    'target_name': 'efl_webprocess',
-    'type': 'executable',
-    'include_dirs': [
-      '.',
-    ],
-    'sources': [
-      'web_process.cc',
-    ],
-    'dependencies': [
-      'chromium-efl',
-    ],
-  },
-  {
     'target_name': 'content_shell_efl',
     'type': 'executable',
     'dependencies': [
similarity index 74%
rename from tizen_src/impl/web_process.cc
rename to tizen_src/impl/efl_webprocess_main.cc
index 5d17aea..c3373a0 100644 (file)
@@ -1,11 +1,13 @@
-// Copyright 2014 Samsung Electronics. All rights reserved.
+// Copyright 2015 Samsung Electronics. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "efl_webprocess_main.h"
+
 #include "base/logging.h"
 #include "web_process_content_main_delegate_efl.h"
 
-int main(int argc, const char **argv) {
+int efl_webprocess_main(int argc, const char **argv) {
   LOG(INFO) << "web process launching...";
 
   content::WebProcessContentMainDelegateEfl content_main_delegate;
diff --git a/tizen_src/impl/efl_webprocess_main.h b/tizen_src/impl/efl_webprocess_main.h
new file mode 100644 (file)
index 0000000..9686a6e
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2015 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EFL_WEBPROCESS_MAIN_H
+#define EFL_WEBPROCESS_MAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+__attribute__((visibility("default"))) int efl_webprocess_main(int argc, const char **argv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // EFL_WEBPROCESS_MAIN_H
index 4975138..44decc2 100644 (file)
@@ -373,7 +373,6 @@ cp -r "%{OUTPUT_FOLDER}/locale" "%{buildroot}/%{CHROMIUM_LOCALE_DIR}"
 
 install -m 0755 "%{OUTPUT_FOLDER}"/locales/*.pak      "%{buildroot}%{CHROMIUM_EXE_DIR}"/locales
 
-install -m 0755 "%{OUTPUT_FOLDER}"/lib/libchromium-efl.so    "%{buildroot}"%{_libdir}
 install -m 0755 "%{OUTPUT_FOLDER}"/lib/libchromium-ewk.so    "%{buildroot}"%{_libdir}
 
 install -m 0755 "%{OUTPUT_FOLDER}"/libffmpegsumo.so  "%{buildroot}%{CHROMIUM_EXE_DIR}"
@@ -471,7 +470,6 @@ chown -R app:app %{CHROMIUM_WEBDB_DIR}/data
 /opt/share/icons/mini-browser.png
 %endif
 %defattr(-,root,root,-)
-%{_libdir}/libchromium-efl.so
 %{_libdir}/libchromium-ewk.so
 %{CHROMIUM_EXE_DIR}/efl_webprocess
 %{CHROMIUM_EXE_DIR}/libffmpegsumo.so