2013-09-16 10:34:57 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "GetUserMediaRequest.h"
|
Bug 1299515 - Flatten MediaEngineSource class hierarchy. r=jib
The scope of flattening this hierarchy quickly grows large, so this patch does
a couple more things:
- Creates a pure interface MediaEngineSourceInterface and a base class
MediaEngineSource with common defaults and refcount support (no state!)
- Breaks out some of the helper classes to dedicated files, e.g.,
AllocationHandle, MediaEnginePrefs.
- Clarifies the threading model (written on one thread *and* under lock,
read under either)
- Fixes style, indentation, include-sorting in the affected files
- Adds comments, especially for clarifying what responsibilities methods have,
and thread usage of class members
- Changes Monitors to Mutexes since we only use them as Mutexes anyhow
- Makes MediaEngineRemoteVideoSource no longer a shared source since we now
support scaling in this source and CamerasChild can act as a broker of frames.
This greatly simplifies it. The only shared source is now
MediaEngineWebRTCMicrophoneSource, so the sharing specific common methods have
been moved to that source.
MozReview-Commit-ID: KeVZQo6gLm2
--HG--
rename : dom/media/webrtc/MediaEngine.h => dom/media/webrtc/MediaEnginePrefs.h
extra : rebase_source : c785a5feb896312912170475d6b8d997e712e48f
2018-01-24 18:49:13 +03:00
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
2014-04-04 13:54:25 +04:00
|
|
|
#include "mozilla/dom/MediaStreamBinding.h"
|
2013-09-16 10:34:57 +04:00
|
|
|
#include "mozilla/dom/GetUserMediaRequestBinding.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
GetUserMediaRequest::GetUserMediaRequest(
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* aInnerWindow, const nsAString& aCallID,
|
2014-04-18 22:00:16 +04:00
|
|
|
const MediaStreamConstraints& aConstraints, bool aIsSecure,
|
2018-01-11 01:59:55 +03:00
|
|
|
bool aIsHandlingUserInput)
|
2014-02-14 23:32:58 +04:00
|
|
|
: mInnerWindowID(aInnerWindow->WindowID()),
|
|
|
|
mOuterWindowID(aInnerWindow->GetOuterWindow()->WindowID()),
|
2013-09-16 10:34:57 +04:00
|
|
|
mCallID(aCallID),
|
2014-04-18 22:00:16 +04:00
|
|
|
mConstraints(new MediaStreamConstraints(aConstraints)),
|
2014-04-16 10:22:19 +04:00
|
|
|
mIsSecure(aIsSecure),
|
2018-01-11 01:59:55 +03:00
|
|
|
mIsHandlingUserInput(aIsHandlingUserInput) {}
|
2018-11-19 16:25:37 +03:00
|
|
|
|
2018-04-13 16:01:28 +03:00
|
|
|
GetUserMediaRequest::GetUserMediaRequest(nsPIDOMWindowInner* aInnerWindow,
|
|
|
|
const nsAString& aRawId,
|
2019-02-05 21:40:21 +03:00
|
|
|
const nsAString& aMediaSource,
|
|
|
|
bool aIsHandlingUserInput)
|
2018-06-15 10:25:02 +03:00
|
|
|
: mInnerWindowID(0),
|
|
|
|
mOuterWindowID(0),
|
|
|
|
mRawID(aRawId),
|
2017-01-19 07:24:59 +03:00
|
|
|
mMediaSource(aMediaSource),
|
2018-06-15 10:25:02 +03:00
|
|
|
mIsSecure(false),
|
2019-02-05 21:40:21 +03:00
|
|
|
mIsHandlingUserInput(aIsHandlingUserInput) {
|
2017-01-19 07:24:59 +03:00
|
|
|
if (aInnerWindow && aInnerWindow->GetOuterWindow()) {
|
|
|
|
mOuterWindowID = aInnerWindow->GetOuterWindow()->WindowID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-14 23:32:58 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(GetUserMediaRequest)
|
2013-09-16 10:34:57 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(GetUserMediaRequest)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(GetUserMediaRequest)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GetUserMediaRequest)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
JSObject* GetUserMediaRequest::WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return GetUserMediaRequest_Binding::Wrap(aCx, this, aGivenProto);
|
2013-09-16 10:34:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsISupports* GetUserMediaRequest::GetParentObject() { return nullptr; }
|
|
|
|
|
|
|
|
void GetUserMediaRequest::GetCallID(nsString& retval) { retval = mCallID; }
|
|
|
|
|
2017-01-19 07:24:59 +03:00
|
|
|
void GetUserMediaRequest::GetRawID(nsString& retval) { retval = mRawID; }
|
|
|
|
|
|
|
|
void GetUserMediaRequest::GetMediaSource(nsString& retval) {
|
|
|
|
retval = mMediaSource;
|
|
|
|
}
|
|
|
|
|
2013-09-16 10:34:57 +04:00
|
|
|
uint64_t GetUserMediaRequest::WindowID() { return mOuterWindowID; }
|
2014-02-14 23:32:58 +04:00
|
|
|
|
|
|
|
uint64_t GetUserMediaRequest::InnerWindowID() { return mInnerWindowID; }
|
2013-09-16 10:34:57 +04:00
|
|
|
|
2014-04-16 10:22:19 +04:00
|
|
|
bool GetUserMediaRequest::IsSecure() { return mIsSecure; }
|
|
|
|
|
2018-01-11 01:59:55 +03:00
|
|
|
bool GetUserMediaRequest::IsHandlingUserInput() const {
|
|
|
|
return mIsHandlingUserInput;
|
|
|
|
}
|
|
|
|
|
2014-04-18 22:00:16 +04:00
|
|
|
void GetUserMediaRequest::GetConstraints(MediaStreamConstraints& result) {
|
2014-04-04 13:54:25 +04:00
|
|
|
result = *mConstraints;
|
2013-09-16 10:34:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|