Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit b80e331

Browse files
Lin SunOlli Raula
authored andcommitted
Add gyp flag use_minimum_resources and exclude unnecessary resources
Remove following resources: 1. Resources for media player control bar, this part is not usually used, thus it could be overriden by web developers. 2. The ui resources are for aura/views, Android doesn't need it. This patch is the backport from Crosswalk-lite BUG=https://crosswalk-project.org/jira/browse/XWALK-3928 TEST=Build with/without flag use_minimum_resources and simple test on XWalkCoreShell.apk SIZE_REDUCED=212k(Release build on ARM)
1 parent d668f2c commit b80e331

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

build/common.gypi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@
565565
# Enable web audio hrtf by default.
566566
'disable_webaudio_hrtf%': 0,
567567

568+
# Include all resources by default.
569+
'use_minimum_resources%': 0,
570+
568571
# Use native android functions in place of ICU. Not supported by most
569572
# components.
570573
'use_icu_alternatives_on_android%': 0,
@@ -1192,6 +1195,7 @@
11921195
'disable_file_support%': '<(disable_file_support)',
11931196
'disable_ftp_support%': '<(disable_ftp_support)',
11941197
'disable_webaudio_hrtf%': '<(disable_webaudio_hrtf)',
1198+
'use_minimum_resources%': '<(use_minimum_resources)',
11951199
'use_icu_alternatives_on_android%': '<(use_icu_alternatives_on_android)',
11961200
'enable_task_manager%': '<(enable_task_manager)',
11971201
'sas_dll_path%': '<(sas_dll_path)',
@@ -2136,6 +2140,9 @@
21362140
['disable_webaudio_hrtf==1', {
21372141
'grit_defines': ['-D', 'disable_webaudio_hrtf'],
21382142
}],
2143+
['use_minimum_resources==1', {
2144+
'grit_defines': ['-D', 'use_minimum_resources'],
2145+
}],
21392146
['enable_media_router==1', {
21402147
'grit_defines': ['-D', 'enable_media_router'],
21412148
}],
@@ -2983,6 +2990,9 @@
29832990
['disable_ftp_support==1', {
29842991
'defines': ['DISABLE_FTP_SUPPORT=1'],
29852992
}],
2993+
['use_minimum_resources==1', {
2994+
'defines': ['USE_MINIMUM_RESOURCES=1'],
2995+
}],
29862996
['enable_supervised_users==1', {
29872997
'defines': ['ENABLE_SUPERVISED_USERS=1'],
29882998
}],

content/child/blink_platform_impl.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ struct DataResource {
793793
const DataResource kDataResources[] = {
794794
{"missingImage", IDR_BROKENIMAGE, ui::SCALE_FACTOR_100P},
795795
{"missingImage@2x", IDR_BROKENIMAGE, ui::SCALE_FACTOR_200P},
796+
#if !defined(USE_MINIMUM_RESOURCES)
796797
{"mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON, ui::SCALE_FACTOR_100P},
797798
{"mediaplayerPauseHover",
798799
IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER,
@@ -906,6 +907,7 @@ const DataResource kDataResources[] = {
906907
{"mediaplayerOverlayPlay",
907908
IDR_MEDIAPLAYER_OVERLAY_PLAY_BUTTON,
908909
ui::SCALE_FACTOR_100P},
910+
#endif
909911
{"panIcon", IDR_PAN_SCROLL_ICON, ui::SCALE_FACTOR_100P},
910912
{"searchCancel", IDR_SEARCH_CANCEL, ui::SCALE_FACTOR_100P},
911913
{"searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED, ui::SCALE_FACTOR_100P},

ui/resources/ui_resources.grd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
</outputs>
1313
<release seq="1">
1414
<structures fallback_to_low_resolution="true">
15+
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED" file="common/menu_check.png" />
16+
<structure type="chrome_scaled_image" name="IDR_MENU_DROPARROW" file="cros/menu_droparrow.png" />
17+
<if expr="use_aura or toolkit_views or (is_posix and not is_macosx and not is_ios)">
18+
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BAR" file="linux/linux-progress-bar.png" />
19+
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_LEFT" file="linux/linux-progress-border-left.png" />
20+
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_RIGHT" file="linux/linux-progress-border-right.png" />
21+
<structure type="chrome_scaled_image" name="IDR_PROGRESS_VALUE" file="linux/linux-progress-value.png" />
22+
</if>
23+
<if expr="not pp_ifdef('use_minimum_resources')">
1524
<!-- KEEP THESE IN ALPHABETICAL ORDER! DO NOT ADD TO RANDOM PLACES JUST
1625
BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE
1726
SAME CONDITIONALS. -->
@@ -306,7 +315,6 @@
306315
<if expr="is_macosx or is_ios">
307316
<structure type="chrome_scaled_image" name="IDR_MENU_HIERARCHY_ARROW" file="mac/menu_hierarchy_arrow.png" />
308317
</if>
309-
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED" file="common/menu_check.png" />
310318
<if expr="toolkit_views">
311319
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK" file="cros/menu_check.png" />
312320
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED_DARK_BACKGROUND" file="common/menu_check_white.png" />
@@ -324,7 +332,6 @@
324332
<structure type="chrome_scaled_image" name="IDR_SLIDER_ACTIVE_THUMB" file="slider_thumb.png" />
325333
<structure type="chrome_scaled_image" name="IDR_SLIDER_DISABLED_THUMB" file="slider_thumb_disabled.png" />
326334
</if>
327-
<structure type="chrome_scaled_image" name="IDR_MENU_DROPARROW" file="cros/menu_droparrow.png" />
328335
<structure type="chrome_scaled_image" name="IDR_MESSAGE_CLOSE" file="common/message_close.png" />
329336
<if expr="desktop_linux">
330337
<structure type="chrome_scaled_image" name="IDR_MINIMIZE" file="linux/linux_minimize.png" />
@@ -387,12 +394,6 @@
387394
<structure type="chrome_scaled_image" name="IDR_PANEL_BOTTOM_LEFT_CORNER" file="panel_bottom_left_corner.png" />
388395
<structure type="chrome_scaled_image" name="IDR_PANEL_BOTTOM_RIGHT_CORNER" file="panel_bottom_right_corner.png" />
389396
</if>
390-
<if expr="use_aura or toolkit_views or (is_posix and not is_macosx and not is_ios)">
391-
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BAR" file="linux/linux-progress-bar.png" />
392-
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_LEFT" file="linux/linux-progress-border-left.png" />
393-
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_RIGHT" file="linux/linux-progress-border-right.png" />
394-
<structure type="chrome_scaled_image" name="IDR_PROGRESS_VALUE" file="linux/linux-progress-value.png" />
395-
</if>
396397
<if expr="toolkit_views">
397398
<structure type="chrome_scaled_image" name="IDR_RADIO" file="common/radio.png" />
398399
<structure type="chrome_scaled_image" name="IDR_RADIO_CHECKED" file="common/radio_checked.png" />
@@ -593,6 +594,7 @@
593594
<structure type="chrome_scaled_image" name="IDR_WINDOW_BUBBLE_SHADOW_SPIKE_SMALL_RIGHT" file="common/window_bubble_shadow_spike_small_right.png" />
594595
<structure type="chrome_scaled_image" name="IDR_WINDOW_BUBBLE_SHADOW_SPIKE_SMALL_TOP" file="common/window_bubble_shadow_spike_small_top.png" />
595596
</if>
597+
</if>
596598
</structures>
597599
</release>
598600
</grit>

0 commit comments

Comments
 (0)