Files
palemoon27/dom/requestsync/RequestSyncScheduler.js
roytam1 10f5941b9c import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1246051 - have MediaQueue<T>::Peek/PeekFront return a RefPtr<> to avoid dangling pointers per comment 0. r=gerald. (00f334efb1)
- Bug 1264199: P1. Perform audio conversion in the MSDM taskqueue and ahead of use. r=kinetik (001936e3ea)
- Bug 1267983 - include MediaQueue.h; r=jwwang (036107d765)
- Bug 1264199: P0. Fix nsDequeue/MediaQueue methods constness. r=jwwang (9aa33dfcb5)
- Bug 1264199: P0.1. Export SaferMultDiv method. r=gerald (0b7a35ae4d)
- Bug 1264199: P2. Ensure the AudioStream only ever receive the same content format. r=kinetik (a180d09279)
- Bug 1264199: P3. Attempt to minimize audio quality loss and unnecessary processing. r=kinetik (29d57b5a33)
- Bug 1264199: P4. Add mono to stereo upmix to AudioConverter. r=rillian (49c029bd86)
- Bug 1264199: P5. Perform all downmixing operations in DecodedAudioDataSink. r=kinetik (05a479f095)
- Bug 1264199: P6. Drain resampler when changing format or reaching the end. r=kinetik (8639102a94)
- Bug 1264199: P8. Handle potential resampling errors. r=kinetik (1267e4e73d)
- Bug 1264199: P9. Include pending frames in HasUnplayedFrames calculation. r=jwwang (ce7097fc90)
2024-08-28 23:32:14 +08:00

101 lines
2.9 KiB
JavaScript

/* 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/. */
'use strict';
function debug(s) {
//dump('DEBUG RequestSyncScheduler: ' + s + '\n');
}
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/DOMRequestHelper.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyServiceGetter(this, 'cpmm',
'@mozilla.org/childprocessmessagemanager;1',
'nsIMessageSender');
function RequestSyncScheduler() {
debug('created');
}
RequestSyncScheduler.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
classDescription: 'RequestSyncScheduler XPCOM Component',
classID: Components.ID('{8ee5ab74-15c4-478f-9d32-67627b9f0f1a}'),
contractID: '@mozilla.org/dom/request-sync-scheduler;1',
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
Ci.nsIObserver,
Ci.nsIDOMGlobalPropertyInitializer]),
_messages: [ 'RequestSync:Register:Return',
'RequestSync:Unregister:Return',
'RequestSync:Registrations:Return',
'RequestSync:Registration:Return' ],
init: function(aWindow) {
debug('init');
// DOMRequestIpcHelper.initHelper sets this._window
this.initDOMRequestHelper(aWindow, this._messages);
},
register: function(aTask, aParams) {
debug('register');
return this.sendMessage('RequestSync:Register',
{ task: aTask, params: aParams });
},
unregister: function(aTask) {
debug('unregister');
return this.sendMessage('RequestSync:Unregister',
{ task: aTask });
},
registrations: function() {
debug('registrations');
return this.sendMessage('RequestSync:Registrations', {});
},
registration: function(aTask) {
debug('registration');
return this.sendMessage('RequestSync:Registration',
{ task: aTask });
},
sendMessage: function(aMsg, aObj) {
let self = this;
return this.createPromiseWithId(function(aResolverId) {
aObj.requestID = aResolverId;
cpmm.sendAsyncMessage(aMsg, aObj, null,
self._window.document.nodePrincipal);
});
},
receiveMessage: function(aMessage) {
debug('receiveMessage');
let req = this.getPromiseResolver(aMessage.data.requestID);
if (!req) {
return;
}
if ('error' in aMessage.data) {
req.reject(Cu.cloneInto(aMessage.data.error, this._window));
return;
}
if ('results' in aMessage.data) {
req.resolve(Cu.cloneInto(aMessage.data.results, this._window));
return;
}
req.resolve();
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RequestSyncScheduler]);