Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: base/sys_utils.cc

Issue 119493005: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/sys_utils.h"
6
7 #include "base/base_switches.h"
8 #include "base/command_line.h"
9 #include "base/sys_info.h"
10
11 namespace base {
12
13 #if !defined(OS_ANDROID)
14 static const int LOW_MEMORY_DEVICE_THRESHOLD_MB = 512;
15
16 static bool detectLowEndDevice() {
17 CommandLine* command_line = CommandLine::ForCurrentProcess();
18 if (command_line->HasSwitch(switches::kEnableLowEndDeviceMode )) {
19 return true;
20 }
21 if (command_line->HasSwitch(switches::kDisableLowEndDeviceMode)) {
22 return false;
23 }
24
25 int ramSizeKB = SysUtils::AmountOfPhysicalMemoryKB();
willchan no longer on Chromium 2013/12/26 19:02:39 ram_size_kb
ostap 2014/01/20 08:12:24 Done.
26 return (ramSizeKB > 0 && ramSizeKB / 1024 < LOW_MEMORY_DEVICE_THRESHOLD_MB);
27 }
28
29 // static
30 bool SysUtils::IsLowEndDevice() {
31 static bool isLowEndDevice = detectLowEndDevice();
willchan no longer on Chromium 2013/12/26 19:02:39 We disable the compiler generated locks around fun
ostap 2014/01/20 08:12:24 Done.
32 return isLowEndDevice;
33 }
34
35 // static
36 size_t SysUtils::AmountOfPhysicalMemoryKB() {
37 return SysInfo::AmountOfPhysicalMemory() / 1024;
piman 2014/01/08 04:41:50 I'm not sure SysInfo::AmountOfPhysicalMemory() wor
ostap 2014/01/20 08:12:24 Should work. At least initializeV8Common() in WebK
38 }
39 #endif
40
41 SysUtils::SysUtils() { }
42
43 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698