From b1e29774d870a32ccc3f1be17bbce8edd837854c Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Tue, 6 Dec 2011 16:47:35 +0800 Subject: [PATCH] Bug 707883 - Make nsITelephonyWorker more generic in preparation for more workers. r=bent --- browser/installer/package-manifest.in | 1 + browser/installer/removed-files.in | 2 + dom/system/b2g/Makefile.in | 4 ++ dom/system/b2g/RadioManager.cpp | 5 ++- dom/system/b2g/nsIRadioWorker.idl | 43 +++++++++++++++++++ dom/telephony/Makefile.in | 1 - ...elephonyWorker.idl => nsTelephonyWorker.h} | 11 ----- dom/telephony/nsTelephonyWorker.js | 6 +-- mobile/xul/installer/package-manifest.in | 1 + 9 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 dom/system/b2g/nsIRadioWorker.idl rename dom/telephony/{nsITelephonyWorker.idl => nsTelephonyWorker.h} (91%) diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 81bcea6278c..7a5ba918e48 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -138,6 +138,7 @@ @BINPATH@/components/dom_base.xpt #ifdef MOZ_B2G_RIL @BINPATH@/components/dom_telephony.xpt +@BINPATH@/components/dom_system_b2g.xpt #endif @BINPATH@/components/dom_battery.xpt @BINPATH@/components/dom_canvas.xpt diff --git a/browser/installer/removed-files.in b/browser/installer/removed-files.in index 3200ed893b1..6b7d4e5b8f5 100644 --- a/browser/installer/removed-files.in +++ b/browser/installer/removed-files.in @@ -70,6 +70,7 @@ components/pluginGlue.js components/sidebar.xpt #ifdef MOZ_B2G_RIL components/dom_telephony.xpt +components/dom_system_b2g.xpt #endif components/WeaveCrypto.js components/WeaveCrypto.manifest @@ -1141,6 +1142,7 @@ xpicleanup@BIN_SUFFIX@ components/dom_base.xpt #ifdef MOZ_B2G_RIL components/dom_telephony.xpt + components/dom_system_b2g.xpt #endif components/dom_canvas.xpt components/dom_core.xpt diff --git a/dom/system/b2g/Makefile.in b/dom/system/b2g/Makefile.in index aa3aceec50a..8707a6a0240 100644 --- a/dom/system/b2g/Makefile.in +++ b/dom/system/b2g/Makefile.in @@ -44,6 +44,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = dom LIBRARY_NAME = domsystemb2g_s +XPIDL_MODULE = dom_system_b2g LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 @@ -53,8 +54,11 @@ CPPSRCS = \ RadioManager.cpp \ $(NULL) +XPIDLSRCS = nsIRadioWorker.idl + LOCAL_INCLUDES = \ -I$(topsrcdir)/dom/base \ + -I$(topsrcdir)/dom/telephony \ -I$(topsrcdir)/content/events/src \ $(NULL) diff --git a/dom/system/b2g/RadioManager.cpp b/dom/system/b2g/RadioManager.cpp index fdd524a9670..503c9ac2c82 100644 --- a/dom/system/b2g/RadioManager.cpp +++ b/dom/system/b2g/RadioManager.cpp @@ -38,13 +38,14 @@ * ***** END LICENSE BLOCK ***** */ #include "RadioManager.h" -#include "nsITelephonyWorker.h" +#include "nsIRadioWorker.h" #include "nsContentUtils.h" #include "nsIXPConnect.h" #include "nsIJSContextStack.h" #include "nsIObserverService.h" #include "mozilla/dom/workers/Workers.h" #include "jstypedarray.h" +#include "nsTelephonyWorker.h" #include "nsThreadUtils.h" @@ -226,7 +227,7 @@ RadioManager::Init() // The telephony worker component is a hack that gives us a global object for // our own functions and makes creating the worker possible. - nsCOMPtr worker(do_CreateInstance(kTelephonyWorkerCID)); + nsCOMPtr worker(do_CreateInstance(kTelephonyWorkerCID)); NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE); jsval workerval; diff --git a/dom/system/b2g/nsIRadioWorker.idl b/dom/system/b2g/nsIRadioWorker.idl new file mode 100644 index 00000000000..859bee2b48d --- /dev/null +++ b/dom/system/b2g/nsIRadioWorker.idl @@ -0,0 +1,43 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Telephony. + * + * The Initial Developer of the Original Code is + * The Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ben Turner (Original Author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +[scriptable, uuid(8f031451-ac25-4816-a09e-a075bb704e63)] +interface nsIRadioWorker : nsISupports { + readonly attribute jsval worker; +}; diff --git a/dom/telephony/Makefile.in b/dom/telephony/Makefile.in index 1cfa0186ca1..181d5794141 100644 --- a/dom/telephony/Makefile.in +++ b/dom/telephony/Makefile.in @@ -52,7 +52,6 @@ include $(topsrcdir)/dom/dom-config.mk XPIDLSRCS = \ mozIDOMTelephony.idl \ - nsITelephonyWorker.idl \ nsITelephone.idl \ $(NULL) diff --git a/dom/telephony/nsITelephonyWorker.idl b/dom/telephony/nsTelephonyWorker.h similarity index 91% rename from dom/telephony/nsITelephonyWorker.idl rename to dom/telephony/nsTelephonyWorker.h index 844487defaa..f9a3f6e6537 100644 --- a/dom/telephony/nsITelephonyWorker.idl +++ b/dom/telephony/nsTelephonyWorker.h @@ -35,17 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.idl" - -[scriptable, uuid(8f031451-ac25-4816-a09e-a075bb704e63)] -interface nsITelephonyWorker : nsISupports { - readonly attribute jsval worker; -}; - -%{ C++ - #define NS_TELEPHONYWORKER_CID \ { 0x2d831c8d, 0x6017, 0x435b, \ { 0xa8, 0x0c, 0xe5, 0xd4, 0x22, 0x81, 0x0c, 0xea } } - -%} diff --git a/dom/telephony/nsTelephonyWorker.js b/dom/telephony/nsTelephonyWorker.js index 1ad6dba1fdf..ff8a647b912 100644 --- a/dom/telephony/nsTelephonyWorker.js +++ b/dom/telephony/nsTelephonyWorker.js @@ -60,10 +60,10 @@ nsTelephonyWorker.prototype = { classInfo: XPCOMUtils.generateCI({classID: TELEPHONYWORKER_CID, contractID: TELEPHONYWORKER_CONTRACTID, classDescription: "TelephonyWorker", - interfaces: [Ci.nsITelephonyWorker, + interfaces: [Ci.nsIRadioWorker, Ci.nsITelephone]}), - QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyWorker, + QueryInterface: XPCOMUtils.generateQI([Ci.nsIRadioWorker, Ci.nsITelephone]), onerror: function onerror(event) { @@ -118,7 +118,7 @@ nsTelephonyWorker.prototype = { }); }, - // nsITelephonyWorker + // nsIRadioWorker worker: null, diff --git a/mobile/xul/installer/package-manifest.in b/mobile/xul/installer/package-manifest.in index 9e82e4dd903..bb8f888f6a7 100644 --- a/mobile/xul/installer/package-manifest.in +++ b/mobile/xul/installer/package-manifest.in @@ -153,6 +153,7 @@ @BINPATH@/components/dom_base.xpt #ifdef MOZ_B2G_RIL @BINPATH@/components/dom_telephony.xpt +@BINPATH@/components/dom_system_b2g.xpt #endif @BINPATH@/components/dom_battery.xpt @BINPATH@/components/dom_canvas.xpt