mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 863285 - Cache the result of Ci.nsIMemory.isLowMemoryPlatform(). r=Kartikaya
This commit is contained in:
parent
6ef403d37d
commit
8374f4c5f4
@ -212,6 +212,12 @@ var BrowserApp = {
|
||||
return this.isTablet = sysInfo.get("tablet");
|
||||
},
|
||||
|
||||
get isOnLowMemoryPlatform() {
|
||||
let memory = Cc["@mozilla.org/xpcom/memory-service;1"].getService(Ci.nsIMemory);
|
||||
delete this.isOnLowMemoryPlatform;
|
||||
return this.isOnLowMemoryPlatform = memory.isLowMemoryPlatform();
|
||||
},
|
||||
|
||||
deck: null,
|
||||
|
||||
startup: function startup() {
|
||||
@ -3218,7 +3224,7 @@ Tab.prototype = {
|
||||
|
||||
// For low-memory devices, don't allow reader mode since it takes up a lot of memory.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=792603 for details.
|
||||
if (Cc["@mozilla.org/xpcom/memory-service;1"].getService(Ci.nsIMemory).isLowMemoryPlatform())
|
||||
if (BrowserApp.isOnLowMemoryPlatform)
|
||||
return;
|
||||
|
||||
// Once document is fully loaded, parse it
|
||||
@ -7206,7 +7212,7 @@ var Tabs = {
|
||||
init: function() {
|
||||
// on low-memory platforms, always allow tab expiration. on high-mem
|
||||
// platforms, allow it to be turned on once we hit a low-mem situation
|
||||
if (Cc["@mozilla.org/xpcom/memory-service;1"].getService(Ci.nsIMemory).isLowMemoryPlatform()) {
|
||||
if (BrowserApp.isOnLowMemoryPlatform) {
|
||||
this._enableTabExpiration = true;
|
||||
} else {
|
||||
Services.obs.addObserver(this, "memory-pressure", false);
|
||||
|
Loading…
Reference in New Issue
Block a user