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 "base/basictypes.h"
|
|
|
|
#include "GetUserMediaRequest.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,
|
2013-09-16 10:34:57 +04:00
|
|
|
const nsAString& aCallID,
|
2014-04-18 22:00:16 +04:00
|
|
|
const MediaStreamConstraints& aConstraints,
|
2014-04-16 10:22:19 +04:00
|
|
|
bool aIsSecure)
|
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)
|
2013-09-16 10:34:57 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-19 07:24:59 +03:00
|
|
|
GetUserMediaRequest::GetUserMediaRequest(
|
|
|
|
nsPIDOMWindowInner* aInnerWindow,
|
|
|
|
const nsAString& aRawId,
|
|
|
|
const nsAString& aMediaSource)
|
|
|
|
: mRawID(aRawId)
|
|
|
|
, mMediaSource(aMediaSource)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
JSObject*
|
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
|
|
|
GetUserMediaRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-09-16 10:34:57 +04:00
|
|
|
{
|
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
|
|
|
return GetUserMediaRequestBinding::Wrap(aCx, this, aGivenProto);
|
2013-09-16 10:34:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsISupports* GetUserMediaRequest::GetParentObject()
|
|
|
|
{
|
2014-02-14 23:32:58 +04:00
|
|
|
return nullptr;
|
2013-09-16 10:34:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2014-02-14 23:32:58 +04:00
|
|
|
return mOuterWindowID;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-09-16 10:34:57 +04:00
|
|
|
void
|
2014-04-18 22:00:16 +04:00
|
|
|
GetUserMediaRequest::GetConstraints(MediaStreamConstraints &result)
|
2013-09-16 10:34:57 +04:00
|
|
|
{
|
2014-04-04 13:54:25 +04:00
|
|
|
result = *mConstraints;
|
2013-09-16 10:34:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|