Commit eb496ebf authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Pass the skia resource cache limit in the command line to renderer processes.

As skia font cache, we need to limit the memory usage of skia resource cache
for the low-end device as well. But, as the font cache, it's hard to estimate
what is the limit value the best for each low-end device. So it would be good
if we give them the power to limit to use the resource cache. This CL introduces
a new command line switch to limit the skia resource cache size.

Bug: 823210
Change-Id: Icc55a8701fe2fa94bdc0ee09b428c19031c131a5
Reviewed-on: https://chromium-review.googlesource.com/968006
Commit-Queue: Gyuyoung Kim <gyuyoung.kim@lge.com>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544007}
parent f5d4ed1a
...@@ -2616,6 +2616,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -2616,6 +2616,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kShowPaintRects, switches::kShowPaintRects,
switches::kStatsCollectionController, switches::kStatsCollectionController,
switches::kSkiaFontCacheLimitMb, switches::kSkiaFontCacheLimitMb,
switches::kSkiaResourceCacheLimitMb,
switches::kTestType, switches::kTestType,
switches::kTouchEventFeatureDetection, switches::kTouchEventFeatureDetection,
switches::kTouchTextSelectionStrategy, switches::kTouchTextSelectionStrategy,
......
...@@ -789,6 +789,11 @@ const char kStatsCollectionController[] = ...@@ -789,6 +789,11 @@ const char kStatsCollectionController[] =
// If the cache needs to allocate more, skia will purge previous entries. // If the cache needs to allocate more, skia will purge previous entries.
const char kSkiaFontCacheLimitMb[] = "skia-font-cache-limit-mb"; const char kSkiaFontCacheLimitMb[] = "skia-font-cache-limit-mb";
// Specifies the max number of bytes that should be used by the skia resource
// cache. The previous entries are purged from the cache when the memory useage
// exceeds this limit.
const char kSkiaResourceCacheLimitMb[] = "skia-resource-cache-limit-mb";
// Type of the current test harness ("browser" or "ui"). // Type of the current test harness ("browser" or "ui").
const char kTestType[] = "test-type"; const char kTestType[] = "test-type";
......
...@@ -218,6 +218,7 @@ CONTENT_EXPORT extern const char kDisableSiteIsolationTrials[]; ...@@ -218,6 +218,7 @@ CONTENT_EXPORT extern const char kDisableSiteIsolationTrials[];
CONTENT_EXPORT extern const char kStartFullscreen[]; CONTENT_EXPORT extern const char kStartFullscreen[];
CONTENT_EXPORT extern const char kStatsCollectionController[]; CONTENT_EXPORT extern const char kStatsCollectionController[];
extern const char kSkiaFontCacheLimitMb[]; extern const char kSkiaFontCacheLimitMb[];
extern const char kSkiaResourceCacheLimitMb[];
CONTENT_EXPORT extern const char kTestType[]; CONTENT_EXPORT extern const char kTestType[];
CONTENT_EXPORT extern const char kTouchEventFeatureDetection[]; CONTENT_EXPORT extern const char kTouchEventFeatureDetection[];
CONTENT_EXPORT extern const char kTouchEventFeatureDetectionAuto[]; CONTENT_EXPORT extern const char kTouchEventFeatureDetectionAuto[];
......
...@@ -153,6 +153,15 @@ int RendererMain(const MainFunctionParams& parameters) { ...@@ -153,6 +153,15 @@ int RendererMain(const MainFunctionParams& parameters) {
SkGraphics::SetFontCacheLimit(font_cache_limit * kMB); SkGraphics::SetFontCacheLimit(font_cache_limit * kMB);
} }
} }
size_t resource_cache_limit;
if (process_command_line.HasSwitch(switches::kSkiaResourceCacheLimitMb)) {
if (base::StringToSizeT(process_command_line.GetSwitchValueASCII(
switches::kSkiaResourceCacheLimitMb),
&resource_cache_limit)) {
SkGraphics::SetResourceCacheTotalByteLimit(resource_cache_limit * kMB);
}
}
#endif #endif
// This function allows pausing execution using the --renderer-startup-dialog // This function allows pausing execution using the --renderer-startup-dialog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment