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

Commit

Permalink
Add gyp flag use_minimum_resources and exclude unnecessary resources
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Lin Sun authored and Olli Raula committed Jun 22, 2015
1 parent 7303a90 commit 1b72e88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
10 changes: 10 additions & 0 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@
# Enable web audio hrtf by default.
'disable_webaudio_hrtf%': 0,

# Include all resources by default.
'use_minimum_resources%': 0,

# Use native android functions in place of ICU. Not supported by most
# components.
'use_icu_alternatives_on_android%': 0,
Expand Down Expand Up @@ -1190,6 +1193,7 @@
'disable_file_support%': '<(disable_file_support)',
'disable_ftp_support%': '<(disable_ftp_support)',
'disable_webaudio_hrtf%': '<(disable_webaudio_hrtf)',
'use_minimum_resources%': '<(use_minimum_resources)',
'use_icu_alternatives_on_android%': '<(use_icu_alternatives_on_android)',
'enable_task_manager%': '<(enable_task_manager)',
'sas_dll_path%': '<(sas_dll_path)',
Expand Down Expand Up @@ -2132,6 +2136,9 @@
['disable_webaudio_hrtf==1', {
'grit_defines': ['-D', 'disable_webaudio_hrtf'],
}],
['use_minimum_resources==1', {
'grit_defines': ['-D', 'use_minimum_resources'],
}],
['enable_media_router==1', {
'grit_defines': ['-D', 'enable_media_router'],
}],
Expand Down Expand Up @@ -2979,6 +2986,9 @@
['disable_ftp_support==1', {
'defines': ['DISABLE_FTP_SUPPORT=1'],
}],
['use_minimum_resources==1', {
'defines': ['USE_MINIMUM_RESOURCES=1'],
}],
['enable_supervised_users==1', {
'defines': ['ENABLE_SUPERVISED_USERS=1'],
}],
Expand Down
2 changes: 2 additions & 0 deletions content/child/blink_platform_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ struct DataResource {
const DataResource kDataResources[] = {
{"missingImage", IDR_BROKENIMAGE, ui::SCALE_FACTOR_100P},
{"missingImage@2x", IDR_BROKENIMAGE, ui::SCALE_FACTOR_200P},
#if !defined(USE_MINIMUM_RESOURCES)
{"mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON, ui::SCALE_FACTOR_100P},
{"mediaplayerPauseHover",
IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER,
Expand Down Expand Up @@ -906,6 +907,7 @@ const DataResource kDataResources[] = {
{"mediaplayerOverlayPlay",
IDR_MEDIAPLAYER_OVERLAY_PLAY_BUTTON,
ui::SCALE_FACTOR_100P},
#endif
{"panIcon", IDR_PAN_SCROLL_ICON, ui::SCALE_FACTOR_100P},
{"searchCancel", IDR_SEARCH_CANCEL, ui::SCALE_FACTOR_100P},
{"searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED, ui::SCALE_FACTOR_100P},
Expand Down
18 changes: 10 additions & 8 deletions ui/resources/ui_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
</outputs>
<release seq="1">
<structures fallback_to_low_resolution="true">
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED" file="common/menu_check.png" />
<structure type="chrome_scaled_image" name="IDR_MENU_DROPARROW" file="cros/menu_droparrow.png" />
<if expr="use_aura or toolkit_views or (is_posix and not is_macosx and not is_ios)">
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BAR" file="linux/linux-progress-bar.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_LEFT" file="linux/linux-progress-border-left.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_RIGHT" file="linux/linux-progress-border-right.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_VALUE" file="linux/linux-progress-value.png" />
</if>
<if expr="not pp_ifdef('use_minimum_resources')">
<!-- KEEP THESE IN ALPHABETICAL ORDER! DO NOT ADD TO RANDOM PLACES JUST
BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE
SAME CONDITIONALS. -->
Expand Down Expand Up @@ -306,7 +315,6 @@
<if expr="is_macosx or is_ios">
<structure type="chrome_scaled_image" name="IDR_MENU_HIERARCHY_ARROW" file="mac/menu_hierarchy_arrow.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED" file="common/menu_check.png" />
<if expr="toolkit_views">
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK" file="cros/menu_check.png" />
<structure type="chrome_scaled_image" name="IDR_MENU_CHECK_CHECKED_DARK_BACKGROUND" file="common/menu_check_white.png" />
Expand All @@ -324,7 +332,6 @@
<structure type="chrome_scaled_image" name="IDR_SLIDER_ACTIVE_THUMB" file="slider_thumb.png" />
<structure type="chrome_scaled_image" name="IDR_SLIDER_DISABLED_THUMB" file="slider_thumb_disabled.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_MENU_DROPARROW" file="cros/menu_droparrow.png" />
<structure type="chrome_scaled_image" name="IDR_MESSAGE_CLOSE" file="common/message_close.png" />
<if expr="desktop_linux">
<structure type="chrome_scaled_image" name="IDR_MINIMIZE" file="linux/linux_minimize.png" />
Expand Down Expand Up @@ -387,12 +394,6 @@
<structure type="chrome_scaled_image" name="IDR_PANEL_BOTTOM_LEFT_CORNER" file="panel_bottom_left_corner.png" />
<structure type="chrome_scaled_image" name="IDR_PANEL_BOTTOM_RIGHT_CORNER" file="panel_bottom_right_corner.png" />
</if>
<if expr="use_aura or toolkit_views or (is_posix and not is_macosx and not is_ios)">
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BAR" file="linux/linux-progress-bar.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_LEFT" file="linux/linux-progress-border-left.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_BORDER_RIGHT" file="linux/linux-progress-border-right.png" />
<structure type="chrome_scaled_image" name="IDR_PROGRESS_VALUE" file="linux/linux-progress-value.png" />
</if>
<if expr="toolkit_views">
<structure type="chrome_scaled_image" name="IDR_RADIO" file="common/radio.png" />
<structure type="chrome_scaled_image" name="IDR_RADIO_CHECKED" file="common/radio_checked.png" />
Expand Down Expand Up @@ -593,6 +594,7 @@
<structure type="chrome_scaled_image" name="IDR_WINDOW_BUBBLE_SHADOW_SPIKE_SMALL_RIGHT" file="common/window_bubble_shadow_spike_small_right.png" />
<structure type="chrome_scaled_image" name="IDR_WINDOW_BUBBLE_SHADOW_SPIKE_SMALL_TOP" file="common/window_bubble_shadow_spike_small_top.png" />
</if>
</if>
</structures>
</release>
</grit>

0 comments on commit 1b72e88

Please sign in to comment.