1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/b2g/components/OopCommandLine.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; 1.9 +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.10 +XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); 1.11 + 1.12 +function oopCommandlineHandler() { 1.13 +} 1.14 + 1.15 +oopCommandlineHandler.prototype = { 1.16 + handle: function(cmdLine) { 1.17 + let oopFlag = cmdLine.handleFlag("oop", false); 1.18 + if (oopFlag) { 1.19 + /** 1.20 + * Manipulate preferences by adding to the *default* branch. Adding 1.21 + * to the default branch means the changes we make won"t get written 1.22 + * back to user preferences. 1.23 + */ 1.24 + let prefs = Services.prefs 1.25 + let branch = prefs.getDefaultBranch(""); 1.26 + 1.27 + try { 1.28 + // Turn on all OOP services, making desktop run similar to phone 1.29 + // environment 1.30 + branch.setBoolPref("dom.ipc.tabs.disabled", false); 1.31 + branch.setBoolPref("layers.acceleration.disabled", false); 1.32 + branch.setBoolPref("layers.offmainthreadcomposition.enabled", true); 1.33 + branch.setBoolPref("layers.offmainthreadcomposition.async-animations", true); 1.34 + branch.setBoolPref("layers.async-video.enabled", true); 1.35 + branch.setBoolPref("layers.async-pan-zoom.enabled", true); 1.36 + branch.setCharPref("gfx.content.azure.backends", "cairo"); 1.37 + } catch (e) { } 1.38 + 1.39 + } 1.40 + if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) { 1.41 + cmdLine.preventDefault = true; 1.42 + } 1.43 + }, 1.44 + 1.45 + helpInfo: " -oop Use out-of-process model in B2G\n", 1.46 + classID: Components.ID("{e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}"), 1.47 + QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]), 1.48 +}; 1.49 + 1.50 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([oopCommandlineHandler]);