Bug 964817: Invoke DBus send operations on I/O thread, r=echou

Currently, the DBus connection for Bluetooth is shared between the
main thread and the I/O thread. This causes race conditions when
starting or stopping Bluetooth.

This patch moves all occurences of main-thread-invoked DBus send
operations to the I/O thread. This is mostly refactoring. Internally,
send operations are already executed on the main thread, so there is
no change in the over all logic of these methods.
This commit is contained in:
Thomas Zimmermann 2014-02-06 13:44:46 +01:00
Родитель 3daea10d35
Коммит 4f63fd3fe0
2 изменённых файлов: 1074 добавлений и 513 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -24,6 +24,23 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDBusService : public BluetoothService
{
public:
/**
* For DBus Control method of "UpdateNotification", event id should be
* specified as following:
* (Please see specification of AVRCP 1.3, Table 5.28 for more details.)
*/
enum ControlEventId {
EVENT_PLAYBACK_STATUS_CHANGED = 0x01,
EVENT_TRACK_CHANGED = 0x02,
EVENT_TRACK_REACHED_END = 0x03,
EVENT_TRACK_REACHED_START = 0x04,
EVENT_PLAYBACK_POS_CHANGED = 0x05,
EVENT_BATT_STATUS_CHANGED = 0x06,
EVENT_SYSTEM_STATUS_CHANGED = 0x07,
EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08,
EVENT_UNKNOWN
};
BluetoothDBusService();
~BluetoothDBusService();
@ -159,23 +176,6 @@ public:
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
private:
/**
* For DBus Control method of "UpdateNotification", event id should be
* specified as following:
* (Please see specification of AVRCP 1.3, Table 5.28 for more details.)
*/
enum ControlEventId {
EVENT_PLAYBACK_STATUS_CHANGED = 0x01,
EVENT_TRACK_CHANGED = 0x02,
EVENT_TRACK_REACHED_END = 0x03,
EVENT_TRACK_REACHED_START = 0x04,
EVENT_PLAYBACK_POS_CHANGED = 0x05,
EVENT_BATT_STATUS_CHANGED = 0x06,
EVENT_SYSTEM_STATUS_CHANGED = 0x07,
EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08,
EVENT_UNKNOWN
};
nsresult SendGetPropertyMessage(const nsAString& aPath,
const char* aInterface,
void (*aCB)(DBusMessage *, void *),