b2g/components/OopCommandLine.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
michael@0 6 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 7 XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
michael@0 8
michael@0 9 function oopCommandlineHandler() {
michael@0 10 }
michael@0 11
michael@0 12 oopCommandlineHandler.prototype = {
michael@0 13 handle: function(cmdLine) {
michael@0 14 let oopFlag = cmdLine.handleFlag("oop", false);
michael@0 15 if (oopFlag) {
michael@0 16 /**
michael@0 17 * Manipulate preferences by adding to the *default* branch. Adding
michael@0 18 * to the default branch means the changes we make won"t get written
michael@0 19 * back to user preferences.
michael@0 20 */
michael@0 21 let prefs = Services.prefs
michael@0 22 let branch = prefs.getDefaultBranch("");
michael@0 23
michael@0 24 try {
michael@0 25 // Turn on all OOP services, making desktop run similar to phone
michael@0 26 // environment
michael@0 27 branch.setBoolPref("dom.ipc.tabs.disabled", false);
michael@0 28 branch.setBoolPref("layers.acceleration.disabled", false);
michael@0 29 branch.setBoolPref("layers.offmainthreadcomposition.enabled", true);
michael@0 30 branch.setBoolPref("layers.offmainthreadcomposition.async-animations", true);
michael@0 31 branch.setBoolPref("layers.async-video.enabled", true);
michael@0 32 branch.setBoolPref("layers.async-pan-zoom.enabled", true);
michael@0 33 branch.setCharPref("gfx.content.azure.backends", "cairo");
michael@0 34 } catch (e) { }
michael@0 35
michael@0 36 }
michael@0 37 if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
michael@0 38 cmdLine.preventDefault = true;
michael@0 39 }
michael@0 40 },
michael@0 41
michael@0 42 helpInfo: " -oop Use out-of-process model in B2G\n",
michael@0 43 classID: Components.ID("{e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}"),
michael@0 44 QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
michael@0 45 };
michael@0 46
michael@0 47 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([oopCommandlineHandler]);

mercurial