diff options
author | c.shu@samsung.com <c.shu@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-26 16:55:27 +0000 |
---|---|---|
committer | c.shu@samsung.com <c.shu@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-26 16:55:27 +0000 |
commit | 35b4f0cda0ee3711e330a36bf8a182c05852efa4 (patch) | |
tree | 53157d83d6b3d39a6300ceab12b8811bb538ea20 | |
parent | 8851dbe0c2351690da1488c9d58c686044fec9b5 (diff) | |
download | chromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.zip chromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.tar.gz chromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.tar.bz2 |
Expose a low-end device mode override flags for non-android OSs as well
BUG=324824
Review URL: https://codereview.chromium.org/258663002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280024 0039d316-1c4b-4281-b951-d872f2087c98
24 files changed, 102 insertions, 108 deletions
diff --git a/base/android/java/src/org/chromium/base/BaseSwitches.java b/base/android/java/src/org/chromium/base/BaseSwitches.java index 814fee7..53e2d7b 100644 --- a/base/android/java/src/org/chromium/base/BaseSwitches.java +++ b/base/android/java/src/org/chromium/base/BaseSwitches.java @@ -12,11 +12,10 @@ public abstract class BaseSwitches { // Block onCreate() of Chrome until a Java debugger is attached. public static final String WAIT_FOR_JAVA_DEBUGGER = "wait-for-java-debugger"; - // Overrides low-end device detection, disabling low-end device optimizations. - public static final String DISABLE_LOW_END_DEVICE_MODE = "disable-low-end-device-mode"; - - // Overrides low-end device detection, enabling low-end device optimizations. - public static final String ENABLE_LOW_END_DEVICE_MODE = "enable-low-end-device-mode"; + // Force low-end device when set to 1; + // Force non-low-end device when set to 0; + // Auto-detect low-end device when set to other values or empty; + public static final String LOW_END_DEVICE_MODE = "low-end-device-mode"; // Adds additional thread idle time information into the trace event output. public static final String ENABLE_IDLE_TRACING = "enable-idle-tracing"; diff --git a/base/android/java/src/org/chromium/base/SysUtils.java b/base/android/java/src/org/chromium/base/SysUtils.java index a8fcdcb..1108d9e 100644 --- a/base/android/java/src/org/chromium/base/SysUtils.java +++ b/base/android/java/src/org/chromium/base/SysUtils.java @@ -32,14 +32,10 @@ public class SysUtils { /** * Return the amount of physical memory on this device in kilobytes. - * Note: the only reason this is public is for testability reason. * @return Amount of physical memory in kilobytes, or 0 if there was * an error trying to access the information. - * - * Note that this is CalledByNative for testing purpose only. */ - @CalledByNative - public static int amountOfPhysicalMemoryKB() { + private static int amountOfPhysicalMemoryKB() { // Extract total memory RAM size by parsing /proc/meminfo, note that // this is exactly what the implementation of sysconf(_SC_PHYS_PAGES) // does. However, it can't be called because this method must be @@ -108,11 +104,13 @@ public class SysUtils { private static boolean detectLowEndDevice() { if (CommandLine.isInitialized()) { - if (CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_LOW_END_DEVICE_MODE)) { - return true; - } - if (CommandLine.getInstance().hasSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE)) { - return false; + if (CommandLine.getInstance().hasSwitch(BaseSwitches.LOW_END_DEVICE_MODE)) { + int mode = Integer.parseInt(CommandLine.getInstance().getSwitchValue( + BaseSwitches.LOW_END_DEVICE_MODE)); + if (mode == 1) + return true; + if (mode == 0) + return false; } } diff --git a/base/android/sys_utils.cc b/base/android/sys_utils.cc index efd13df..e89c1b3 100644 --- a/base/android/sys_utils.cc +++ b/base/android/sys_utils.cc @@ -20,22 +20,6 @@ bool SysUtils::IsLowEndDeviceFromJni() { return Java_SysUtils_isLowEndDevice(env); } -bool SysUtils::IsLowEndDevice() { - static bool is_low_end = IsLowEndDeviceFromJni(); - return is_low_end; -} - -size_t SysUtils::AmountOfPhysicalMemoryKBFromJni() { - JNIEnv* env = AttachCurrentThread(); - return static_cast<size_t>(Java_SysUtils_amountOfPhysicalMemoryKB(env)); -} - -size_t SysUtils::AmountOfPhysicalMemoryKB() { - static size_t amount_of_ram = AmountOfPhysicalMemoryKBFromJni(); - return amount_of_ram; -} - -SysUtils::SysUtils() { } - } // namespace android -} // namespace base + +} // namespace base
\ No newline at end of file diff --git a/base/android/sys_utils.h b/base/android/sys_utils.h index 0841d0a..85dc035 100644 --- a/base/android/sys_utils.h +++ b/base/android/sys_utils.h @@ -15,16 +15,7 @@ class BASE_EXPORT SysUtils { static bool Register(JNIEnv* env); // Returns true iff this is a low-end device. - static bool IsLowEndDevice(); - - // Return the device's RAM size in kilo-bytes. - static size_t AmountOfPhysicalMemoryKB(); - - private: - SysUtils(); - static bool IsLowEndDeviceFromJni(); - static size_t AmountOfPhysicalMemoryKBFromJni(); }; } // namespace android diff --git a/base/android/sys_utils_unittest.cc b/base/android/sys_utils_unittest.cc index 2a5a17d..fc0282a 100644 --- a/base/android/sys_utils_unittest.cc +++ b/base/android/sys_utils_unittest.cc @@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/android/sys_utils.h" - #include <unistd.h> +#include "base/sys_info.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -13,10 +12,10 @@ namespace android { TEST(SysUtils, AmountOfPhysicalMemory) { // Check that the RAM size reported by sysconf() matches the one - // computed by base::android::SysUtils::AmountOfPhysicalMemory(). + // computed by base::SysInfo::AmountOfPhysicalMemory(). size_t sys_ram_size = static_cast<size_t>(sysconf(_SC_PHYS_PAGES) * PAGE_SIZE); - EXPECT_EQ(sys_ram_size, SysUtils::AmountOfPhysicalMemoryKB() * 1024UL); + EXPECT_EQ(sys_ram_size, SysInfo::AmountOfPhysicalMemory()); } } // namespace android diff --git a/base/base_switches.cc b/base/base_switches.cc index 81698cd..9582ac9 100644 --- a/base/base_switches.cc +++ b/base/base_switches.cc @@ -17,6 +17,11 @@ const char kEnableCrashReporter[] = "enable-crash-reporter"; // Generates full memory crash dump. const char kFullMemoryCrashReport[] = "full-memory-crash-report"; +// Force low-end device when set to 1; +// Auto-detect low-end device when set to 2; +// Force non-low-end device when set to other values or empty; +const char kLowEndDeviceMode[] = "low-end-device-mode"; + // Suppresses all error dialogs when present. const char kNoErrorDialogs[] = "noerrdialogs"; @@ -60,12 +65,4 @@ const char kEnableCrashReporterForTesting[] = "enable-crash-reporter-for-testing"; #endif -#if defined(OS_ANDROID) -// Overrides low-end device detection, disabling low-end device optimizations. -const char kDisableLowEndDeviceMode[] = "disable-low-end-device-mode"; - -// Overrides low-end device detection, enabling low-end device optimizations. -const char kEnableLowEndDeviceMode[] = "enable-low-end-device-mode"; -#endif - } // namespace switches diff --git a/base/base_switches.h b/base/base_switches.h index 6e391a4..ba995d5 100644 --- a/base/base_switches.h +++ b/base/base_switches.h @@ -14,6 +14,7 @@ namespace switches { extern const char kDisableBreakpad[]; extern const char kEnableCrashReporter[]; extern const char kFullMemoryCrashReport[]; +extern const char kLowEndDeviceMode[]; extern const char kNoErrorDialogs[]; extern const char kProfilerTiming[]; extern const char kProfilerTimingDisabledValue[]; @@ -27,11 +28,6 @@ extern const char kWaitForDebugger[]; extern const char kEnableCrashReporterForTesting[]; #endif -#if defined(OS_ANDROID) -extern const char kDisableLowEndDeviceMode[]; -extern const char kEnableLowEndDeviceMode[]; -#endif - } // namespace switches #endif // BASE_BASE_SWITCHES_H_ diff --git a/base/memory/discardable_memory_android.cc b/base/memory/discardable_memory_android.cc index c3de3a3..3215969 100644 --- a/base/memory/discardable_memory_android.cc +++ b/base/memory/discardable_memory_android.cc @@ -4,7 +4,6 @@ #include "base/memory/discardable_memory.h" -#include "base/android/sys_utils.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/lazy_instance.h" @@ -13,6 +12,7 @@ #include "base/memory/discardable_memory_ashmem_allocator.h" #include "base/memory/discardable_memory_emulated.h" #include "base/memory/discardable_memory_malloc.h" +#include "base/sys_info.h" namespace base { namespace { @@ -26,7 +26,7 @@ const size_t kAshmemMemoryLimit = 512 * 1024 * 1024; size_t GetOptimalAshmemRegionSizeForAllocator() { // Note that this may do some I/O (without hitting the disk though) so it // should not be called on the critical path. - return base::android::SysUtils::AmountOfPhysicalMemoryKB() * 1024 / 8; + return base::SysInfo::AmountOfPhysicalMemory() / 8; } // Holds the shared state used for allocations. diff --git a/base/sys_info.cc b/base/sys_info.cc index d43e932..0b3b317 100644 --- a/base/sys_info.cc +++ b/base/sys_info.cc @@ -4,10 +4,46 @@ #include "base/sys_info.h" +#include "base/base_switches.h" +#include "base/command_line.h" +#include "base/lazy_instance.h" +#include "base/strings/string_number_conversions.h" +#include "base/sys_info_internal.h" #include "base/time/time.h" namespace base { +#if !defined(OS_ANDROID) + +static const int kLowMemoryDeviceThresholdMB = 512; + +bool DetectLowEndDevice() { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + int int_value = 0; + if (command_line->HasSwitch(switches::kLowEndDeviceMode)) { + std::string string_value = + command_line->GetSwitchValueASCII(switches::kLowEndDeviceMode); + StringToInt(string_value, &int_value); + } + if (int_value == 1) + return true; + if (int_value != 2) + return false; + + int ram_size_mb = SysInfo::AmountOfPhysicalMemoryMB(); + return (ram_size_mb > 0 && ram_size_mb < kLowMemoryDeviceThresholdMB); +} + +static LazyInstance< + internal::LazySysInfoValue<bool, DetectLowEndDevice> >::Leaky + g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; + +// static +bool SysInfo::IsLowEndDevice() { + return g_lazy_low_end_device.Get().value(); +} +#endif + // static int64 SysInfo::Uptime() { // This code relies on an implementation detail of TimeTicks::Now() - that diff --git a/base/sys_info.h b/base/sys_info.h index 7ce4e65..d24acdf 100644 --- a/base/sys_info.h +++ b/base/sys_info.h @@ -129,6 +129,11 @@ class BASE_EXPORT SysInfo { static int DalvikHeapSizeMB(); static int DalvikHeapGrowthLimitMB(); #endif // defined(OS_ANDROID) + + // Returns true if this is a low-end device. + // Low-end device refers to devices having less than 512M memory in the + // current implementation. + static bool IsLowEndDevice(); }; } // namespace base diff --git a/base/sys_info_android.cc b/base/sys_info_android.cc index 12da23b..ab7c05d 100644 --- a/base/sys_info_android.cc +++ b/base/sys_info_android.cc @@ -6,10 +6,13 @@ #include <sys/system_properties.h> +#include "base/android/sys_utils.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" +#include "base/sys_info_internal.h" namespace { @@ -162,5 +165,14 @@ int SysInfo::DalvikHeapGrowthLimitMB() { return heap_growth_limit; } +static base::LazyInstance< + base::internal::LazySysInfoValue<bool, + android::SysUtils::IsLowEndDeviceFromJni> >::Leaky + g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; + +bool SysInfo::IsLowEndDevice() { + return g_lazy_low_end_device.Get().value(); +} + } // namespace base diff --git a/chrome/browser/android/chrome_startup_flags.cc b/chrome/browser/android/chrome_startup_flags.cc index 84fec2a..6c4a54e 100644 --- a/chrome/browser/android/chrome_startup_flags.cc +++ b/chrome/browser/android/chrome_startup_flags.cc @@ -9,9 +9,9 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" -#include "base/android/sys_utils.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/sys_info.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "content/public/common/content_switches.h" @@ -44,7 +44,7 @@ void SetChromeSpecificCommandLineFlags() { switches::kPrerenderFromOmniboxSwitchValueEnabled); // Disable syncing favicons on low end devices. - if (base::android::SysUtils::IsLowEndDevice()) + if (base::SysInfo::IsLowEndDevice()) SetCommandLineSwitchASCII(switches::kDisableSyncTypes, "Favicon Images"); // Enable DOM Distiller on local builds, canary and dev-channel. diff --git a/chrome/browser/prerender/prerender_manager_factory.cc b/chrome/browser/prerender/prerender_manager_factory.cc index 0682cb7..142256f 100644 --- a/chrome/browser/prerender/prerender_manager_factory.cc +++ b/chrome/browser/prerender/prerender_manager_factory.cc @@ -4,11 +4,8 @@ #include "chrome/browser/prerender/prerender_manager_factory.h" -#if defined(OS_ANDROID) -#include "base/android/sys_utils.h" -#endif - #include "base/debug/trace_event.h" +#include "base/sys_info.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/predictors/predictor_database_factory.h" @@ -65,10 +62,8 @@ KeyedService* PrerenderManagerFactory::BuildServiceInstanceFor( content::BrowserContext* browser_context) const { Profile* profile = Profile::FromBrowserContext(browser_context); CHECK(g_browser_process->prerender_tracker()); -#if defined(OS_ANDROID) - if (base::android::SysUtils::IsLowEndDevice()) + if (base::SysInfo::IsLowEndDevice()) return NULL; -#endif PrerenderManager* prerender_manager = new PrerenderManager( profile, g_browser_process->prerender_tracker()); diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index e4c7a58..a61a2c3 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -23,10 +23,6 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" -#if defined(OS_ANDROID) -#include "base/android/sys_utils.h" -#endif - using base::Time; using base::TimeDelta; using blink::WebCache; @@ -326,12 +322,10 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) { // We allow the dead objects to consume up to half of the cache capacity. size_t max_dead_capacity = capacity / 2; -#if defined(OS_ANDROID) - if (base::android::SysUtils::IsLowEndDevice()) + if (base::SysInfo::IsLowEndDevice()) { max_dead_capacity = std::min(static_cast<size_t>(512 * 1024), max_dead_capacity); -#endif - + } host->Send(new ChromeViewMsg_SetCacheCapacities(min_dead_capacity, max_dead_capacity, capacity)); diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 96a233e..a8fe768 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -987,6 +987,7 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { switches::kGpuSandboxStartAfterInitialization, switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode, switches::kLoggingLevel, + switches::kLowEndDeviceMode, switches::kNoSandbox, switches::kTestGLLib, switches::kTraceStartup, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index a7738f6..7d8fb73 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1238,11 +1238,10 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableWebRtcHWEncoding, switches::kEnableWebRtcHWVp8Encoding, #endif + switches::kLowEndDeviceMode, #if defined(OS_ANDROID) switches::kDisableGestureRequirementForMediaPlayback, - switches::kDisableLowEndDeviceMode, switches::kDisableWebRTC, - switches::kEnableLowEndDeviceMode, switches::kEnableSpeechRecognition, switches::kMediaDrmEnableNonCompositing, switches::kNetworkCountryIso, diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index fcf7113..dbe6fa7 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -6,7 +6,6 @@ #include <android/bitmap.h> -#include "base/android/sys_utils.h" #include "base/basictypes.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -15,6 +14,7 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/strings/utf_string_conversions.h" +#include "base/sys_info.h" #include "base/threading/worker_pool.h" #include "cc/base/latency_info_swap_promise.h" #include "cc/layers/delegated_frame_provider.h" @@ -1436,7 +1436,7 @@ SkBitmap::Config RenderWidgetHostViewAndroid::PreferredReadbackFormat() { // Define the criteria here. If say the 16 texture readback is // supported we should go with that (this degrades quality) // or stick back to the default format. - if (base::android::SysUtils::IsLowEndDevice()) { + if (base::SysInfo::IsLowEndDevice()) { if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config)) return SkBitmap::kRGB_565_Config; } diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 64581a1..1ab1347 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -49,7 +49,6 @@ #include "ui/base/layout.h" #if defined(OS_ANDROID) -#include "base/android/sys_utils.h" #include "content/child/fling_animator_impl_android.h" #endif @@ -1059,7 +1058,7 @@ BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { size_t BlinkPlatformImpl::maxDecodedImageBytes() { #if defined(OS_ANDROID) - if (base::android::SysUtils::IsLowEndDevice()) { + if (base::SysInfo::IsLowEndDevice()) { // Limit image decoded size to 3M pixels on low end devices. // 4 is maximum number of bytes per pixel. return 3 * 1024 * 1024 * 4; diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 4bea594..33612b0 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -7,14 +7,11 @@ #include <limits> #include <string> -#if defined(OS_ANDROID) -#include "base/android/sys_utils.h" -#endif - #include "base/command_line.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/synchronization/lock.h" +#include "base/sys_info.h" #include "base/time/time.h" #include "base/values.h" #include "cc/base/latency_info_swap_promise.h" @@ -281,11 +278,11 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create( // RGBA_4444 textures are only enabled for low end devices // and are disabled for Android WebView as it doesn't support the format. settings.use_rgba_4444_textures = - base::android::SysUtils::IsLowEndDevice() && + base::SysInfo::IsLowEndDevice() && !widget->UsingSynchronousRendererCompositor(); if (widget->UsingSynchronousRendererCompositor()) { // TODO(boliu): Set this ratio for Webview. - } else if (base::android::SysUtils::IsLowEndDevice()) { + } else if (base::SysInfo::IsLowEndDevice()) { // On low-end we want to be very carefull about killing other // apps. So initially we use 50% more memory to avoid flickering // or raster-on-demand. diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc index c05a19e2..421e60bc 100644 --- a/content/renderer/render_process_impl.cc +++ b/content/renderer/render_process_impl.cc @@ -15,16 +15,13 @@ #include "base/basictypes.h" #include "base/command_line.h" #include "base/compiler_specific.h" +#include "base/sys_info.h" #include "content/child/site_isolation_policy.h" #include "content/public/common/content_switches.h" #include "content/public/renderer/content_renderer_client.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "v8/include/v8.h" -#if defined(OS_ANDROID) -#include "base/android/sys_utils.h" -#endif - namespace content { RenderProcessImpl::RenderProcessImpl() @@ -46,13 +43,11 @@ RenderProcessImpl::RenderProcessImpl() } #endif -#if defined(OS_ANDROID) - if (base::android::SysUtils::IsLowEndDevice()) { + if (base::SysInfo::IsLowEndDevice()) { std::string optimize_flag("--optimize-for-size"); v8::V8::SetFlagsFromString(optimize_flag.c_str(), static_cast<int>(optimize_flag.size())); } -#endif const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kJavaScriptFlags)) { diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 2eeb2e5..7d6583a 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -16,6 +16,7 @@ #include "base/metrics/histogram.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/sys_info.h" #include "build/build_config.h" #include "cc/base/switches.h" #include "cc/debug/benchmark_instrumentation.h" @@ -73,7 +74,6 @@ #if defined(OS_ANDROID) #include <android/keycodes.h> -#include "base/android/sys_utils.h" #include "content/renderer/android/synchronous_compositor_factory.h" #endif @@ -859,10 +859,8 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { DCHECK(is_threaded_compositing_enabled_ || RenderThreadImpl::current()->layout_test_mode()); cc::ResourceFormat format = cc::RGBA_8888; -#if defined(OS_ANDROID) - if (base::android::SysUtils::IsLowEndDevice()) + if (base::SysInfo::IsLowEndDevice()) format = cc::RGB_565; -#endif return scoped_ptr<cc::OutputSurface>( new MailboxOutputSurface( routing_id(), @@ -2014,7 +2012,7 @@ RenderWidget::CreateGraphicsContext3D() { // uploads, after which we are just wasting memory. Since we don't // know our upload throughput yet, this just caps our memory usage. size_t divider = 1; - if (base::android::SysUtils::IsLowEndDevice()) + if (base::SysInfo::IsLowEndDevice()) divider = 6; // For reference Nexus10 can upload 1MB in about 2.5ms. const double max_mb_uploaded_per_ms = 2.0 / (5 * divider); diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index a64816a..242af71 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -17,6 +17,7 @@ #include "base/path_service.h" #include "base/pending_task.h" #include "base/strings/string_util.h" +#include "base/sys_info.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" #include "base/timer/hi_res_timer_manager.h" @@ -34,7 +35,6 @@ #include "ui/base/ui_base_switches.h" #if defined(OS_ANDROID) -#include "base/android/sys_utils.h" #include "third_party/skia/include/core/SkGraphics.h" #endif // OS_ANDROID @@ -141,7 +141,7 @@ int RendererMain(const MainFunctionParams& parameters) { #if defined(OS_ANDROID) const int kMB = 1024 * 1024; size_t font_cache_limit = - base::android::SysUtils::IsLowEndDevice() ? kMB : 8 * kMB; + base::SysInfo::IsLowEndDevice() ? kMB : 8 * kMB; SkGraphics::SetFontCacheLimit(font_cache_limit); #endif diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc index a2b2255..ba1ad2e 100644 --- a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc +++ b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc @@ -4,8 +4,8 @@ #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" -#include "base/android/sys_utils.h" #include "base/debug/trace_event.h" +#include "base/sys_info.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" @@ -63,7 +63,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( !IsBroadcom() && !IsImagination() && !IsNvidia31() && - !base::android::SysUtils::IsLowEndDevice()) { + !base::SysInfo::IsLowEndDevice()) { return new AsyncPixelTransferManagerEGL; } return new AsyncPixelTransferManagerIdle; diff --git a/ui/gl/gl_context_android.cc b/ui/gl/gl_context_android.cc index 2b91892..51377a3 100644 --- a/ui/gl/gl_context_android.cc +++ b/ui/gl/gl_context_android.cc @@ -4,7 +4,6 @@ #include "ui/gl/gl_context.h" -#include "base/android/sys_utils.h" #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/sys_info.h" @@ -128,7 +127,7 @@ bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { if (limit_bytes == 0) { // NOTE: Non-low-end devices use only 50% of these limits, // except during 'emergencies' where 100% can be used. - if (!base::android::SysUtils::IsLowEndDevice()) { + if (!base::SysInfo::IsLowEndDevice()) { if (physical_memory_mb >= 1536) limit_bytes = physical_memory_mb / 8; // >192MB else if (physical_memory_mb >= 1152) |