Backed out changeset 3a5a9d48b90c (bug 968836) for m-bc bustage

This commit is contained in:
Wes Kocher 2014-03-05 18:44:33 -08:00
parent 6e0000d3a9
commit d8e923b00e

View File

@ -1,5 +1,3 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
@ -227,22 +225,23 @@ class DeviceSuccessCallbackRunnable: public nsRunnable
public:
DeviceSuccessCallbackRunnable(
uint64_t aWindowID,
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> aSuccess,
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> aError,
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
nsTArray<nsCOMPtr<nsIMediaDevice> >* aDevices)
: mDevices(aDevices)
: mSuccess(aSuccess)
, mError(aError)
, mDevices(aDevices)
, mWindowID(aWindowID)
, mManager(MediaManager::GetInstance())
{
mSuccess.swap(aSuccess);
mError.swap(aError);
}
, mManager(MediaManager::GetInstance()) {}
NS_IMETHOD
Run()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> success(mSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
// Only run if window is still on our active list.
if (!mManager->IsWindowStillActive(mWindowID)) {
return NS_OK;
@ -257,7 +256,7 @@ public:
// We should in the future return an empty array, and dynamically add
// devices to the dropdowns if things are hotplugged while the
// requester is up.
mError->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
error->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
return NS_OK;
}
@ -273,13 +272,13 @@ public:
static_cast<const void*>(tmp.Elements())
));
mSuccess->OnSuccess(devices);
success->OnSuccess(devices);
return NS_OK;
}
private:
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsAutoPtr<nsTArray<nsCOMPtr<nsIMediaDevice> > > mDevices;
uint64_t mWindowID;
nsRefPtr<MediaManager> mManager;
@ -1100,15 +1099,13 @@ public:
NS_DispatchToMainThread(new DeviceSuccessCallbackRunnable(mWindowId,
mSuccess, mError,
final.forget()));
// DeviceSuccessCallbackRunnable should have taken these.
MOZ_ASSERT(!mSuccess && !mError);
return NS_OK;
}
private:
MediaStreamConstraintsInternal mConstraints;
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsRefPtr<MediaManager> mManager;
uint64_t mWindowId;
const nsString mCallId;