In order to avoid the assertion, which occurs because we can't control the
order of contruction of global static variables, I changed to use a pointer
instead of an instance, so I can really allocate the memory block at the
other place (in ctor of BluetoothDBusService).
With the completely non-blocking handling of 'GetProperties' message
there is no need for BluetoothArrayOfDevicePropertiesRunnable any longer.
--HG--
extra : rebase_source : 8cbdf1bfdf4aec3dfd797326a6846931a8099723
BluetoothArrayOfDevicePropertiesRunnable used to block while waiting
for the results of the 'GetProperties' messages it sends over DBus. With
this patch, each 'GetProperties' operation is performed asyncronously
and the result is handled in a DBus reply handler. The same reply handler
gets used for all 'GetProperties' messages until all devices have been
processed. In this case the final Bluetooth reply runnable gets
dispatched.
The old function GetPropertiesInternal is now unused and has been
removed.
--HG--
extra : rebase_source : 6e5ed63ce2077e16bcaf995c3ca89f923ec8b37e
Starting and stopping Bluetooth support can block the executing thread
for an indefinite amount of time. In most cases these operations are
only performed when Gecko starts and stops, so we don't want to keep
a separate Bluetooth command thread for this.
This patch replaces the Bluetooth command thread by a LazyIdleThread,
which only consumes resources while it executes actual code. After a
timeout period, the LazyIdleThread cleans up its internal state. The
timeout is currently 3 seconds, which has been choosen arbitrarily.
Thanks to bent for helping with the details of LazyIdleThread.
GetDefaultAdapterPathInternal used two blocking DBus operations,
namely 'DefaultAdapter' and 'GetProperties'. The latter one depends
on the result of the former one.
The be non-blocking, GetDefaultAdapterPathInternal first make a
non-blocking 'DefaultAdapter' call. Once received, the reply handler
non-blockingly calls 'GetProperties' with the values received for
'DefaultAdapter', and put itself in place as this call's reply
handler. For this second reply, it finally schedules the Bluetooth
reply runnable.
--HG--
extra : rebase_source : aa0872a5db69c928ca25723952fe2928ef52d107
This patch cleans up the various funtions that are related to
UnpackPropertiesMessage.
The original function UnpackPropertiesMessage now returns success
or failure as a boolean value. All other functions have been
into this one. And the code has been cleaned up to be more readable.
AppendDeviceNameRunnable currently block on the Bluetooth command thread
for a DBus reply.
This patch refactors the code to not block during the DBus call. The classes
AppendDeviceNameHandler and AppendDeviceNameRunnable are being removed, and
the DBus interaction is done directly in the DBus thread.
We keep the old XPIDL files in place to stay compatible with existing
code. They can probably be removed when all bindings have been converted
to WebIDL.