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
parent f082d1b0db
commit 1e6a5b445b
2 changed files with 1074 additions and 513 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 *),