Backed out changeset 592a04d2e550 (bug 942104)

This commit is contained in:
Carsten "Tomcat" Book 2014-05-22 11:46:16 +02:00
Родитель fee1c7c26d
Коммит 9ddce22631
1 изменённых файлов: 11 добавлений и 12 удалений

Просмотреть файл

@ -51,6 +51,7 @@ static InfallibleTArray<nsString> sAdapterBondedAddressArray;
static InfallibleTArray<BluetoothNamedValue> sRemoteDevicesPack;
static nsTArray<nsRefPtr<BluetoothProfileController> > sControllerArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sBondingRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sChangeDiscoveryRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sGetDeviceRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sSetPropertyRunnableArray;
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sUnbondingRunnableArray;
@ -97,6 +98,7 @@ public:
// Bluetooth just enabled, clear profile controllers and runnable arrays.
sControllerArray.Clear();
sBondingRunnableArray.Clear();
sChangeDiscoveryRunnableArray.Clear();
sGetDeviceRunnableArray.Clear();
sSetPropertyRunnableArray.Clear();
sUnbondingRunnableArray.Clear();
@ -514,14 +516,12 @@ DiscoveryStateChangedCallback(bt_discovery_state_t aState)
{
MOZ_ASSERT(!NS_IsMainThread());
bool isDiscovering = (aState == BT_DISCOVERY_STARTED);
BluetoothSignal signal(NS_LITERAL_STRING(DISCOVERY_STATE_CHANGED_ID),
NS_LITERAL_STRING(KEY_ADAPTER), isDiscovering);
if (!sChangeDiscoveryRunnableArray.IsEmpty()) {
BluetoothValue values(true);
DispatchBluetoothReply(sChangeDiscoveryRunnableArray[0],
values, EmptyString());
nsRefPtr<DistributeBluetoothSignalTask> t =
new DistributeBluetoothSignalTask(signal);
if (NS_FAILED(NS_DispatchToMainThread(t))) {
BT_WARNING("Failed to dispatch to main thread!");
sChangeDiscoveryRunnableArray.RemoveElementAt(0);
}
}
@ -935,9 +935,9 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
if (!IsReady()) {
NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
return NS_OK;
}
int ret = sBtInterface->start_discovery();
if (ret != BT_STATUS_SUCCESS) {
ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StartDiscovery"));
@ -945,8 +945,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
return NS_OK;
}
DispatchBluetoothReply(aRunnable, true, EmptyString());
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
return NS_OK;
}
@ -965,10 +964,10 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
int ret = sBtInterface->cancel_discovery();
if (ret != BT_STATUS_SUCCESS) {
ReplyStatusError(aRunnable, ret, NS_LITERAL_STRING("StopDiscovery"));
return NS_ERROR_FAILURE;
return NS_OK;
}
DispatchBluetoothReply(aRunnable, true, EmptyString());
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
return NS_OK;
}