Bug 998500 - Add command line argument for turning on OOP in B2G Desktop; r=fabrice

This commit is contained in:
Kyle Machulis 2014-04-24 11:06:57 -07:00
Родитель 20f01f3095
Коммит 9fd37e8d2f
4 изменённых файлов: 54 добавлений и 0 удалений

Просмотреть файл

@ -86,4 +86,9 @@ contract @mozilla.org/helperapplauncherdialog;1 {710322af-e6ae-4b0c-b2c9-1474a87
component {c83c02c0-5d43-4e3e-987f-9173b313e880} SimulatorScreen.js
contract @mozilla.org/simulator-screen;1 {c83c02c0-5d43-4e3e-987f-9173b313e880}
category profile-after-change SimulatorScreen @mozilla.org/simulator-screen;1
component {e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e} OopCommandLine.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=b2goop {e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}
category command-line-handler m-b2goop @mozilla.org/commandlinehandler/general-startup;1?type=b2goop
#endif

Просмотреть файл

@ -0,0 +1,47 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
function oopCommandlineHandler() {
}
oopCommandlineHandler.prototype = {
handle: function(cmdLine) {
let oopFlag = cmdLine.handleFlag("oop", false);
if (oopFlag) {
/**
* Manipulate preferences by adding to the *default* branch. Adding
* to the default branch means the changes we make won"t get written
* back to user preferences.
*/
let prefs = Services.prefs
let branch = prefs.getDefaultBranch("");
try {
// Turn on all OOP services, making desktop run similar to phone
// environment
branch.setBoolPref("dom.ipc.tabs.disabled", false);
branch.setBoolPref("layers.acceleration.disabled", false);
branch.setBoolPref("layers.offmainthreadcomposition.enabled", true);
branch.setBoolPref("layers.offmainthreadcomposition.async-animations", true);
branch.setBoolPref("layers.async-video.enabled", true);
branch.setBoolPref("layers.async-pan-zoom.enabled", true);
branch.setCharPref("gfx.content.azure.backends", "cairo");
} catch (e) { }
}
if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
cmdLine.preventDefault = true;
}
},
helpInfo: " -oop Use out-of-process model in B2G\n",
classID: Components.ID("{e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([oopCommandlineHandler]);

Просмотреть файл

@ -25,6 +25,7 @@ EXTRA_COMPONENTS += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
EXTRA_COMPONENTS += [
'OopCommandLine.js',
'SimulatorScreen.js'
]

Просмотреть файл

@ -432,6 +432,7 @@
@BINPATH@/components/amContentHandler.js
@BINPATH@/components/amWebInstallListener.js
@BINPATH@/components/nsBlocklistService.js
@BINPATH@/components/OopCommandLine.js
#endif
#ifdef MOZ_UPDATER