Bug 707883 - Make nsITelephonyWorker more generic in preparation for more workers. r=bent

This commit is contained in:
Blake Kaplan 2011-12-06 16:47:35 +08:00
parent 53bea9cb98
commit 4757794925
9 changed files with 57 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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<nsITelephonyWorker> worker(do_CreateInstance(kTelephonyWorkerCID));
nsCOMPtr<nsIRadioWorker> worker(do_CreateInstance(kTelephonyWorkerCID));
NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
jsval workerval;

View File

@ -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 <bent.mozilla@gmail.com> (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;
};

View File

@ -52,7 +52,6 @@ include $(topsrcdir)/dom/dom-config.mk
XPIDLSRCS = \
mozIDOMTelephony.idl \
nsITelephonyWorker.idl \
nsITelephone.idl \
$(NULL)

View File

@ -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 } }
%}

View File

@ -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,

View File

@ -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