Bug 1181896 - rename .constraintName to .constraint in MediaStreamError r=jesup,bz

This commit is contained in:
Jan-Ivar Bruaroey 2015-09-18 14:03:30 -04:00
parent 9a7eae6660
commit 1fedf527e6
5 changed files with 24 additions and 21 deletions

View File

@ -953,7 +953,7 @@ GetSources(MediaEngine *engine, dom::MediaSourceEnum aSrcType,
template<class DeviceType> template<class DeviceType>
static void static void
ApplyConstraints(const MediaTrackConstraints &aConstraints, SelectSettings(const MediaTrackConstraints &aConstraints,
nsTArray<nsRefPtr<DeviceType>>& aSources) nsTArray<nsRefPtr<DeviceType>>& aSources)
{ {
auto& c = aConstraints; auto& c = aConstraints;
@ -1009,7 +1009,7 @@ ApplyConstraints(const MediaTrackConstraints &aConstraints,
} }
static bool static bool
ApplyConstraints(MediaStreamConstraints &aConstraints, SelectSettings(MediaStreamConstraints &aConstraints,
nsTArray<nsRefPtr<MediaDevice>>& aSources) nsTArray<nsRefPtr<MediaDevice>>& aSources)
{ {
// Since the advanced part of the constraints algorithm needs to know when // Since the advanced part of the constraints algorithm needs to know when
@ -1033,7 +1033,7 @@ ApplyConstraints(MediaStreamConstraints &aConstraints,
MOZ_ASSERT(!aSources.Length()); MOZ_ASSERT(!aSources.Length());
if (IsOn(aConstraints.mVideo)) { if (IsOn(aConstraints.mVideo)) {
ApplyConstraints(GetInvariant(aConstraints.mVideo), videos); SelectSettings(GetInvariant(aConstraints.mVideo), videos);
if (!videos.Length()) { if (!videos.Length()) {
overconstrained = true; overconstrained = true;
} }
@ -1042,7 +1042,7 @@ ApplyConstraints(MediaStreamConstraints &aConstraints,
} }
} }
if (IsOn(aConstraints.mAudio)) { if (IsOn(aConstraints.mAudio)) {
ApplyConstraints(GetInvariant(aConstraints.mAudio), audios); SelectSettings(GetInvariant(aConstraints.mAudio), audios);
if (!audios.Length()) { if (!audios.Length()) {
overconstrained = true; overconstrained = true;
} }
@ -1906,7 +1906,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow,
// Apply any constraints. This modifies the list. // Apply any constraints. This modifies the list.
if (!ApplyConstraints(c, *devices)) { if (!SelectSettings(c, *devices)) {
nsRefPtr<MediaStreamError> error = nsRefPtr<MediaStreamError> error =
new MediaStreamError(window, NS_LITERAL_STRING("NotFoundError")); new MediaStreamError(window, NS_LITERAL_STRING("NotFoundError"));
onFailure->OnError(error); onFailure->OnError(error);

View File

@ -12,10 +12,10 @@ namespace mozilla {
BaseMediaMgrError::BaseMediaMgrError(const nsAString& aName, BaseMediaMgrError::BaseMediaMgrError(const nsAString& aName,
const nsAString& aMessage, const nsAString& aMessage,
const nsAString& aConstraintName) const nsAString& aConstraint)
: mName(aName) : mName(aName)
, mMessage(aMessage) , mMessage(aMessage)
, mConstraintName(aConstraintName) , mConstraint(aConstraint)
{ {
if (mMessage.IsEmpty()) { if (mMessage.IsEmpty()) {
if (mName.EqualsLiteral("NotFoundError")) { if (mName.EqualsLiteral("NotFoundError")) {
@ -43,8 +43,8 @@ MediaStreamError::MediaStreamError(
nsPIDOMWindow* aParent, nsPIDOMWindow* aParent,
const nsAString& aName, const nsAString& aName,
const nsAString& aMessage, const nsAString& aMessage,
const nsAString& aConstraintName) const nsAString& aConstraint)
: BaseMediaMgrError(aName, aMessage, aConstraintName) : BaseMediaMgrError(aName, aMessage, aConstraint)
, mParent(aParent) {} , mParent(aParent) {}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaStreamError, mParent) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaStreamError, mParent)
@ -75,9 +75,9 @@ MediaStreamError::GetMessage(nsAString& aMessage) const
} }
void void
MediaStreamError::GetConstraintName(nsAString& aConstraintName) const MediaStreamError::GetConstraint(nsAString& aConstraint) const
{ {
aConstraintName = mConstraintName; aConstraint = mConstraint;
} }
} // namespace dom } // namespace dom

View File

@ -34,10 +34,10 @@ class BaseMediaMgrError
protected: protected:
BaseMediaMgrError(const nsAString& aName, BaseMediaMgrError(const nsAString& aName,
const nsAString& aMessage, const nsAString& aMessage,
const nsAString& aConstraintName); const nsAString& aConstraint);
const nsString mName; const nsString mName;
nsString mMessage; nsString mMessage;
const nsString mConstraintName; const nsString mConstraint;
}; };
class MediaMgrError final : public nsISupports, class MediaMgrError final : public nsISupports,
@ -46,8 +46,8 @@ class MediaMgrError final : public nsISupports,
public: public:
explicit MediaMgrError(const nsAString& aName, explicit MediaMgrError(const nsAString& aName,
const nsAString& aMessage = EmptyString(), const nsAString& aMessage = EmptyString(),
const nsAString& aConstraintName = EmptyString()) const nsAString& aConstraint = EmptyString())
: BaseMediaMgrError(aName, aMessage, aConstraintName) {} : BaseMediaMgrError(aName, aMessage, aConstraint) {}
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
@ -64,11 +64,11 @@ public:
MediaStreamError(nsPIDOMWindow* aParent, MediaStreamError(nsPIDOMWindow* aParent,
const nsAString& aName, const nsAString& aName,
const nsAString& aMessage = EmptyString(), const nsAString& aMessage = EmptyString(),
const nsAString& aConstraintName = EmptyString()); const nsAString& aConstraint = EmptyString());
MediaStreamError(nsPIDOMWindow* aParent, MediaStreamError(nsPIDOMWindow* aParent,
const BaseMediaMgrError& aOther) const BaseMediaMgrError& aOther)
: BaseMediaMgrError(aOther.mName, aOther.mMessage, aOther.mConstraintName) : BaseMediaMgrError(aOther.mName, aOther.mMessage, aOther.mConstraint)
, mParent(aParent) {} , mParent(aParent) {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -83,7 +83,7 @@ public:
} }
void GetName(nsAString& aName) const; void GetName(nsAString& aName) const;
void GetMessage(nsAString& aMessage) const; void GetMessage(nsAString& aMessage) const;
void GetConstraintName(nsAString& aConstraintName) const; void GetConstraint(nsAString& aConstraint) const;
private: private:
virtual ~MediaStreamError() {} virtual ~MediaStreamError() {}

View File

@ -17,5 +17,5 @@
interface MediaStreamError { interface MediaStreamError {
readonly attribute DOMString name; readonly attribute DOMString name;
readonly attribute DOMString? message; readonly attribute DOMString? message;
readonly attribute DOMString? constraintName; readonly attribute DOMString? constraint;
}; };

View File

@ -37,6 +37,9 @@ typedef (double or ConstrainDoubleRange) ConstrainDouble;
typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean;
typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString;
// Note: When adding new constraints, remember to update the SelectSettings()
// function in MediaManager.cpp to make OverconstrainedError's constraint work!
dictionary MediaTrackConstraintSet { dictionary MediaTrackConstraintSet {
ConstrainLong width; ConstrainLong width;
ConstrainLong height; ConstrainLong height;