mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Merge mozilla-central to autoland a=merge on a CLOSED TREE
--HG-- rename : dom/media/webrtc/MediaEngine.h => dom/media/webrtc/MediaEnginePrefs.h extra : rebase_source : 661454de54cac8d23010da02d0c0d68c1856500d
This commit is contained in:
commit
d652648d08
@ -65,29 +65,30 @@ addMessageListener("Test:ExpectNoObserverCalled", data => {
|
||||
});
|
||||
|
||||
function _getMediaCaptureState() {
|
||||
let hasVideo = {};
|
||||
let hasAudio = {};
|
||||
let hasCamera = {};
|
||||
let hasMicrophone = {};
|
||||
let hasScreenShare = {};
|
||||
let hasWindowShare = {};
|
||||
let hasAppShare = {};
|
||||
let hasBrowserShare = {};
|
||||
MediaManagerService.mediaCaptureWindowState(content, hasVideo, hasAudio,
|
||||
MediaManagerService.mediaCaptureWindowState(content,
|
||||
hasCamera, hasMicrophone,
|
||||
hasScreenShare, hasWindowShare,
|
||||
hasAppShare, hasBrowserShare);
|
||||
let result = {};
|
||||
|
||||
if (hasVideo.value)
|
||||
if (hasCamera.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.video = true;
|
||||
if (hasAudio.value)
|
||||
if (hasMicrophone.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.audio = true;
|
||||
|
||||
if (hasScreenShare.value)
|
||||
if (hasScreenShare.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.screen = "Screen";
|
||||
else if (hasWindowShare.value)
|
||||
else if (hasWindowShare.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.screen = "Window";
|
||||
else if (hasAppShare.value)
|
||||
else if (hasAppShare.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.screen = "Application";
|
||||
else if (hasBrowserShare.value)
|
||||
else if (hasBrowserShare.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
result.screen = "Browser";
|
||||
|
||||
return result;
|
||||
|
@ -315,9 +315,13 @@ function updateIndicators(aSubject, aTopic, aData) {
|
||||
}
|
||||
|
||||
let tabState = getTabStateForContentWindow(contentWindow);
|
||||
if (tabState.camera)
|
||||
if (tabState.camera == MediaManagerService.STATE_CAPTURE_ENABLED)
|
||||
state.showCameraIndicator = true;
|
||||
if (tabState.microphone)
|
||||
if (tabState.camera == MediaManagerService.STATE_CAPTURE_DISABLED)
|
||||
state.showCameraIndicator = true;
|
||||
if (tabState.microphone == MediaManagerService.STATE_CAPTURE_ENABLED)
|
||||
state.showMicrophoneIndicator = true;
|
||||
if (tabState.microphone == MediaManagerService.STATE_CAPTURE_DISABLED)
|
||||
state.showMicrophoneIndicator = true;
|
||||
if (tabState.screen) {
|
||||
if (tabState.screen == "Screen") {
|
||||
@ -348,7 +352,9 @@ function removeBrowserSpecificIndicator(aSubject, aTopic, aData) {
|
||||
}
|
||||
|
||||
let tabState = getTabStateForContentWindow(contentWindow);
|
||||
if (!tabState.camera && !tabState.microphone && !tabState.screen)
|
||||
if (tabState.camera == MediaManagerService.STATE_NOCAPTURE &&
|
||||
tabState.microphone == MediaManagerService.STATE_NOCAPTURE &&
|
||||
!tabState.screen)
|
||||
tabState = {windowId: tabState.windowId};
|
||||
|
||||
let mm = getMessageManagerForWindow(contentWindow);
|
||||
@ -358,16 +364,17 @@ function removeBrowserSpecificIndicator(aSubject, aTopic, aData) {
|
||||
|
||||
function getTabStateForContentWindow(aContentWindow) {
|
||||
let camera = {}, microphone = {}, screen = {}, window = {}, app = {}, browser = {};
|
||||
MediaManagerService.mediaCaptureWindowState(aContentWindow, camera, microphone,
|
||||
MediaManagerService.mediaCaptureWindowState(aContentWindow,
|
||||
camera, microphone,
|
||||
screen, window, app, browser);
|
||||
let tabState = {camera: camera.value, microphone: microphone.value};
|
||||
if (screen.value)
|
||||
if (screen.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
tabState.screen = "Screen";
|
||||
else if (window.value)
|
||||
else if (window.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
tabState.screen = "Window";
|
||||
else if (app.value)
|
||||
else if (app.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
tabState.screen = "Application";
|
||||
else if (browser.value)
|
||||
else if (browser.value != MediaManagerService.STATE_NOCAPTURE)
|
||||
tabState.screen = "Browser";
|
||||
|
||||
tabState.windowId = getInnerWindowIDForWindow(aContentWindow);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
// for mozilla::dom::workers::kJSPrincipalsDebugToken
|
||||
#include "mozilla/dom/workers/WorkerCommon.h"
|
||||
#include "mozilla/dom/workerinternals/JSSettings.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -90,7 +90,7 @@ JSPrincipals::dump()
|
||||
nsresult rv = static_cast<nsJSPrincipals *>(this)->GetScriptLocation(str);
|
||||
fprintf(stderr, "nsIPrincipal (%p) = %s\n", static_cast<void*>(this),
|
||||
NS_SUCCEEDED(rv) ? str.get() : "(unknown)");
|
||||
} else if (debugToken == dom::workers::kJSPrincipalsDebugToken) {
|
||||
} else if (debugToken == dom::workerinternals::kJSPrincipalsDebugToken) {
|
||||
fprintf(stderr, "Web Worker principal singleton (%p)\n", this);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "AbortController.h"
|
||||
#include "AbortSignal.h"
|
||||
#include "mozilla/dom/AbortControllerBinding.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -19,8 +19,4 @@ UNIFIED_SOURCES += [
|
||||
'AbortSignal.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -1791,9 +1791,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool Notify(Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
MOZ_ASSERT(aStatus > workers::Running);
|
||||
MOZ_ASSERT(aStatus > Running);
|
||||
if (aStatus >= Canceling) {
|
||||
mEventSourceImpl->Close();
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "ImageEncoder.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
#include "mozilla/layers/AsyncCanvasRenderer.h"
|
||||
@ -16,7 +17,6 @@
|
||||
#include "nsIThreadPool.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "YCbCrUtils.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "mozilla/dom/VRDisplay.h"
|
||||
#include "mozilla/dom/VRDisplayEvent.h"
|
||||
#include "mozilla/dom/VRServiceTest.h"
|
||||
#include "mozilla/dom/workers/RuntimeService.h"
|
||||
#include "mozilla/dom/workerinternals/RuntimeService.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
@ -82,8 +82,8 @@
|
||||
#include "mozilla/dom/FormData.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
|
||||
#if defined(XP_LINUX)
|
||||
#include "mozilla/Hal.h"
|
||||
@ -692,7 +692,8 @@ Navigator::JavaEnabled(CallerType aCallerType, ErrorResult& aRv)
|
||||
uint64_t
|
||||
Navigator::HardwareConcurrency()
|
||||
{
|
||||
workers::RuntimeService* rts = workers::RuntimeService::GetOrCreateService();
|
||||
workerinternals::RuntimeService* rts =
|
||||
workerinternals::RuntimeService::GetOrCreateService();
|
||||
if (!rts) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TimeoutManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -436,7 +436,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/storage',
|
||||
'/dom/svg',
|
||||
'/dom/u2f',
|
||||
'/dom/workers',
|
||||
'/dom/xbl',
|
||||
'/dom/xml',
|
||||
'/dom/xslt/xpath',
|
||||
|
@ -2446,7 +2446,7 @@ nsContentUtils::ThreadsafeIsCallerChrome()
|
||||
{
|
||||
return NS_IsMainThread() ?
|
||||
IsCallerChrome() :
|
||||
mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
|
||||
workers::IsCurrentThreadRunningChromeWorker();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -82,7 +82,7 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsLayoutStatics.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "mozilla/dom/workers/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
@ -80,7 +80,7 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsLayoutStatics.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "mozilla/dom/workers/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsError.h"
|
||||
@ -19,7 +20,6 @@
|
||||
#include "nsIScriptTimeoutHandler.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -146,7 +146,7 @@ DOMInterfaces = {
|
||||
|
||||
'ChromeWorker': {
|
||||
'headerFile': 'mozilla/dom/WorkerPrivate.h',
|
||||
'nativeType': 'mozilla::dom::workers::ChromeWorkerPrivate',
|
||||
'nativeType': 'mozilla::dom::ChromeWorkerPrivate',
|
||||
},
|
||||
|
||||
'console': {
|
||||
@ -644,8 +644,6 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'NotificationEvent': {
|
||||
'headerFile': 'mozilla/dom/NotificationEvent.h',
|
||||
'nativeType': 'mozilla::dom::workers::NotificationEvent',
|
||||
'binaryNames': {
|
||||
'notification': 'notification_'
|
||||
}
|
||||
@ -762,11 +760,6 @@ DOMInterfaces = {
|
||||
'implicitJSContext': [ 'pushManager' ],
|
||||
},
|
||||
|
||||
'SharedWorker': {
|
||||
'nativeType': 'mozilla::dom::workers::SharedWorker',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/SharedWorker.h',
|
||||
},
|
||||
|
||||
'SharedWorkerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'implicitJSContext': [ 'close' ],
|
||||
@ -1360,7 +1353,7 @@ DOMInterfaces = {
|
||||
|
||||
'Worker': {
|
||||
'headerFile': 'mozilla/dom/WorkerPrivate.h',
|
||||
'nativeType': 'mozilla::dom::workers::WorkerPrivate',
|
||||
'nativeType': 'mozilla::dom::WorkerPrivate',
|
||||
},
|
||||
|
||||
'WorkerDebuggerGlobalScope': {
|
||||
|
@ -77,7 +77,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/media/webaudio',
|
||||
'/dom/media/webspeech/recognition',
|
||||
'/dom/svg',
|
||||
'/dom/workers',
|
||||
'/dom/xbl',
|
||||
'/dom/xml',
|
||||
'/dom/xslt/base',
|
||||
|
@ -11,12 +11,12 @@
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
|
||||
#include "nsIBFCacheEntry.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -234,19 +234,19 @@ private:
|
||||
|
||||
NS_IMPL_ISUPPORTS(TeardownRunnable, nsICancelableRunnable, nsIRunnable)
|
||||
|
||||
class BroadcastChannelWorkerHolder final : public workers::WorkerHolder
|
||||
class BroadcastChannelWorkerHolder final : public WorkerHolder
|
||||
{
|
||||
BroadcastChannel* mChannel;
|
||||
|
||||
public:
|
||||
explicit BroadcastChannelWorkerHolder(BroadcastChannel* aChannel)
|
||||
: workers::WorkerHolder("BroadcastChannelWorkerHolder")
|
||||
: WorkerHolder("BroadcastChannelWorkerHolder")
|
||||
, mChannel(aChannel)
|
||||
{
|
||||
MOZ_COUNT_CTOR(BroadcastChannelWorkerHolder);
|
||||
}
|
||||
|
||||
virtual bool Notify(workers::Status aStatus) override
|
||||
virtual bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
if (aStatus >= Closing) {
|
||||
mChannel->Shutdown();
|
||||
|
@ -24,12 +24,9 @@ class PrincipalInfo;
|
||||
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerHolder;
|
||||
} // namespace workers
|
||||
|
||||
class BroadcastChannelChild;
|
||||
class BroadcastChannelMessage;
|
||||
class WorkerHolder;
|
||||
|
||||
class BroadcastChannel final
|
||||
: public DOMEventTargetHelper
|
||||
@ -86,7 +83,7 @@ private:
|
||||
|
||||
RefPtr<BroadcastChannelChild> mActor;
|
||||
|
||||
nsAutoPtr<workers::WorkerHolder> mWorkerHolder;
|
||||
nsAutoPtr<WorkerHolder> mWorkerHolder;
|
||||
|
||||
nsString mChannel;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -22,10 +22,6 @@ IPDL_SOURCES += [
|
||||
'PBroadcastChannel.ipdl',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
|
||||
|
||||
|
2
dom/cache/Cache.cpp
vendored
2
dom/cache/Cache.cpp
vendored
@ -27,8 +27,6 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using mozilla::ipc::PBackgroundChild;
|
||||
|
||||
namespace {
|
||||
|
3
dom/cache/CacheStorage.cpp
vendored
3
dom/cache/CacheStorage.cpp
vendored
@ -21,6 +21,7 @@
|
||||
#include "mozilla/dom/cache/PCacheChild.h"
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "mozilla/dom/cache/TypeUtils.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
@ -30,7 +31,6 @@
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsURLParsers.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -38,7 +38,6 @@ namespace cache {
|
||||
|
||||
using mozilla::Unused;
|
||||
using mozilla::ErrorResult;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
using mozilla::ipc::PBackgroundChild;
|
||||
using mozilla::ipc::IProtocol;
|
||||
|
7
dom/cache/CacheStorage.h
vendored
7
dom/cache/CacheStorage.h
vendored
@ -29,10 +29,7 @@ namespace dom {
|
||||
|
||||
enum class CacheStorageNamespace : uint8_t;
|
||||
class Promise;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // namespace workers
|
||||
class WorkerPrivate;
|
||||
|
||||
namespace cache {
|
||||
|
||||
@ -53,7 +50,7 @@ public:
|
||||
|
||||
static already_AddRefed<CacheStorage>
|
||||
CreateOnWorker(Namespace aNamespace, nsIGlobalObject* aGlobal,
|
||||
workers::WorkerPrivate* aWorkerPrivate, ErrorResult& aRv);
|
||||
WorkerPrivate* aWorkerPrivate, ErrorResult& aRv);
|
||||
|
||||
static bool
|
||||
DefineCaches(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
||||
|
8
dom/cache/CacheWorkerHolder.cpp
vendored
8
dom/cache/CacheWorkerHolder.cpp
vendored
@ -7,16 +7,12 @@
|
||||
#include "mozilla/dom/cache/CacheWorkerHolder.h"
|
||||
|
||||
#include "mozilla/dom/cache/ActorChild.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
using mozilla::dom::workers::Terminating;
|
||||
using mozilla::dom::workers::Status;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
|
||||
// static
|
||||
already_AddRefed<CacheWorkerHolder>
|
||||
CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate, Behavior aBehavior)
|
||||
@ -93,7 +89,7 @@ CacheWorkerHolder::Notified() const
|
||||
}
|
||||
|
||||
bool
|
||||
CacheWorkerHolder::Notify(Status aStatus)
|
||||
CacheWorkerHolder::Notify(WorkerStatus aStatus)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheWorkerHolder);
|
||||
|
||||
|
10
dom/cache/CacheWorkerHolder.h
vendored
10
dom/cache/CacheWorkerHolder.h
vendored
@ -9,24 +9,22 @@
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTArray.h"
|
||||
#include "WorkerHolder.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // namespace workers
|
||||
|
||||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
class ActorChild;
|
||||
|
||||
class CacheWorkerHolder final : public workers::WorkerHolder
|
||||
class CacheWorkerHolder final : public WorkerHolder
|
||||
{
|
||||
public:
|
||||
static already_AddRefed<CacheWorkerHolder>
|
||||
Create(workers::WorkerPrivate* aWorkerPrivate,
|
||||
Create(WorkerPrivate* aWorkerPrivate,
|
||||
Behavior aBehavior);
|
||||
|
||||
static already_AddRefed<CacheWorkerHolder>
|
||||
@ -38,7 +36,7 @@ public:
|
||||
bool Notified() const;
|
||||
|
||||
// WorkerHolder methods
|
||||
virtual bool Notify(workers::Status aStatus) override;
|
||||
virtual bool Notify(WorkerStatus aStatus) override;
|
||||
|
||||
private:
|
||||
explicit CacheWorkerHolder(Behavior aBehavior);
|
||||
|
4
dom/cache/moz.build
vendored
4
dom/cache/moz.build
vendored
@ -82,10 +82,6 @@ IPDL_SOURCES += [
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
|
@ -1355,7 +1355,7 @@ public:
|
||||
, mNotified(false)
|
||||
{}
|
||||
|
||||
bool Notify(Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
if (!mNotified) {
|
||||
mNotified = true;
|
||||
|
@ -308,8 +308,7 @@ OffscreenCanvas::GetGlobalObject()
|
||||
return GetParentObject();
|
||||
}
|
||||
|
||||
dom::workers::WorkerPrivate* workerPrivate =
|
||||
dom::workers::GetCurrentThreadWorkerPrivate();
|
||||
dom::WorkerPrivate* workerPrivate = dom::GetCurrentThreadWorkerPrivate();
|
||||
return workerPrivate->GlobalScope();
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
'/dom/base',
|
||||
'/dom/html',
|
||||
'/dom/svg',
|
||||
|
@ -19,10 +19,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::workers::Closing;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::WorkerHolderToken;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using namespace workers;
|
||||
using mozilla::dom::ipc::StructuredCloneData;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozilla::dom::Client);
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include "mozilla/dom/ClientIPCTypes.h"
|
||||
#include "mozilla/dom/ClientOpPromise.h"
|
||||
#include "mozilla/dom/WorkerHolderToken.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/workers/bindings/WorkerHolderToken.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
@ -24,13 +24,10 @@ void
|
||||
StartClientManagerOp(Func aFunc, const Arg& aArg, nsISerialEventTarget* aTarget,
|
||||
Resolve aResolve, Reject aReject)
|
||||
{
|
||||
using mozilla::dom::workers::Closing;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::WorkerHolderToken;
|
||||
|
||||
RefPtr<WorkerHolderToken> token;
|
||||
if (!NS_IsMainThread()) {
|
||||
token = WorkerHolderToken::Create(GetCurrentThreadWorkerPrivate(), Closing);
|
||||
token = WorkerHolderToken::Create(workers::GetCurrentThreadWorkerPrivate(),
|
||||
mozilla::dom::WorkerStatus::Closing);
|
||||
}
|
||||
|
||||
RefPtr<ClientOpPromise> promise = aFunc(aArg, aTarget);
|
||||
|
@ -21,8 +21,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using namespace workers;
|
||||
using mozilla::ipc::PrincipalInfo;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Clients);
|
||||
|
@ -16,10 +16,6 @@ UNIFIED_SOURCES += [
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/workers',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "ClientManagerOpChild.h"
|
||||
#include "ClientPrefs.h"
|
||||
#include "ClientSource.h"
|
||||
#include "mozilla/dom/WorkerHolderToken.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/workers/bindings/WorkerHolderToken.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -24,10 +24,6 @@ namespace dom {
|
||||
using mozilla::ipc::BackgroundChild;
|
||||
using mozilla::ipc::PBackgroundChild;
|
||||
using mozilla::ipc::PrincipalInfo;
|
||||
using mozilla::dom::workers::Closing;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::WorkerHolderToken;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -46,7 +42,7 @@ ClientManager::ClientManager()
|
||||
|
||||
RefPtr<WorkerHolderToken> workerHolderToken;
|
||||
if (!NS_IsMainThread()) {
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_DIAGNOSTIC_ASSERT(workerPrivate);
|
||||
|
||||
workerHolderToken =
|
||||
|
@ -29,10 +29,7 @@ class ClientOpConstructorArgs;
|
||||
class ClientOpenWindowArgs;
|
||||
class ClientSource;
|
||||
enum class ClientType : uint8_t;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // workers namespace
|
||||
|
||||
// The ClientManager provides a per-thread singleton interface workering
|
||||
// with the client subsystem. It allows globals to create ClientSource
|
||||
@ -76,7 +73,7 @@ class ClientManager final : public ClientThing<ClientManagerChild>
|
||||
GetOrCreateForCurrentThread();
|
||||
|
||||
// Private methods called by ClientSource
|
||||
mozilla::dom::workers::WorkerPrivate*
|
||||
mozilla::dom::WorkerPrivate*
|
||||
GetWorkerPrivate() const;
|
||||
|
||||
public:
|
||||
|
@ -14,9 +14,6 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::workers::WorkerHolderToken;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
|
||||
void
|
||||
ClientManagerChild::ActorDestroy(ActorDestroyReason aReason)
|
||||
{
|
||||
|
@ -8,21 +8,19 @@
|
||||
|
||||
#include "ClientThing.h"
|
||||
#include "mozilla/dom/PClientManagerChild.h"
|
||||
#include "mozilla/dom/workers/bindings/WorkerHolderToken.h"
|
||||
#include "mozilla/dom/WorkerHolderToken.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // workers namespace
|
||||
|
||||
class ClientManagerChild final : public PClientManagerChild
|
||||
, public mozilla::dom::workers::WorkerHolderToken::Listener
|
||||
, public WorkerHolderToken::Listener
|
||||
{
|
||||
ClientThing<ClientManagerChild>* mManager;
|
||||
|
||||
RefPtr<mozilla::dom::workers::WorkerHolderToken> mWorkerHolderToken;
|
||||
RefPtr<WorkerHolderToken> mWorkerHolderToken;
|
||||
bool mTeardownStarted;
|
||||
|
||||
// PClientManagerChild interface
|
||||
@ -62,7 +60,7 @@ class ClientManagerChild final : public PClientManagerChild
|
||||
WorkerShuttingDown() override;
|
||||
|
||||
public:
|
||||
explicit ClientManagerChild(workers::WorkerHolderToken* aWorkerHolderToken);
|
||||
explicit ClientManagerChild(WorkerHolderToken* aWorkerHolderToken);
|
||||
|
||||
void
|
||||
SetOwner(ClientThing<ClientManagerChild>* aThing);
|
||||
@ -73,7 +71,7 @@ public:
|
||||
void
|
||||
MaybeStartTeardown();
|
||||
|
||||
mozilla::dom::workers::WorkerPrivate*
|
||||
mozilla::dom::WorkerPrivate*
|
||||
GetWorkerPrivate() const;
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,6 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::ipc::StructuredCloneData;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using mozilla::ipc::PrincipalInfo;
|
||||
using mozilla::ipc::PrincipalInfoToPrincipal;
|
||||
|
||||
|
@ -35,10 +35,7 @@ class ClientSourceExecutionReadyArgs;
|
||||
class ClientState;
|
||||
class ClientWindowState;
|
||||
class PClientManagerChild;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // workers namespace
|
||||
|
||||
// ClientSource is an RAII style class that is designed to be held via
|
||||
// a UniquePtr<>. When created ClientSource will register the existence
|
||||
@ -58,7 +55,7 @@ class ClientSource final : public ClientThing<ClientSourceChild>
|
||||
Variant<Nothing,
|
||||
RefPtr<nsPIDOMWindowInner>,
|
||||
nsCOMPtr<nsIDocShell>,
|
||||
mozilla::dom::workers::WorkerPrivate*> mOwner;
|
||||
WorkerPrivate*> mOwner;
|
||||
|
||||
ClientInfo mClientInfo;
|
||||
Maybe<ServiceWorkerDescriptor> mController;
|
||||
@ -75,7 +72,7 @@ class ClientSource final : public ClientThing<ClientSourceChild>
|
||||
void
|
||||
ExecutionReady(const ClientSourceExecutionReadyArgs& aArgs);
|
||||
|
||||
mozilla::dom::workers::WorkerPrivate*
|
||||
WorkerPrivate*
|
||||
GetWorkerPrivate() const;
|
||||
|
||||
nsIDocShell*
|
||||
@ -102,7 +99,7 @@ public:
|
||||
GetInnerWindow() const;
|
||||
|
||||
void
|
||||
WorkerExecutionReady(mozilla::dom::workers::WorkerPrivate* aWorkerPrivate);
|
||||
WorkerExecutionReady(WorkerPrivate* aWorkerPrivate);
|
||||
|
||||
nsresult
|
||||
WindowExecutionReady(nsPIDOMWindowInner* aInnerWindow);
|
||||
@ -124,7 +121,7 @@ public:
|
||||
// by the WorkerPrivate startup code to deal with a ClientHandle::Control()
|
||||
// call racing on the main thread. Do not call this in other circumstances!
|
||||
void
|
||||
WorkerSyncPing(mozilla::dom::workers::WorkerPrivate* aWorkerPrivate);
|
||||
WorkerSyncPing(WorkerPrivate* aWorkerPrivate);
|
||||
|
||||
// Synchronously mark the ClientSource as controlled by the given service
|
||||
// worker. This can happen as a result of a remote operation or directly
|
||||
|
@ -63,10 +63,6 @@ IPDL_SOURCES += [
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/workers',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/WorkletGlobalScope.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -25,9 +28,6 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "WorkerScope.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocShell.h"
|
||||
|
@ -42,7 +42,6 @@ EXTRA_COMPONENTS += [
|
||||
LOCAL_INCLUDES += [
|
||||
'/docshell/base',
|
||||
'/dom/base',
|
||||
'/dom/workers',
|
||||
'/js/xpconnect/src',
|
||||
]
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "mozilla/dom/WebCryptoCommon.h"
|
||||
#include "mozilla/dom/WebCryptoTask.h"
|
||||
#include "mozilla/dom/WebCryptoThreadPool.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/workers/bindings/WorkerHolder.h"
|
||||
|
||||
// Template taken from security/nss/lib/util/templates.c
|
||||
// This (or SGN_EncodeDigestInfo) would ideally be exported
|
||||
@ -39,12 +39,6 @@ const SEC_ASN1Template SGN_DigestInfoTemplate[] = {
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using mozilla::dom::workers::Canceling;
|
||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||
using mozilla::dom::workers::Status;
|
||||
using mozilla::dom::workers::WorkerHolder;
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
|
||||
// Pre-defined identifiers for telemetry histograms
|
||||
|
||||
enum TelemetryMethod {
|
||||
@ -159,7 +153,7 @@ public:
|
||||
Create()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
RefPtr<InternalWorkerHolder> ref = new InternalWorkerHolder();
|
||||
if (NS_WARN_IF(!ref->HoldWorker(workerPrivate, Canceling))) {
|
||||
@ -169,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool
|
||||
Notify(Status aStatus) override
|
||||
Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(InternalWorkerHolder);
|
||||
// Do nothing here. Since WebCryptoTask dispatches back to
|
||||
|
@ -29,7 +29,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/workers',
|
||||
'/security/manager/ssl',
|
||||
'/security/pkix/include',
|
||||
'/xpcom/build',
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/dom/Performance.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/MiscEvents.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -33,7 +34,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsRFPService.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -1118,8 +1118,7 @@ Event::TimeStampImpl() const
|
||||
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||
}
|
||||
|
||||
workers::WorkerPrivate* workerPrivate =
|
||||
workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
return workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||
|
@ -17,13 +17,13 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "mozilla/JSEventHandler.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -149,7 +149,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/html',
|
||||
'/dom/storage',
|
||||
'/dom/svg',
|
||||
'/dom/workers',
|
||||
'/dom/xml',
|
||||
'/dom/xul',
|
||||
'/js/xpconnect/wrappers',
|
||||
|
@ -45,10 +45,10 @@
|
||||
#include "InternalRequest.h"
|
||||
#include "InternalResponse.h"
|
||||
|
||||
#include "WorkerCommon.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "WorkerScope.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -174,7 +174,7 @@ public:
|
||||
{}
|
||||
|
||||
bool
|
||||
Notify(Status aStatus) override;
|
||||
Notify(WorkerStatus aStatus) override;
|
||||
};
|
||||
|
||||
class WorkerFetchResolver final : public FetchDriverObserver
|
||||
@ -190,7 +190,7 @@ class WorkerFetchResolver final : public FetchDriverObserver
|
||||
public:
|
||||
// Returns null if worker is shutting down.
|
||||
static already_AddRefed<WorkerFetchResolver>
|
||||
Create(workers::WorkerPrivate* aWorkerPrivate, Promise* aPromise,
|
||||
Create(WorkerPrivate* aWorkerPrivate, Promise* aPromise,
|
||||
AbortSignal* aSignal, FetchObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
@ -780,7 +780,7 @@ public:
|
||||
};
|
||||
|
||||
bool
|
||||
WorkerNotifier::Notify(Status aStatus)
|
||||
WorkerNotifier::Notify(WorkerStatus aStatus)
|
||||
{
|
||||
if (mResolver) {
|
||||
// This will nullify this object.
|
||||
@ -871,7 +871,7 @@ WorkerFetchResolver::FlushConsoleReport()
|
||||
return;
|
||||
}
|
||||
|
||||
workers::WorkerPrivate* worker = mPromiseProxy->GetWorkerPrivate();
|
||||
WorkerPrivate* worker = mPromiseProxy->GetWorkerPrivate();
|
||||
if (!worker) {
|
||||
mReporter->FlushReportsToConsole(0);
|
||||
return;
|
||||
|
@ -35,11 +35,9 @@ class InternalRequest;
|
||||
class OwningBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString;
|
||||
struct ReadableStream;
|
||||
class RequestOrUSVString;
|
||||
enum class CallerType : uint32_t;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
} // namespace workers
|
||||
|
||||
enum class CallerType : uint32_t;
|
||||
|
||||
already_AddRefed<Promise>
|
||||
FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
||||
@ -253,7 +251,7 @@ protected:
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
|
||||
// Always set whenever the FetchBody is created on the worker thread.
|
||||
workers::WorkerPrivate* mWorkerPrivate;
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
||||
// This is the ReadableStream exposed to content. It's underlying source is a
|
||||
// FetchStream object.
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include "Fetch.h"
|
||||
#include "FetchConsumer.h"
|
||||
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsIInputStreamPump.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "WorkerCommon.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "WorkerScope.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -23,14 +23,14 @@ using namespace workers;
|
||||
namespace {
|
||||
|
||||
template <class Derived>
|
||||
class FetchBodyWorkerHolder final : public workers::WorkerHolder
|
||||
class FetchBodyWorkerHolder final : public WorkerHolder
|
||||
{
|
||||
RefPtr<FetchBodyConsumer<Derived>> mConsumer;
|
||||
bool mWasNotified;
|
||||
|
||||
public:
|
||||
explicit FetchBodyWorkerHolder(FetchBodyConsumer<Derived>* aConsumer)
|
||||
: workers::WorkerHolder("FetchBodyWorkerHolder")
|
||||
: WorkerHolder("FetchBodyWorkerHolder")
|
||||
, mConsumer(aConsumer)
|
||||
, mWasNotified(false)
|
||||
{
|
||||
@ -39,9 +39,9 @@ public:
|
||||
|
||||
~FetchBodyWorkerHolder() = default;
|
||||
|
||||
bool Notify(workers::Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
MOZ_ASSERT(aStatus > workers::Running);
|
||||
MOZ_ASSERT(aStatus > Running);
|
||||
if (!mWasNotified) {
|
||||
mWasNotified = true;
|
||||
mConsumer->ShutDownMainThreadConsuming();
|
||||
|
@ -19,11 +19,8 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Promise;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
class WorkerHolder;
|
||||
}
|
||||
class WorkerPrivate;
|
||||
|
||||
template <class Derived> class FetchBody;
|
||||
|
||||
@ -62,7 +59,7 @@ public:
|
||||
void
|
||||
ShutDownMainThreadConsuming();
|
||||
|
||||
workers::WorkerPrivate*
|
||||
WorkerPrivate*
|
||||
GetWorkerPrivate() const
|
||||
{
|
||||
return mWorkerPrivate;
|
||||
@ -81,7 +78,7 @@ public:
|
||||
private:
|
||||
FetchBodyConsumer(nsIEventTarget* aMainThreadEventTarget,
|
||||
nsIGlobalObject* aGlobalObject,
|
||||
workers::WorkerPrivate* aWorkerPrivate,
|
||||
WorkerPrivate* aWorkerPrivate,
|
||||
FetchBody<Derived>* aBody,
|
||||
nsIInputStream* aBodyStream,
|
||||
Promise* aPromise,
|
||||
@ -112,12 +109,12 @@ private:
|
||||
// Set when consuming the body is attempted on a worker.
|
||||
// Unset when consumption is done/aborted.
|
||||
// This WorkerHolder keeps alive the consumer via a cycle.
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
UniquePtr<WorkerHolder> mWorkerHolder;
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||
|
||||
// Always set whenever the FetchBodyConsumer is created on the worker thread.
|
||||
workers::WorkerPrivate* mWorkerPrivate;
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
||||
// Touched on the main-thread only.
|
||||
nsCOMPtr<nsIInputStreamPump> mConsumeBodyPump;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/PerformanceStorage.h"
|
||||
#include "mozilla/dom/workers/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include "FetchStream.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIStreamTransportService.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "WorkerCommon.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#define FETCH_STREAM_FLAG 0
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
, mWasNotified(false)
|
||||
{}
|
||||
|
||||
bool Notify(Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
if (!mWasNotified) {
|
||||
mWasNotified = true;
|
||||
|
@ -21,11 +21,8 @@ class nsIInputStream;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerHolder;
|
||||
}
|
||||
|
||||
class FetchStreamHolder;
|
||||
class WorkerHolder;
|
||||
|
||||
class FetchStream final : public nsIInputStreamCallback
|
||||
, public nsIObserver
|
||||
@ -125,7 +122,7 @@ private:
|
||||
nsCOMPtr<nsIInputStream> mOriginalInputStream;
|
||||
nsCOMPtr<nsIAsyncInputStream> mInputStream;
|
||||
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
UniquePtr<WorkerHolder> mWorkerHolder;
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
, mWasNotified(false)
|
||||
{}
|
||||
|
||||
bool Notify(Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
if (!mWasNotified) {
|
||||
mWasNotified = true;
|
||||
|
@ -15,9 +15,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerHolder;
|
||||
}
|
||||
|
||||
class FetchStreamReader final : public nsIOutputStreamCallback
|
||||
, public PromiseNativeHandler
|
||||
@ -68,7 +66,7 @@ private:
|
||||
|
||||
nsCOMPtr<nsIAsyncOutputStream> mPipeOut;
|
||||
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
UniquePtr<WorkerHolder> mWorkerHolder;
|
||||
|
||||
JS::Heap<JSObject*> mReader;
|
||||
|
||||
|
@ -284,7 +284,7 @@ public:
|
||||
{
|
||||
auto self = MakeUnique<WorkerStreamOwner>(aStream);
|
||||
|
||||
if (!self->HoldWorker(aWorker, workers::Closing)) {
|
||||
if (!self->HoldWorker(aWorker, Closing)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ public:
|
||||
|
||||
// WorkerHolder:
|
||||
|
||||
bool Notify(workers::Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
if (!mStream) {
|
||||
return true;
|
||||
@ -408,7 +408,7 @@ public:
|
||||
static bool Start(nsIInputStream* aStream,
|
||||
JS::StreamConsumer* aConsumer,
|
||||
nsIGlobalObject* aGlobal,
|
||||
workers::WorkerPrivate* aMaybeWorker)
|
||||
WorkerPrivate* aMaybeWorker)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -531,7 +531,7 @@ FetchUtil::StreamResponseToJS(JSContext* aCx,
|
||||
JS::HandleObject aObj,
|
||||
JS::MimeType aMimeType,
|
||||
JS::StreamConsumer* aConsumer,
|
||||
workers::WorkerPrivate* aMaybeWorker)
|
||||
WorkerPrivate* aMaybeWorker)
|
||||
{
|
||||
MOZ_ASSERT(!aMaybeWorker == NS_IsMainThread());
|
||||
|
||||
|
@ -22,10 +22,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class InternalRequest;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
}
|
||||
|
||||
class FetchUtil final
|
||||
{
|
||||
@ -69,7 +66,7 @@ public:
|
||||
JS::HandleObject aObj,
|
||||
JS::MimeType aMimeType,
|
||||
JS::StreamConsumer* aConsumer,
|
||||
workers::WorkerPrivate* aMaybeWorker);
|
||||
WorkerPrivate* aMaybeWorker);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -13,9 +13,9 @@
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/FetchTypes.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/workers/WorkerCommon.h"
|
||||
|
||||
#include "WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -190,7 +188,7 @@ already_AddRefed<URL>
|
||||
ParseURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
@ -248,14 +246,14 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
}
|
||||
}
|
||||
|
||||
class ReferrerSameOriginChecker final : public workers::WorkerMainThreadRunnable
|
||||
class ReferrerSameOriginChecker final : public WorkerMainThreadRunnable
|
||||
{
|
||||
public:
|
||||
ReferrerSameOriginChecker(workers::WorkerPrivate* aWorkerPrivate,
|
||||
ReferrerSameOriginChecker(WorkerPrivate* aWorkerPrivate,
|
||||
const nsAString& aReferrerURL,
|
||||
nsresult& aResult)
|
||||
: workers::WorkerMainThreadRunnable(aWorkerPrivate,
|
||||
NS_LITERAL_CSTRING("Fetch :: Referrer same origin check")),
|
||||
: WorkerMainThreadRunnable(aWorkerPrivate,
|
||||
NS_LITERAL_CSTRING("Fetch :: Referrer same origin check")),
|
||||
mReferrerURL(aReferrerURL),
|
||||
mResult(aResult)
|
||||
{
|
||||
@ -407,7 +405,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
nsresult rv = NS_OK;
|
||||
// ReferrerSameOriginChecker uses a sync loop to get the main thread
|
||||
// to perform the same-origin check. Overall, on Workers this method
|
||||
@ -445,7 +443,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
if (worker) {
|
||||
worker->AssertIsOnWorkerThread();
|
||||
request->SetEnvironmentReferrerPolicy(worker->GetReferrerPolicy());
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
#include "nsDOMString.h"
|
||||
|
||||
@ -24,7 +25,6 @@
|
||||
#include "FetchStream.h"
|
||||
#include "FetchStreamReader.h"
|
||||
#include "InternalResponse.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -119,7 +119,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
|
||||
CopyUTF8toUTF16(spec, parsedURL);
|
||||
} else {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
@ -204,7 +204,7 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
internalResponse->InitChannelInfo(info);
|
||||
} else {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
internalResponse->InitChannelInfo(worker->GetChannelInfo());
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ IPDL_SOURCES += [
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
# For HttpBaseChannel.h dependencies
|
||||
'/netwerk/base',
|
||||
# For nsDataHandler.h
|
||||
|
@ -18,8 +18,6 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace workers;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(FileBlobImpl, BlobImpl)
|
||||
|
||||
FileBlobImpl::FileBlobImpl(nsIFile* aFile)
|
||||
@ -171,7 +169,7 @@ FileBlobImpl::GetType(nsAString& aType)
|
||||
"Should only use lazy ContentType when using the whole file");
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
if (!workerPrivate) {
|
||||
// I have no idea in which thread this method is called. We cannot
|
||||
// return any valid value.
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileReaderBinding.h"
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -27,14 +29,9 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerScope.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace workers;
|
||||
|
||||
#define ABORT_STR "abort"
|
||||
#define LOAD_STR "load"
|
||||
#define LOADSTART_STR "loadstart"
|
||||
@ -142,7 +139,7 @@ FileReader::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
JSContext* cx = aGlobal.Context();
|
||||
workerPrivate = GetWorkerPrivateFromContext(cx);
|
||||
workerPrivate = workers::GetWorkerPrivateFromContext(cx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
}
|
||||
|
||||
@ -834,7 +831,7 @@ FileReader::DecreaseBusyCounter()
|
||||
}
|
||||
|
||||
bool
|
||||
FileReader::Notify(Status aStatus)
|
||||
FileReader::Notify(WorkerStatus aStatus)
|
||||
{
|
||||
MOZ_ASSERT(mWorkerPrivate);
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
@ -16,7 +17,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "WorkerHolder.h"
|
||||
|
||||
#define NS_PROGRESS_EVENT_INTERVAL 50
|
||||
|
||||
@ -28,10 +28,7 @@ namespace dom {
|
||||
|
||||
class Blob;
|
||||
class DOMException;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
}
|
||||
|
||||
extern const uint64_t kUnknownSize;
|
||||
|
||||
@ -43,13 +40,13 @@ class FileReader final : public DOMEventTargetHelper,
|
||||
public nsIInputStreamCallback,
|
||||
public nsITimerCallback,
|
||||
public nsINamed,
|
||||
public workers::WorkerHolder
|
||||
public WorkerHolder
|
||||
{
|
||||
friend class FileReaderDecreaseBusyCounter;
|
||||
|
||||
public:
|
||||
FileReader(nsIGlobalObject* aGlobal,
|
||||
workers::WorkerPrivate* aWorkerPrivate);
|
||||
WorkerPrivate* aWorkerPrivate);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
@ -115,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
// WorkerHolder
|
||||
bool Notify(workers::Status) override;
|
||||
bool Notify(WorkerStatus) override;
|
||||
|
||||
private:
|
||||
virtual ~FileReader();
|
||||
@ -201,7 +198,7 @@ private:
|
||||
uint64_t mBusyCount;
|
||||
|
||||
// Kept alive with a WorkerHolder.
|
||||
workers::WorkerPrivate* mWorkerPrivate;
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
@ -26,14 +26,11 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
|
||||
#include "RuntimeService.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::workers;
|
||||
using mozilla::dom::Optional;
|
||||
using mozilla::dom::GlobalObject;
|
||||
|
||||
@ -444,7 +441,7 @@ FileReaderSync::SyncRead(nsIInputStream* aStream, char* aBuffer,
|
||||
return rv;
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
AutoSyncLoopHolder syncLoop(workerPrivate, Closing);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef mozilla_dom_filereadersync_h__
|
||||
#define mozilla_dom_filereadersync_h__
|
||||
|
||||
#include "WorkerCommon.h"
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
|
||||
class nsIInputStream;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "MemoryBlobImpl.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/ipc/TemporaryIPCBlobChild.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -16,7 +17,6 @@
|
||||
#include "nsAnonymousTemporaryFile.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#define BLOB_MEMORY_TEMPORARY_FILE 1048576
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include "IPCBlobInputStreamThread.h"
|
||||
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "WorkerHolder.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -99,7 +99,7 @@ public:
|
||||
: WorkerHolder("IPCBlobInputStreamWorkerHolder")
|
||||
{}
|
||||
|
||||
bool Notify(Status aStatus) override
|
||||
bool Notify(WorkerStatus aStatus) override
|
||||
{
|
||||
// We must keep the worker alive until the migration is completed.
|
||||
return true;
|
||||
@ -109,8 +109,7 @@ public:
|
||||
class ReleaseWorkerHolderRunnable final : public CancelableRunnable
|
||||
{
|
||||
public:
|
||||
explicit ReleaseWorkerHolderRunnable(
|
||||
UniquePtr<workers::WorkerHolder>&& aWorkerHolder)
|
||||
explicit ReleaseWorkerHolderRunnable(UniquePtr<WorkerHolder>&& aWorkerHolder)
|
||||
: CancelableRunnable("dom::ReleaseWorkerHolderRunnable")
|
||||
, mWorkerHolder(Move(aWorkerHolder))
|
||||
{}
|
||||
@ -129,7 +128,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
UniquePtr<WorkerHolder> mWorkerHolder;
|
||||
};
|
||||
|
||||
} // anonymous
|
||||
|
@ -16,11 +16,8 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace workers {
|
||||
class WorkerHolder;
|
||||
}
|
||||
|
||||
class IPCBlobInputStream;
|
||||
class WorkerHolder;
|
||||
|
||||
class IPCBlobInputStreamChild final
|
||||
: public mozilla::ipc::PIPCBlobInputStreamChild
|
||||
@ -110,7 +107,7 @@ private:
|
||||
|
||||
nsCOMPtr<nsISerialEventTarget> mOwningEventTarget;
|
||||
|
||||
UniquePtr<workers::WorkerHolder> mWorkerHolder;
|
||||
UniquePtr<WorkerHolder> mWorkerHolder;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -43,7 +43,6 @@ IPDL_SOURCES += [
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/file',
|
||||
'/dom/ipc',
|
||||
'/dom/workers',
|
||||
'/xpcom/build',
|
||||
]
|
||||
|
||||
|
@ -64,7 +64,6 @@ UNIFIED_SOURCES += [
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/file/ipc',
|
||||
'/dom/workers',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "GetDirectoryListingTask.h"
|
||||
#include "GetFilesTask.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsString.h"
|
||||
@ -16,6 +15,7 @@
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/OSFileSystem.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -47,5 +47,4 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
'/dom/workers',
|
||||
]
|
||||
|
@ -720,6 +720,14 @@ public:
|
||||
mCaptureStream->StopCapture();
|
||||
}
|
||||
|
||||
void Disable() override
|
||||
{
|
||||
}
|
||||
|
||||
void Enable() override
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~CanvasCaptureTrackSource() {}
|
||||
|
||||
|
@ -3248,6 +3248,22 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not keep the track source on. It is controlled by its associated tracks.
|
||||
*/
|
||||
bool Enabled() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Disable() override
|
||||
{
|
||||
}
|
||||
|
||||
void Enable() override
|
||||
{
|
||||
}
|
||||
|
||||
void PrincipalChanged() override
|
||||
{
|
||||
if (!mCapturedTrackSource) {
|
||||
@ -3341,6 +3357,14 @@ public:
|
||||
// based on MediaStreams during capture.
|
||||
}
|
||||
|
||||
void Disable() override
|
||||
{
|
||||
}
|
||||
|
||||
void Enable() override
|
||||
{
|
||||
}
|
||||
|
||||
void NotifyDecoderPrincipalChanged() override
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> newPrincipal = mElement->GetCurrentPrincipal();
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
|
||||
#include "mozilla/dom/IPCBlobUtils.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
@ -48,8 +50,6 @@
|
||||
#include "PermissionRequestBase.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "IndexedDatabaseManager.h"
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
@ -52,8 +54,6 @@
|
||||
#include "nsStringStream.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerScope.h"
|
||||
|
||||
// Include this last to avoid path problems on Windows.
|
||||
#include "ActorsChild.h"
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "mozilla/dom/ErrorEventBinding.h"
|
||||
#include "mozilla/dom/IDBOpenDBRequestBinding.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptContext.h"
|
||||
@ -30,8 +32,6 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsString.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerHolder.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
// Include this last to avoid path problems on Windows.
|
||||
#include "ActorsChild.h"
|
||||
@ -416,7 +416,7 @@ IDBRequest::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
class IDBOpenDBRequest::WorkerHolder final
|
||||
: public mozilla::dom::workers::WorkerHolder
|
||||
: public mozilla::dom::WorkerHolder
|
||||
{
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
#ifdef DEBUG
|
||||
@ -428,7 +428,7 @@ class IDBOpenDBRequest::WorkerHolder final
|
||||
public:
|
||||
explicit
|
||||
WorkerHolder(WorkerPrivate* aWorkerPrivate)
|
||||
: mozilla::dom::workers::WorkerHolder("IDBOpenDBRequest::WorkerHolder")
|
||||
: mozilla::dom::WorkerHolder("IDBOpenDBRequest::WorkerHolder")
|
||||
, mWorkerPrivate(aWorkerPrivate)
|
||||
#ifdef DEBUG
|
||||
, mWorkerPrivateDEBUG(aWorkerPrivate)
|
||||
@ -460,7 +460,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
Notify(Status aStatus) override;
|
||||
Notify(WorkerStatus aStatus) override;
|
||||
};
|
||||
|
||||
IDBOpenDBRequest::IDBOpenDBRequest(IDBFactory* aFactory,
|
||||
@ -664,7 +664,7 @@ IDBOpenDBRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
bool
|
||||
IDBOpenDBRequest::
|
||||
WorkerHolder::Notify(Status aStatus)
|
||||
WorkerHolder::Notify(WorkerStatus aStatus)
|
||||
{
|
||||
MOZ_ASSERT(mWorkerPrivate);
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "mozilla/dom/WorkerHolder.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -23,8 +25,6 @@
|
||||
#include "nsTHashtable.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "WorkerHolder.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
// Include this last to avoid path problems on Windows.
|
||||
#include "ActorsChild.h"
|
||||
@ -36,8 +36,7 @@ using namespace mozilla::dom::indexedDB;
|
||||
using namespace mozilla::dom::workers;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
class IDBTransaction::WorkerHolder final
|
||||
: public mozilla::dom::workers::WorkerHolder
|
||||
class IDBTransaction::WorkerHolder final : public mozilla::dom::WorkerHolder
|
||||
{
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
||||
@ -47,7 +46,7 @@ class IDBTransaction::WorkerHolder final
|
||||
|
||||
public:
|
||||
WorkerHolder(WorkerPrivate* aWorkerPrivate, IDBTransaction* aTransaction)
|
||||
: mozilla::dom::workers::WorkerHolder("IDBTransaction::WorkerHolder")
|
||||
: mozilla::dom::WorkerHolder("IDBTransaction::WorkerHolder")
|
||||
, mWorkerPrivate(aWorkerPrivate)
|
||||
, mTransaction(aTransaction)
|
||||
{
|
||||
@ -68,7 +67,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
Notify(Status aStatus) override;
|
||||
Notify(WorkerStatus aStatus) override;
|
||||
};
|
||||
|
||||
IDBTransaction::IDBTransaction(IDBDatabase* aDatabase,
|
||||
@ -1078,7 +1077,7 @@ IDBTransaction::Run()
|
||||
|
||||
bool
|
||||
IDBTransaction::
|
||||
WorkerHolder::Notify(Status aStatus)
|
||||
WorkerHolder::Notify(WorkerStatus aStatus)
|
||||
{
|
||||
MOZ_ASSERT(mWorkerPrivate);
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "mozilla/dom/ErrorEventBinding.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
@ -43,8 +45,6 @@
|
||||
#include "IDBRequest.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ScriptErrorHelper.h"
|
||||
#include "WorkerScope.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "unicode/locid.h"
|
||||
|
||||
|
@ -105,7 +105,6 @@ LOCAL_INCLUDES += [
|
||||
'/db/sqlite3/src',
|
||||
'/dom/base',
|
||||
'/dom/storage',
|
||||
'/dom/workers',
|
||||
'/ipc/glue',
|
||||
'/xpcom/build',
|
||||
'/xpcom/threads',
|
||||
|
@ -130,7 +130,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/geolocation',
|
||||
'/dom/media/webspeech/synth/ipc',
|
||||
'/dom/security',
|
||||
'/dom/workers',
|
||||
'/extensions/cookie',
|
||||
'/extensions/spellcheck/src',
|
||||
'/gfx/2d',
|
||||
|
@ -2,8 +2,9 @@
|
||||
* 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/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "GetUserMediaRequest.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "mozilla/dom/MediaStreamBinding.h"
|
||||
#include "mozilla/dom/GetUserMediaRequestBinding.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
void GetConstraints(MediaStreamConstraints &result);
|
||||
|
||||
private:
|
||||
virtual ~GetUserMediaRequest() {}
|
||||
virtual ~GetUserMediaRequest() = default;
|
||||
|
||||
uint64_t mInnerWindowID, mOuterWindowID;
|
||||
const nsString mCallID;
|
||||
|
@ -884,8 +884,6 @@ long
|
||||
AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||
AudioDataValue* aOutputBuffer, long aFrames)
|
||||
{
|
||||
bool stillProcessing;
|
||||
|
||||
// Don't add the callback until we're inited and ready
|
||||
if (!mAddedMixer) {
|
||||
mGraphImpl->mMixer.AddCallback(this);
|
||||
@ -924,6 +922,49 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||
mIterationDurationMS /= 4;
|
||||
}
|
||||
|
||||
mBuffer.SetBuffer(aOutputBuffer, aFrames);
|
||||
// fill part or all with leftover data from last iteration (since we
|
||||
// align to Audio blocks)
|
||||
mScratchBuffer.Empty(mBuffer);
|
||||
|
||||
// State computed time is decided by the audio callback's buffer length. We
|
||||
// compute the iteration start and end from there, trying to keep the amount
|
||||
// of buffering in the graph constant.
|
||||
GraphTime nextStateComputedTime =
|
||||
mGraphImpl->RoundUpToNextAudioBlock(stateComputedTime + mBuffer.Available());
|
||||
|
||||
mIterationStart = mIterationEnd;
|
||||
// inGraph is the number of audio frames there is between the state time and
|
||||
// the current time, i.e. the maximum theoretical length of the interval we
|
||||
// could use as [mIterationStart; mIterationEnd].
|
||||
GraphTime inGraph = stateComputedTime - mIterationStart;
|
||||
// We want the interval [mIterationStart; mIterationEnd] to be before the
|
||||
// interval [stateComputedTime; nextStateComputedTime]. We also want
|
||||
// the distance between these intervals to be roughly equivalent each time, to
|
||||
// ensure there is no clock drift between current time and state time. Since
|
||||
// we can't act on the state time because we have to fill the audio buffer, we
|
||||
// reclock the current time against the state time, here.
|
||||
mIterationEnd = mIterationStart + 0.8 * inGraph;
|
||||
|
||||
LOG(LogLevel::Verbose,
|
||||
("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) "
|
||||
"(duration ticks: %ld)",
|
||||
(long)mIterationStart,
|
||||
(long)mIterationEnd,
|
||||
(long)stateComputedTime,
|
||||
(long)nextStateComputedTime,
|
||||
(long)aFrames,
|
||||
(uint32_t)durationMS,
|
||||
(long)(nextStateComputedTime - stateComputedTime)));
|
||||
|
||||
mCurrentTimeStamp = TimeStamp::Now();
|
||||
|
||||
if (stateComputedTime < mIterationEnd) {
|
||||
LOG(LogLevel::Error, ("Media graph global underrun detected"));
|
||||
MOZ_ASSERT_UNREACHABLE("We should not underrun in full duplex");
|
||||
mIterationEnd = stateComputedTime;
|
||||
}
|
||||
|
||||
// Process mic data if any/needed
|
||||
if (aInputBuffer) {
|
||||
if (mAudioInput) { // for this specific input-only or full-duplex stream
|
||||
@ -933,51 +974,10 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
mBuffer.SetBuffer(aOutputBuffer, aFrames);
|
||||
// fill part or all with leftover data from last iteration (since we
|
||||
// align to Audio blocks)
|
||||
mScratchBuffer.Empty(mBuffer);
|
||||
// if we totally filled the buffer (and mScratchBuffer isn't empty),
|
||||
// we don't need to run an iteration and if we do so we may overflow.
|
||||
bool stillProcessing;
|
||||
if (mBuffer.Available()) {
|
||||
|
||||
// State computed time is decided by the audio callback's buffer length. We
|
||||
// compute the iteration start and end from there, trying to keep the amount
|
||||
// of buffering in the graph constant.
|
||||
GraphTime nextStateComputedTime =
|
||||
mGraphImpl->RoundUpToNextAudioBlock(stateComputedTime + mBuffer.Available());
|
||||
|
||||
mIterationStart = mIterationEnd;
|
||||
// inGraph is the number of audio frames there is between the state time and
|
||||
// the current time, i.e. the maximum theoretical length of the interval we
|
||||
// could use as [mIterationStart; mIterationEnd].
|
||||
GraphTime inGraph = stateComputedTime - mIterationStart;
|
||||
// We want the interval [mIterationStart; mIterationEnd] to be before the
|
||||
// interval [stateComputedTime; nextStateComputedTime]. We also want
|
||||
// the distance between these intervals to be roughly equivalent each time, to
|
||||
// ensure there is no clock drift between current time and state time. Since
|
||||
// we can't act on the state time because we have to fill the audio buffer, we
|
||||
// reclock the current time against the state time, here.
|
||||
mIterationEnd = mIterationStart + 0.8 * inGraph;
|
||||
|
||||
LOG(LogLevel::Verbose,
|
||||
("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) "
|
||||
"(duration ticks: %ld)",
|
||||
(long)mIterationStart,
|
||||
(long)mIterationEnd,
|
||||
(long)stateComputedTime,
|
||||
(long)nextStateComputedTime,
|
||||
(long)aFrames,
|
||||
(uint32_t)durationMS,
|
||||
(long)(nextStateComputedTime - stateComputedTime)));
|
||||
|
||||
mCurrentTimeStamp = TimeStamp::Now();
|
||||
|
||||
if (stateComputedTime < mIterationEnd) {
|
||||
LOG(LogLevel::Warning, ("Media graph global underrun detected"));
|
||||
mIterationEnd = stateComputedTime;
|
||||
}
|
||||
|
||||
// We totally filled the buffer (and mScratchBuffer isn't empty).
|
||||
// We don't need to run an iteration and if we do so we may overflow.
|
||||
stillProcessing = mGraphImpl->OneIteration(nextStateComputedTime);
|
||||
} else {
|
||||
LOG(LogLevel::Verbose,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@
|
||||
#define MOZILLA_MEDIAMANAGER_H
|
||||
|
||||
#include "MediaEngine.h"
|
||||
#include "MediaEnginePrefs.h"
|
||||
#include "mozilla/media/DeviceChangeCallback.h"
|
||||
#include "mozilla/dom/GetUserMediaRequest.h"
|
||||
#include "mozilla/Services.h"
|
||||
@ -14,14 +15,12 @@
|
||||
#include "nsIMediaManager.h"
|
||||
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMNavigatorUserMedia.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -56,36 +55,53 @@ namespace ipc {
|
||||
class PrincipalInfo;
|
||||
}
|
||||
|
||||
class AllocationHandle;
|
||||
class GetUserMediaTask;
|
||||
class GetUserMediaWindowListener;
|
||||
class MediaManager;
|
||||
class SourceListener;
|
||||
|
||||
LogModule* GetMediaManagerLog();
|
||||
|
||||
class MediaDevice : public nsIMediaDevice
|
||||
{
|
||||
public:
|
||||
typedef MediaEngineSource Source;
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIMEDIADEVICE
|
||||
|
||||
void SetId(const nsAString& aID);
|
||||
void SetRawId(const nsAString& aID);
|
||||
virtual uint32_t GetBestFitnessDistance(
|
||||
explicit MediaDevice(MediaEngineSource* aSource,
|
||||
const nsString& aName,
|
||||
const nsString& aID,
|
||||
const nsString& aRawID = NS_LITERAL_STRING(""));
|
||||
|
||||
uint32_t GetBestFitnessDistance(
|
||||
const nsTArray<const NormalizedConstraintSet*>& aConstraintSets,
|
||||
bool aIsChrome);
|
||||
virtual Source* GetSource() = 0;
|
||||
nsresult Allocate(const dom::MediaTrackConstraints &aConstraints,
|
||||
const MediaEnginePrefs &aPrefs,
|
||||
|
||||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs,
|
||||
const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
|
||||
const char** aOutBadConstraint);
|
||||
nsresult Restart(const dom::MediaTrackConstraints &aConstraints,
|
||||
const MediaEnginePrefs &aPrefs,
|
||||
const char** aOutBadConstraint);
|
||||
nsresult SetTrack(const RefPtr<SourceMediaStream>& aStream,
|
||||
TrackID aTrackID,
|
||||
const PrincipalHandle& aPrincipal);
|
||||
nsresult Start();
|
||||
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs,
|
||||
const char** aOutBadConstraint);
|
||||
nsresult Stop();
|
||||
nsresult Deallocate();
|
||||
|
||||
void Pull(const RefPtr<SourceMediaStream>& aStream,
|
||||
TrackID aTrackID,
|
||||
StreamTime aDesiredTime,
|
||||
const PrincipalHandle& aPrincipal);
|
||||
|
||||
void GetSettings(dom::MediaTrackSettings& aOutSettings) const;
|
||||
|
||||
dom::MediaSourceEnum GetMediaSource() const;
|
||||
protected:
|
||||
virtual ~MediaDevice() {}
|
||||
explicit MediaDevice(MediaEngineSource* aSource, bool aIsVideo);
|
||||
virtual ~MediaDevice() = default;
|
||||
|
||||
static uint32_t FitnessDistance(nsString aN,
|
||||
const dom::OwningStringOrStringSequenceOrConstrainDOMStringParameters& aConstraint);
|
||||
@ -94,91 +110,19 @@ private:
|
||||
nsString aN);
|
||||
static uint32_t FitnessDistance(nsString aN,
|
||||
const dom::ConstrainDOMStringParameters& aParams);
|
||||
protected:
|
||||
nsString mName;
|
||||
nsString mID;
|
||||
nsString mRawID;
|
||||
bool mScary;
|
||||
dom::MediaSourceEnum mMediaSource;
|
||||
RefPtr<MediaEngineSource> mSource;
|
||||
RefPtr<MediaEngineSource::AllocationHandle> mAllocationHandle;
|
||||
|
||||
// Assigned on allocation on media thread, then read on the media thread and
|
||||
// graph thread
|
||||
RefPtr<AllocationHandle> mAllocationHandle;
|
||||
|
||||
public:
|
||||
dom::MediaSourceEnum GetMediaSource() {
|
||||
return mMediaSource;
|
||||
}
|
||||
bool mIsVideo;
|
||||
};
|
||||
|
||||
class VideoDevice : public MediaDevice
|
||||
{
|
||||
public:
|
||||
typedef MediaEngineVideoSource Source;
|
||||
|
||||
explicit VideoDevice(Source* aSource);
|
||||
NS_IMETHOD GetType(nsAString& aType) override;
|
||||
Source* GetSource() override;
|
||||
};
|
||||
|
||||
class AudioDevice : public MediaDevice
|
||||
{
|
||||
public:
|
||||
typedef MediaEngineAudioSource Source;
|
||||
|
||||
explicit AudioDevice(Source* aSource);
|
||||
NS_IMETHOD GetType(nsAString& aType) override;
|
||||
Source* GetSource() override;
|
||||
};
|
||||
|
||||
class GetUserMediaNotificationEvent: public Runnable
|
||||
{
|
||||
public:
|
||||
enum GetUserMediaStatus {
|
||||
STARTING,
|
||||
STOPPING,
|
||||
};
|
||||
GetUserMediaNotificationEvent(GetUserMediaStatus aStatus,
|
||||
uint64_t aWindowID);
|
||||
|
||||
GetUserMediaNotificationEvent(GetUserMediaStatus aStatus,
|
||||
already_AddRefed<DOMMediaStream> aStream,
|
||||
already_AddRefed<media::Refcountable<UniquePtr<OnTracksAvailableCallback>>> aOnTracksAvailableCallback,
|
||||
uint64_t aWindowID,
|
||||
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError);
|
||||
virtual ~GetUserMediaNotificationEvent();
|
||||
|
||||
NS_IMETHOD Run() override;
|
||||
|
||||
protected:
|
||||
RefPtr<GetUserMediaWindowListener> mListener; // threadsafe
|
||||
RefPtr<DOMMediaStream> mStream;
|
||||
RefPtr<media::Refcountable<UniquePtr<OnTracksAvailableCallback>>> mOnTracksAvailableCallback;
|
||||
GetUserMediaStatus mStatus;
|
||||
uint64_t mWindowID;
|
||||
RefPtr<nsIDOMGetUserMediaErrorCallback> mOnFailure;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
MEDIA_STOP,
|
||||
MEDIA_STOP_TRACK,
|
||||
MEDIA_DIRECT_LISTENERS,
|
||||
} MediaOperation;
|
||||
|
||||
class ReleaseMediaOperationResource : public Runnable
|
||||
{
|
||||
public:
|
||||
ReleaseMediaOperationResource(
|
||||
already_AddRefed<DOMMediaStream> aStream,
|
||||
already_AddRefed<media::Refcountable<UniquePtr<OnTracksAvailableCallback>>>
|
||||
aOnTracksAvailableCallback)
|
||||
: Runnable("ReleaseMediaOperationResource")
|
||||
, mStream(aStream)
|
||||
, mOnTracksAvailableCallback(aOnTracksAvailableCallback)
|
||||
{
|
||||
}
|
||||
NS_IMETHOD Run() override {return NS_OK;}
|
||||
private:
|
||||
RefPtr<DOMMediaStream> mStream;
|
||||
RefPtr<media::Refcountable<UniquePtr<OnTracksAvailableCallback>>> mOnTracksAvailableCallback;
|
||||
const RefPtr<MediaEngineSource> mSource;
|
||||
const bool mIsVideo;
|
||||
const bool mScary;
|
||||
const nsString mType;
|
||||
const nsString mName;
|
||||
const nsString mID;
|
||||
const nsString mRawID;
|
||||
};
|
||||
|
||||
typedef nsRefPtrHashtable<nsUint64HashKey, GetUserMediaWindowListener> WindowTable;
|
||||
@ -213,8 +157,7 @@ public:
|
||||
return !!sSingleton;
|
||||
}
|
||||
|
||||
static nsresult NotifyRecordingStatusChange(nsPIDOMWindowInner* aWindow,
|
||||
const nsString& aMsg);
|
||||
static nsresult NotifyRecordingStatusChange(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
@ -981,6 +981,10 @@ private:
|
||||
mEncoder->ConnectMediaStreamTrack(track);
|
||||
}
|
||||
|
||||
// If user defines timeslice interval for video blobs we have to set
|
||||
// appropriate video keyframe interval defined in milliseconds.
|
||||
mEncoder->SetVideoKeyFrameInterval(mTimeSlice);
|
||||
|
||||
// Set mRunningState to Running so that ExtractRunnable/DestroyRunnable will
|
||||
// take the responsibility to end the session.
|
||||
mRunningState = RunningState::Starting;
|
||||
|
@ -1185,6 +1185,29 @@ MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
|
||||
}
|
||||
} else {
|
||||
stream->mStartBlocking = WillUnderrun(stream, aEndBlockingDecisions);
|
||||
|
||||
SourceMediaStream* s = stream->AsSourceStream();
|
||||
if (s && s->mPullEnabled) {
|
||||
for (StreamTracks::TrackIter i(s->mTracks); !i.IsEnded(); i.Next()) {
|
||||
if (i->IsEnded()) {
|
||||
continue;
|
||||
}
|
||||
if (i->GetEnd() < stream->GraphTimeToStreamTime(aEndBlockingDecisions)) {
|
||||
LOG(LogLevel::Error,
|
||||
("SourceMediaStream %p track %u (%s) is live and pulled, but wasn't fed "
|
||||
"enough data. Listeners=%zu. Track-end=%f, Iteration-end=%f",
|
||||
stream,
|
||||
i->GetID(),
|
||||
(i->GetType() == MediaSegment::AUDIO ? "audio" : "video"),
|
||||
stream->mListeners.Length(),
|
||||
MediaTimeToSeconds(i->GetEnd()),
|
||||
MediaTimeToSeconds(stream->GraphTimeToStreamTime(aEndBlockingDecisions))));
|
||||
MOZ_DIAGNOSTIC_ASSERT(false,
|
||||
"A non-finished SourceMediaStream wasn't fed "
|
||||
"enough data by NotifyPull");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1951,13 +1974,17 @@ MediaStream::FinishOnGraphThread()
|
||||
}
|
||||
LOG(LogLevel::Debug, ("MediaStream %p will finish", this));
|
||||
#ifdef DEBUG
|
||||
for (StreamTracks::TrackIter track(mTracks); !track.IsEnded(); track.Next()) {
|
||||
if (!track->IsEnded()) {
|
||||
LOG(LogLevel::Error,
|
||||
("MediaStream %p will finish, but track %d has not ended.",
|
||||
this,
|
||||
track->GetID()));
|
||||
NS_ASSERTION(false, "Finished stream cannot contain live track");
|
||||
if (!mGraph->mForceShutDown) {
|
||||
// All tracks must be ended by the source before the stream finishes.
|
||||
// The exception is in forced shutdown, where we finish all streams as is.
|
||||
for (StreamTracks::TrackIter track(mTracks); !track.IsEnded(); track.Next()) {
|
||||
if (!track->IsEnded()) {
|
||||
LOG(LogLevel::Error,
|
||||
("MediaStream %p will finish, but track %d has not ended.",
|
||||
this,
|
||||
track->GetID()));
|
||||
NS_ASSERTION(false, "Finished stream cannot contain live track");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -2707,11 +2734,22 @@ SourceMediaStream::DestroyImpl()
|
||||
void
|
||||
SourceMediaStream::SetPullEnabled(bool aEnabled)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mPullEnabled = aEnabled;
|
||||
if (mPullEnabled && GraphImpl()) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
class Message : public ControlMessage {
|
||||
public:
|
||||
Message(SourceMediaStream* aStream, bool aEnabled)
|
||||
: ControlMessage(nullptr)
|
||||
, mStream(aStream)
|
||||
, mEnabled(aEnabled)
|
||||
{}
|
||||
void Run() override
|
||||
{
|
||||
MutexAutoLock lock(mStream->mMutex);
|
||||
mStream->mPullEnabled = mEnabled;
|
||||
}
|
||||
SourceMediaStream* mStream;
|
||||
bool mEnabled;
|
||||
};
|
||||
GraphImpl()->AppendMessage(MakeUnique<Message>(this, aEnabled));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2735,17 +2773,6 @@ SourceMediaStream::PullNewData(
|
||||
if (t <= current) {
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (mListeners.Length() == 0) {
|
||||
LOG(
|
||||
LogLevel::Error,
|
||||
("No listeners in NotifyPull aStream=%p desired=%f current end=%f",
|
||||
this,
|
||||
GraphImpl()->MediaTimeToSeconds(t),
|
||||
GraphImpl()->MediaTimeToSeconds(current)));
|
||||
DumpTrackInfo();
|
||||
}
|
||||
#endif
|
||||
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
|
||||
MediaStreamListener* l = mListeners[j];
|
||||
{
|
||||
|
@ -676,7 +676,16 @@ public:
|
||||
|
||||
SourceMediaStream* AsSourceStream() override { return this; }
|
||||
|
||||
// Media graph thread only
|
||||
// Main thread only
|
||||
|
||||
/**
|
||||
* Enable or disable pulling. When pulling is enabled, NotifyPull
|
||||
* gets called on MediaStreamListeners for this stream during the
|
||||
* MediaStreamGraph control loop. Pulling is initially disabled.
|
||||
* Due to unavoidable race conditions, after a call to SetPullEnabled(false)
|
||||
* it is still possible for a NotifyPull to occur.
|
||||
*/
|
||||
void SetPullEnabled(bool aEnabled);
|
||||
|
||||
// Users of audio inputs go through the stream so it can track when the
|
||||
// last stream referencing an input goes away, so it can close the cubeb
|
||||
@ -687,18 +696,10 @@ public:
|
||||
// Note: also implied when Destroy() happens
|
||||
void CloseAudioInput();
|
||||
|
||||
// MediaStreamGraph thread only
|
||||
void DestroyImpl() override;
|
||||
|
||||
// Call these on any thread.
|
||||
/**
|
||||
* Enable or disable pulling. When pulling is enabled, NotifyPull
|
||||
* gets called on MediaStreamListeners for this stream during the
|
||||
* MediaStreamGraph control loop. Pulling is initially disabled.
|
||||
* Due to unavoidable race conditions, after a call to SetPullEnabled(false)
|
||||
* it is still possible for a NotifyPull to occur.
|
||||
*/
|
||||
void SetPullEnabled(bool aEnabled);
|
||||
|
||||
/**
|
||||
* Call all MediaStreamListeners to request new data via the NotifyPull API
|
||||
* (if enabled).
|
||||
|
@ -219,9 +219,14 @@ MediaStreamTrack::SetEnabled(bool aEnabled)
|
||||
LOG(LogLevel::Info, ("MediaStreamTrack %p %s",
|
||||
this, aEnabled ? "Enabled" : "Disabled"));
|
||||
|
||||
if (mEnabled == aEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mEnabled = aEnabled;
|
||||
GetOwnedStream()->SetTrackEnabled(mTrackID, mEnabled ? DisabledTrackMode::ENABLED
|
||||
: DisabledTrackMode::SILENCE_BLACK);
|
||||
GetSource().SinkEnabledStateChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/dom/MediaTrackSettingsBinding.h"
|
||||
#include "mozilla/media/MediaUtils.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsError.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIPrincipal.h"
|
||||
@ -74,6 +73,21 @@ public:
|
||||
*/
|
||||
virtual bool KeepsSourceAlive() const = 0;
|
||||
|
||||
/**
|
||||
* Return true to ensure that the MediaStreamTrackSource where this Sink is
|
||||
* registered is kept turned on and active.
|
||||
* Return false to allow the source to pause, and any underlying devices to
|
||||
* temporarily stop.
|
||||
*
|
||||
* When the underlying enabled state of the sink changes,
|
||||
* call MediaStreamTrackSource::SinkEnabledStateChanged().
|
||||
*
|
||||
* Typically MediaStreamTrack returns the track's enabled state and other
|
||||
* Sinks (like HTMLMediaElement::StreamCaptureTrackSource) return false so
|
||||
* control over device state remains with tracks and their enabled state.
|
||||
*/
|
||||
virtual bool Enabled() const = 0;
|
||||
|
||||
virtual void PrincipalChanged() = 0;
|
||||
virtual void MutedChanged(bool aNewState) = 0;
|
||||
};
|
||||
@ -156,6 +170,33 @@ public:
|
||||
*/
|
||||
virtual void Stop() = 0;
|
||||
|
||||
/**
|
||||
* Called by the source interface when all registered sinks with
|
||||
* KeepsSourceAlive() == true become disabled.
|
||||
*/
|
||||
virtual void Disable() = 0;
|
||||
|
||||
/**
|
||||
* Called by the source interface when at least one registered sink with
|
||||
* KeepsSourceAlive() == true become enabled.
|
||||
*/
|
||||
virtual void Enable() = 0;
|
||||
|
||||
/**
|
||||
* Called when a Sink's Enabled() state changed. Will iterate through all
|
||||
* sinks and notify the source of the aggregated enabled state.
|
||||
*
|
||||
* Note that a Sink with KeepsSourceAlive() == false counts as disabled.
|
||||
*/
|
||||
void SinkEnabledStateChanged()
|
||||
{
|
||||
if (IsEnabled()) {
|
||||
Enable();
|
||||
} else {
|
||||
Disable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by each MediaStreamTrack clone on initialization.
|
||||
*/
|
||||
@ -205,6 +246,16 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsEnabled()
|
||||
{
|
||||
for (const WeakPtr<Sink>& sink : mSinks) {
|
||||
if (sink && sink->KeepsSourceAlive() && sink->Enabled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a sub class when the principal has changed.
|
||||
* Notifies all sinks.
|
||||
@ -272,6 +323,8 @@ public:
|
||||
MediaSourceEnum GetMediaSource() const override { return mMediaSource; }
|
||||
|
||||
void Stop() override {}
|
||||
void Disable() override {}
|
||||
void Enable() override {}
|
||||
|
||||
protected:
|
||||
~BasicTrackSource() {}
|
||||
@ -342,7 +395,7 @@ public:
|
||||
virtual void GetKind(nsAString& aKind) = 0;
|
||||
void GetId(nsAString& aID) const;
|
||||
virtual void GetLabel(nsAString& aLabel, CallerType /* aCallerType */) { GetSource().GetLabel(aLabel); }
|
||||
bool Enabled() { return mEnabled; }
|
||||
bool Enabled() const override { return mEnabled; }
|
||||
void SetEnabled(bool aEnabled);
|
||||
bool Muted() { return mMuted; }
|
||||
void Stop();
|
||||
|
@ -57,12 +57,10 @@ MediaTimer::Destroy()
|
||||
MOZ_ASSERT(OnMediaTimerThread());
|
||||
TIMER_LOG("MediaTimer::Destroy");
|
||||
|
||||
// Reject any outstanding entries. There's no need to acquire the monitor
|
||||
// here, because we're on the timer thread and all other references to us
|
||||
// must be gone.
|
||||
while (!mEntries.empty()) {
|
||||
mEntries.top().mPromise->Reject(false, __func__);
|
||||
mEntries.pop();
|
||||
// Reject any outstanding entries.
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
Reject();
|
||||
}
|
||||
|
||||
// Cancel the timer if necessary.
|
||||
@ -79,6 +77,12 @@ MediaTimer::OnMediaTimerThread()
|
||||
return rv;
|
||||
}
|
||||
|
||||
RefPtr<MediaTimerPromise>
|
||||
MediaTimer::WaitFor(const TimeDuration& aDuration, const char* aCallSite)
|
||||
{
|
||||
return WaitUntil(TimeStamp::Now() + aDuration, aCallSite);
|
||||
}
|
||||
|
||||
RefPtr<MediaTimerPromise>
|
||||
MediaTimer::WaitUntil(const TimeStamp& aTimeStamp, const char* aCallSite)
|
||||
{
|
||||
@ -91,6 +95,14 @@ MediaTimer::WaitUntil(const TimeStamp& aTimeStamp, const char* aCallSite)
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
MediaTimer::Cancel()
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
TIMER_LOG("MediaTimer::Cancel");
|
||||
Reject();
|
||||
}
|
||||
|
||||
void
|
||||
MediaTimer::ScheduleUpdate()
|
||||
{
|
||||
@ -159,6 +171,16 @@ MediaTimer::UpdateLocked()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaTimer::Reject()
|
||||
{
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
while (!mEntries.empty()) {
|
||||
mEntries.top().mPromise->Reject(false, __func__);
|
||||
mEntries.pop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We use a callback function, rather than a callback method, to ensure that
|
||||
* the nsITimer does not artifically keep the refcount of the MediaTimer above
|
||||
|
@ -42,7 +42,9 @@ public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release(void);
|
||||
|
||||
RefPtr<MediaTimerPromise> WaitFor(const TimeDuration& aDuration, const char* aCallSite);
|
||||
RefPtr<MediaTimerPromise> WaitUntil(const TimeStamp& aTimeStamp, const char* aCallSite);
|
||||
void Cancel(); // Cancel and reject any unresolved promises with false.
|
||||
|
||||
private:
|
||||
virtual ~MediaTimer() { MOZ_ASSERT(OnMediaTimerThread()); }
|
||||
@ -55,6 +57,7 @@ private:
|
||||
void Update();
|
||||
void UpdateLocked();
|
||||
bool IsExpired(const TimeStamp& aTarget, const TimeStamp& aNow);
|
||||
void Reject();
|
||||
|
||||
static void TimerCallback(nsITimer* aTimer, void* aClosure);
|
||||
void TimerFired();
|
||||
|
@ -1132,4 +1132,22 @@ MediaEncoder::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
return size;
|
||||
}
|
||||
|
||||
void
|
||||
MediaEncoder::SetVideoKeyFrameInterval(int32_t aVideoKeyFrameInterval)
|
||||
{
|
||||
if (!mVideoEncoder) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mEncoderThread);
|
||||
nsresult rv =
|
||||
mEncoderThread->Dispatch(
|
||||
NewRunnableMethod<int32_t>(
|
||||
"mozilla::VideoTrackEncoder::SetKeyFrameInterval",
|
||||
mVideoEncoder, &VideoTrackEncoder::SetKeyFrameInterval,
|
||||
aVideoKeyFrameInterval));
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
|
||||
Unused << rv;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -224,6 +224,11 @@ public :
|
||||
*/
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
/**
|
||||
* Set desired video keyframe interval defined in milliseconds.
|
||||
*/
|
||||
void SetVideoKeyFrameInterval(int32_t aVideoKeyFrameInterval);
|
||||
|
||||
protected:
|
||||
~MediaEncoder();
|
||||
|
||||
|
@ -27,6 +27,9 @@ static const int DEFAULT_FRAME_HEIGHT = 480;
|
||||
static const int AUDIO_INIT_FAILED_DURATION = 1;
|
||||
// 30 second threshold if the video encoder cannot be initialized.
|
||||
static const int VIDEO_INIT_FAILED_DURATION = 30;
|
||||
// A maximal key frame interval allowed to set.
|
||||
// Longer values will be shorten to this value.
|
||||
static const int DEFAULT_KEYFRAME_INTERVAL_MS = 1000;
|
||||
|
||||
TrackEncoder::TrackEncoder(TrackRate aTrackRate)
|
||||
: mEncodingComplete(false)
|
||||
@ -404,6 +407,20 @@ AudioTrackEncoder::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
mOutgoingBuffer.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
VideoTrackEncoder::VideoTrackEncoder(TrackRate aTrackRate, FrameDroppingMode aFrameDroppingMode)
|
||||
: TrackEncoder(aTrackRate)
|
||||
, mFrameWidth(0)
|
||||
, mFrameHeight(0)
|
||||
, mDisplayWidth(0)
|
||||
, mDisplayHeight(0)
|
||||
, mEncodedTicks(0)
|
||||
, mVideoBitrate(0)
|
||||
, mFrameDroppingMode(aFrameDroppingMode)
|
||||
, mKeyFrameInterval(DEFAULT_KEYFRAME_INTERVAL_MS)
|
||||
{
|
||||
mLastChunk.mDuration = 0;
|
||||
}
|
||||
|
||||
void
|
||||
VideoTrackEncoder::Suspend(TimeStamp aTime)
|
||||
{
|
||||
@ -782,4 +799,11 @@ VideoTrackEncoder::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
mOutgoingBuffer.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
void
|
||||
VideoTrackEncoder::SetKeyFrameInterval(int32_t aKeyFrameInterval)
|
||||
{
|
||||
MOZ_ASSERT(!mWorkerThread || mWorkerThread->IsCurrentThreadIn());
|
||||
mKeyFrameInterval = std::min(aKeyFrameInterval, DEFAULT_KEYFRAME_INTERVAL_MS);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -393,18 +393,7 @@ enum class FrameDroppingMode {
|
||||
class VideoTrackEncoder : public TrackEncoder
|
||||
{
|
||||
public:
|
||||
VideoTrackEncoder(TrackRate aTrackRate, FrameDroppingMode aFrameDroppingMode)
|
||||
: TrackEncoder(aTrackRate)
|
||||
, mFrameWidth(0)
|
||||
, mFrameHeight(0)
|
||||
, mDisplayWidth(0)
|
||||
, mDisplayHeight(0)
|
||||
, mEncodedTicks(0)
|
||||
, mVideoBitrate(0)
|
||||
, mFrameDroppingMode(aFrameDroppingMode)
|
||||
{
|
||||
mLastChunk.mDuration = 0;
|
||||
}
|
||||
explicit VideoTrackEncoder(TrackRate aTrackRate, FrameDroppingMode aFrameDroppingMode);
|
||||
|
||||
/**
|
||||
* Suspends encoding from aTime, i.e., all video frame with a timestamp
|
||||
@ -485,6 +474,11 @@ public:
|
||||
*/
|
||||
void AdvanceCurrentTime(StreamTime aDuration) override;
|
||||
|
||||
/**
|
||||
* Set desired keyframe interval defined in milliseconds.
|
||||
*/
|
||||
void SetKeyFrameInterval(int32_t aKeyFrameInterval);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initialize the video encoder. In order to collect the value of width and
|
||||
@ -563,6 +557,11 @@ protected:
|
||||
* DISALLOW to encode all frames, mainly for testing.
|
||||
*/
|
||||
FrameDroppingMode mFrameDroppingMode;
|
||||
|
||||
/**
|
||||
* The desired keyframe interval defined in milliseconds.
|
||||
*/
|
||||
int32_t mKeyFrameInterval;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -26,6 +26,7 @@ LazyLogModule gVP8TrackEncoderLog("VP8TrackEncoder");
|
||||
(msg, ##__VA_ARGS__))
|
||||
|
||||
#define DEFAULT_BITRATE_BPS 2500000
|
||||
#define MAX_KEYFRAME_INTERVAL 600
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
@ -60,6 +61,7 @@ VP8TrackEncoder::VP8TrackEncoder(TrackRate aTrackRate,
|
||||
FrameDroppingMode aFrameDroppingMode)
|
||||
: VideoTrackEncoder(aTrackRate, aFrameDroppingMode)
|
||||
, mEncodedTimestamp(0)
|
||||
, mDurationSinceLastKeyframe(0)
|
||||
, mVPXContext(new vpx_codec_ctx_t())
|
||||
, mVPXImageWrapper(new vpx_image_t())
|
||||
{
|
||||
@ -208,9 +210,10 @@ VP8TrackEncoder::SetConfigurationValues(int32_t aWidth, int32_t aHeight, int32_t
|
||||
config.rc_buf_optimal_sz = 600;
|
||||
config.rc_buf_sz = 1000;
|
||||
|
||||
// we set key frame interval to automatic and later manually
|
||||
// force key frame by setting VPX_EFLAG_FORCE_KF when mKeyFrameInterval > 0
|
||||
config.kf_mode = VPX_KF_AUTO;
|
||||
// Ensure that we can output one I-frame per second.
|
||||
config.kf_max_dist = 60;
|
||||
config.kf_max_dist = MAX_KEYFRAME_INTERVAL;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -649,6 +652,18 @@ VP8TrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData)
|
||||
VP8LOG(LogLevel::Warning, "MediaRecorder lagging behind. Encoding keyframe.");
|
||||
flags |= VPX_EFLAG_FORCE_KF;
|
||||
}
|
||||
|
||||
// Sum duration of non-key frames and force keyframe if exceeded the given keyframe interval
|
||||
if (mKeyFrameInterval > 0)
|
||||
{
|
||||
if ((mDurationSinceLastKeyframe * 1000 / mTrackRate) >= mKeyFrameInterval)
|
||||
{
|
||||
mDurationSinceLastKeyframe = 0;
|
||||
flags |= VPX_EFLAG_FORCE_KF;
|
||||
}
|
||||
mDurationSinceLastKeyframe += chunk.GetDuration();
|
||||
}
|
||||
|
||||
if (vpx_codec_encode(mVPXContext, mVPXImageWrapper, mEncodedTimestamp,
|
||||
(unsigned long)chunk.GetDuration(), flags,
|
||||
VPX_DL_REALTIME)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user