зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1426129 - Hold CamerasChild via promoting "this" to a RefPtr. r=jib
MozReview-Commit-ID: JdZqnGxlsBV
This commit is contained in:
Родитель
daf2302a16
Коммит
05487212d3
|
@ -290,10 +290,11 @@ CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine,
|
|||
LOG((__PRETTY_FUNCTION__));
|
||||
LOG(("NumberOfCapabilities for %s", deviceUniqueIdUTF8));
|
||||
nsCString unique_id(deviceUniqueIdUTF8);
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine, nsCString>(
|
||||
"camera::PCamerasChild::SendNumberOfCapabilities",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendNumberOfCapabilities,
|
||||
aCapEngine,
|
||||
unique_id);
|
||||
|
@ -306,10 +307,11 @@ int
|
|||
CamerasChild::NumberOfCaptureDevices(CaptureEngine aCapEngine)
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine>(
|
||||
"camera::PCamerasChild::SendNumberOfCaptureDevices",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendNumberOfCaptureDevices,
|
||||
aCapEngine);
|
||||
LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger);
|
||||
|
@ -333,10 +335,11 @@ int
|
|||
CamerasChild::EnsureInitialized(CaptureEngine aCapEngine)
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine>(
|
||||
"camera::PCamerasChild::SendEnsureInitialized",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendEnsureInitialized,
|
||||
aCapEngine);
|
||||
LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger);
|
||||
|
@ -352,10 +355,11 @@ CamerasChild::GetCaptureCapability(CaptureEngine aCapEngine,
|
|||
{
|
||||
LOG(("GetCaptureCapability: %s %d", unique_idUTF8, capability_number));
|
||||
nsCString unique_id(unique_idUTF8);
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine, nsCString, unsigned int>(
|
||||
"camera::PCamerasChild::SendGetCaptureCapability",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendGetCaptureCapability,
|
||||
aCapEngine,
|
||||
unique_id,
|
||||
|
@ -394,10 +398,11 @@ CamerasChild::GetCaptureDevice(CaptureEngine aCapEngine,
|
|||
bool* scary)
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine, unsigned int>(
|
||||
"camera::PCamerasChild::SendGetCaptureDevice",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendGetCaptureDevice,
|
||||
aCapEngine,
|
||||
list_number);
|
||||
|
@ -438,12 +443,13 @@ CamerasChild::AllocateCaptureDevice(CaptureEngine aCapEngine,
|
|||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
nsCString unique_id(unique_idUTF8);
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine,
|
||||
nsCString,
|
||||
const mozilla::ipc::PrincipalInfo&>(
|
||||
"camera::PCamerasChild::SendAllocateCaptureDevice",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendAllocateCaptureDevice,
|
||||
aCapEngine,
|
||||
unique_id,
|
||||
|
@ -474,10 +480,11 @@ CamerasChild::ReleaseCaptureDevice(CaptureEngine aCapEngine,
|
|||
const int capture_id)
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine, int>(
|
||||
"camera::PCamerasChild::SendReleaseCaptureDevice",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendReleaseCaptureDevice,
|
||||
aCapEngine,
|
||||
capture_id);
|
||||
|
@ -525,10 +532,11 @@ CamerasChild::StartCapture(CaptureEngine aCapEngine,
|
|||
webrtcCaps.rawType,
|
||||
webrtcCaps.codecType,
|
||||
webrtcCaps.interlaced);
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable = mozilla::
|
||||
NewNonOwningRunnableMethod<CaptureEngine, int, VideoCaptureCapability>(
|
||||
"camera::PCamerasChild::SendStartCapture",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendStartCapture,
|
||||
aCapEngine,
|
||||
capture_id,
|
||||
|
@ -541,10 +549,11 @@ int
|
|||
CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id)
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
mozilla::NewNonOwningRunnableMethod<CaptureEngine, int>(
|
||||
"camera::PCamerasChild::SendStopCapture",
|
||||
this,
|
||||
self,
|
||||
&CamerasChild::SendStopCapture,
|
||||
aCapEngine,
|
||||
capture_id);
|
||||
|
@ -610,8 +619,9 @@ CamerasChild::ShutdownParent()
|
|||
// Delete the parent actor.
|
||||
// CamerasChild (this) will remain alive and is only deleted by the
|
||||
// IPC layer when SendAllDone returns.
|
||||
RefPtr<CamerasChild> self(this);
|
||||
nsCOMPtr<nsIRunnable> deleteRunnable = mozilla::NewNonOwningRunnableMethod(
|
||||
"camera::PCamerasChild::SendAllDone", this, &CamerasChild::SendAllDone);
|
||||
"camera::PCamerasChild::SendAllDone", self, &CamerasChild::SendAllDone);
|
||||
CamerasSingleton::Thread()->Dispatch(deleteRunnable, NS_DISPATCH_NORMAL);
|
||||
} else {
|
||||
LOG(("ShutdownParent called without PBackground thread"));
|
||||
|
|
|
@ -148,7 +148,7 @@ class CamerasChild final : public PCamerasChild
|
|||
public:
|
||||
// We are owned by the PBackground thread only. CamerasSingleton
|
||||
// takes a non-owning reference.
|
||||
NS_INLINE_DECL_REFCOUNTING(CamerasChild)
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CamerasChild)
|
||||
|
||||
// IPC messages recevied, received on the PBackground thread
|
||||
// these are the actual callbacks with data
|
||||
|
|
Загрузка…
Ссылка в новой задаче