зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1335368 part 15. Remove the use of IsCallerChrome in ApplyConstraints. r=jib
This commit is contained in:
Родитель
69e66238f4
Коммит
387da61c81
|
@ -38,6 +38,7 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Types.h"
|
||||
#include "mozilla/PeerIdentity.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MediaStreamBinding.h"
|
||||
|
@ -239,7 +240,8 @@ public:
|
|||
already_AddRefed<PledgeVoid>
|
||||
ApplyConstraintsToTrack(nsPIDOMWindowInner* aWindow,
|
||||
TrackID aID,
|
||||
const dom::MediaTrackConstraints& aConstraints);
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType);
|
||||
|
||||
// mVideo/AudioDevice are set by Activate(), so we assume they're capturing
|
||||
// if set and represent a real capture device.
|
||||
|
@ -1112,7 +1114,8 @@ public:
|
|||
|
||||
already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const MediaTrackConstraints& aConstraints) override
|
||||
const MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType) override
|
||||
{
|
||||
if (sInShutdown || !mListener) {
|
||||
// Track has been stopped, or we are in shutdown. In either case
|
||||
|
@ -1121,7 +1124,8 @@ public:
|
|||
p->Resolve(false);
|
||||
return p.forget();
|
||||
}
|
||||
return mListener->ApplyConstraintsToTrack(aWindow, mTrackID, aConstraints);
|
||||
return mListener->ApplyConstraintsToTrack(aWindow, mTrackID,
|
||||
aConstraints, aCallerType);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3466,7 +3470,8 @@ auto
|
|||
GetUserMediaCallbackMediaStreamListener::ApplyConstraintsToTrack(
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
TrackID aTrackID,
|
||||
const MediaTrackConstraints& aConstraints) -> already_AddRefed<PledgeVoid>
|
||||
const MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType) -> already_AddRefed<PledgeVoid>
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
|
@ -3489,7 +3494,7 @@ GetUserMediaCallbackMediaStreamListener::ApplyConstraintsToTrack(
|
|||
RefPtr<MediaManager> mgr = MediaManager::GetInstance();
|
||||
uint32_t id = mgr->mOutstandingVoidPledges.Append(*p);
|
||||
uint64_t windowId = aWindow->WindowID();
|
||||
bool isChrome = nsContentUtils::IsCallerChrome();
|
||||
bool isChrome = (aCallerType == dom::CallerType::System);
|
||||
|
||||
MediaManager::PostTask(NewTaskFrom([id, windowId,
|
||||
audioDevice, videoDevice,
|
||||
|
|
|
@ -44,7 +44,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
auto
|
||||
MediaStreamTrackSource::ApplyConstraints(
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints) -> already_AddRefed<PledgeVoid>
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
CallerType aCallerType) -> already_AddRefed<PledgeVoid>
|
||||
{
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
p->Reject(new MediaStreamError(aWindow,
|
||||
|
@ -270,6 +271,7 @@ MediaStreamTrack::GetSettings(dom::MediaTrackSettings& aResult)
|
|||
|
||||
already_AddRefed<Promise>
|
||||
MediaStreamTrack::ApplyConstraints(const MediaTrackConstraints& aConstraints,
|
||||
CallerType aCallerType,
|
||||
ErrorResult &aRv)
|
||||
{
|
||||
if (MOZ_LOG_TEST(gMediaStreamTrackLog, LogLevel::Info)) {
|
||||
|
@ -294,7 +296,8 @@ MediaStreamTrack::ApplyConstraints(const MediaTrackConstraints& aConstraints,
|
|||
|
||||
// Keep a reference to this, to make sure it's still here when we get back.
|
||||
RefPtr<MediaStreamTrack> that = this;
|
||||
RefPtr<PledgeVoid> p = GetSource().ApplyConstraints(window, aConstraints);
|
||||
RefPtr<PledgeVoid> p = GetSource().ApplyConstraints(window, aConstraints,
|
||||
aCallerType);
|
||||
p->Then([this, that, promise, aConstraints](bool& aDummy) mutable {
|
||||
mConstraints = aConstraints;
|
||||
promise->MaybeResolve(false);
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace dom {
|
|||
class AudioStreamTrack;
|
||||
class VideoStreamTrack;
|
||||
class MediaStreamError;
|
||||
enum class CallerType : uint32_t;
|
||||
|
||||
/**
|
||||
* Common interface through which a MediaStreamTrack can communicate with its
|
||||
|
@ -123,7 +124,8 @@ public:
|
|||
*/
|
||||
virtual already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints);
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
CallerType aCallerType);
|
||||
|
||||
/**
|
||||
* Same for GetSettings (no-op).
|
||||
|
@ -288,7 +290,8 @@ public:
|
|||
void GetSettings(dom::MediaTrackSettings& aResult);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ApplyConstraints(const dom::MediaTrackConstraints& aConstraints, ErrorResult &aRv);
|
||||
ApplyConstraints(const dom::MediaTrackConstraints& aConstraints,
|
||||
CallerType aCallerType, ErrorResult &aRv);
|
||||
already_AddRefed<MediaStreamTrack> Clone();
|
||||
MediaStreamTrackState ReadyState() { return mReadyState; }
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ interface MediaStreamTrack : EventTarget {
|
|||
MediaTrackConstraints getConstraints ();
|
||||
MediaTrackSettings getSettings ();
|
||||
|
||||
[Throws]
|
||||
[Throws, NeedsCallerType]
|
||||
Promise<void> applyConstraints (optional MediaTrackConstraints constraints);
|
||||
// attribute EventHandler onoverconstrained;
|
||||
};
|
||||
|
|
|
@ -1721,7 +1721,8 @@ LocalSourceStreamInfo::ForgetPipelineByTrackId_m(const std::string& trackId)
|
|||
auto
|
||||
RemoteTrackSource::ApplyConstraints(
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints) -> already_AddRefed<PledgeVoid>
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType) -> already_AddRefed<PledgeVoid>
|
||||
{
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
p->Reject(new dom::MediaStreamError(aWindow,
|
||||
|
|
|
@ -170,7 +170,8 @@ public:
|
|||
|
||||
already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints) override;
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType) override;
|
||||
|
||||
void Stop() override
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче