2013-09-16 06:34:57 +00: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 09:54:25 +00:00
|
|
|
#include "mozilla/dom/MediaStreamBinding.h"
|
2013-09-16 06:34:57 +00:00
|
|
|
#include "mozilla/dom/GetUserMediaRequestBinding.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
GetUserMediaRequest::GetUserMediaRequest(
|
2016-01-30 17:05:36 +00:00
|
|
|
nsPIDOMWindowInner* aInnerWindow,
|
2013-09-16 06:34:57 +00:00
|
|
|
const nsAString& aCallID,
|
2014-04-18 18:00:16 +00:00
|
|
|
const MediaStreamConstraints& aConstraints,
|
2014-04-16 06:22:19 +00:00
|
|
|
bool aIsSecure)
|
2014-02-14 19:32:58 +00:00
|
|
|
: mInnerWindowID(aInnerWindow->WindowID())
|
|
|
|
, mOuterWindowID(aInnerWindow->GetOuterWindow()->WindowID())
|
2013-09-16 06:34:57 +00:00
|
|
|
, mCallID(aCallID)
|
2014-04-18 18:00:16 +00:00
|
|
|
, mConstraints(new MediaStreamConstraints(aConstraints))
|
2014-04-16 06:22:19 +00:00
|
|
|
, mIsSecure(aIsSecure)
|
2013-09-16 06:34:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-19 04:24:59 +00: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 19:32:58 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(GetUserMediaRequest)
|
2013-09-16 06:34:57 +00: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 14:13:33 +00:00
|
|
|
GetUserMediaRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-09-16 06:34:57 +00: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 14:13:33 +00:00
|
|
|
return GetUserMediaRequestBinding::Wrap(aCx, this, aGivenProto);
|
2013-09-16 06:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsISupports* GetUserMediaRequest::GetParentObject()
|
|
|
|
{
|
2014-02-14 19:32:58 +00:00
|
|
|
return nullptr;
|
2013-09-16 06:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetUserMediaRequest::GetCallID(nsString& retval)
|
|
|
|
{
|
|
|
|
retval = mCallID;
|
|
|
|
}
|
|
|
|
|
2017-01-19 04:24:59 +00:00
|
|
|
void GetUserMediaRequest::GetRawID(nsString& retval)
|
|
|
|
{
|
|
|
|
retval = mRawID;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetUserMediaRequest::GetMediaSource(nsString& retval)
|
|
|
|
{
|
|
|
|
retval = mMediaSource;
|
|
|
|
}
|
|
|
|
|
2013-09-16 06:34:57 +00:00
|
|
|
uint64_t GetUserMediaRequest::WindowID()
|
|
|
|
{
|
2014-02-14 19:32:58 +00:00
|
|
|
return mOuterWindowID;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t GetUserMediaRequest::InnerWindowID()
|
|
|
|
{
|
|
|
|
return mInnerWindowID;
|
2013-09-16 06:34:57 +00:00
|
|
|
}
|
|
|
|
|
2014-04-16 06:22:19 +00:00
|
|
|
bool GetUserMediaRequest::IsSecure()
|
|
|
|
{
|
|
|
|
return mIsSecure;
|
|
|
|
}
|
|
|
|
|
2013-09-16 06:34:57 +00:00
|
|
|
void
|
2014-04-18 18:00:16 +00:00
|
|
|
GetUserMediaRequest::GetConstraints(MediaStreamConstraints &result)
|
2013-09-16 06:34:57 +00:00
|
|
|
{
|
2014-04-04 09:54:25 +00:00
|
|
|
result = *mConstraints;
|
2013-09-16 06:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|