|INIT_AT| works around missing compiler features for gcc before
version 4.7. All B2G targets have been lifted to gcc 4.8, so the
workaround is not required any longer.
The macro |CONVERT| implements a workaround for GCC compilers
before version 4.7. All targets of B2G have been lifted to GCC
4.8, so |CONVERT| is not required any longer.
Usually references to Bluetooth result handlers are kept until the
command's response has been received and the result handler ran. If
sending the command fails, the extra reference has to be dropped.
With this patch, Gecko will correctly dereference Bluetooth result
handlers when send operations fail.
Thanks to Bruce Sun for finding this bug.
Bluedroid's HAL backend has been superseded by the Bluetooth daemon, and
already been unused in current releases. This patch removes the code from
Gecko.
This patch adds an explicit check for the terminal \0 character to
the parser that reads Bluetooth device names from bluetoothd. There's
a maximum length of 249 characters per name. If we don't find \0 we
interpret the whole range to contain the device name.
The shutdown procedure for socket classes ensures that the I/O class is
deleted independently from its socket class. If the socket class has been
deleted, no I/O is performed and no socket events are forwarded. The I/O
class therefore doesn't require a strong reference to its socket class.
This patch removes the remaining ref-counted pointers from the socket I/O
classes. The socket class clears the weak reference in its socket I/O class
when closing the socket.
The current shutdown code for Bluetooth contains a race condition
between closing the daemon sockets and re-opening them for the next
instance of the daemon.
This patch fixes the problem by not disabling the Bluetooth adapter
before the sockets have been closed. During the shutdown, no new
instances of the daemon can be started.
The bulk of this commit was generated by running:
run-clang-tidy.py \
-checks='-*,llvm-namespace-comment' \
-header-filter=^/.../mozilla-central/.* \
-fix
The class |DaemonSocket| and its helpers implement a service-
neutral connection to a HAL daemon. This patch moves the code
to an appropriate directory and breaks up the code into smaller
pieces.
--HG--
rename : ipc/bluetooth/BluetoothDaemonConnection.cpp => ipc/hal/DaemonSocket.cpp
rename : ipc/bluetooth/BluetoothDaemonConnection.h => ipc/hal/DaemonSocket.h
rename : ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp => ipc/hal/DaemonSocketConsumer.cpp
rename : ipc/bluetooth/BluetoothDaemonConnectionConsumer.h => ipc/hal/DaemonSocketConsumer.h
rename : ipc/bluetooth/moz.build => ipc/hal/moz.build
Dispatching events via |nsIThread| doesn't work with worker threads. This
patch replaces all uses of |nsIThread| in the socket code by equivalent
uses of |MessageLoop|.
The socket IPC interfaces still use 'main thread' in a number of
places. This patch changes all such interfaces and documentation
to speak of 'consumer thread' instead.
The consumer thread handles socket creation, destruction, and
data processing for socket IPC. Traditionally this has been
done on the main thread.
This patch extends the socket IPC classes to support arbitrary
consumer threads. The thread is configured when establishing a
connection, and performs all of the above operations until the
socket is closed.
The I/O thread sends and receives data on a file descriptor. This
has traditionally been performed on a single I/O thread.
This patch extends the socket IPC classes to support arbitrary I/O
threads. The thread is configured when a connection is established
and used until the socket gets closed.
Both types, |union sockaddr_any| and |struct sockaddr_storage|, provide
a sockaddr type that can hold any address. The latter is standardized by
POSIX, so we prefer it.
This patch integrates the functionality of |BluetoothDaemonChannel|
into |BluetoothDaemonConnection|. All users are adapted, the former
class is removed.
This patch converts |ListenSocket| to forward events to an instance
of |ListenSocketConsumer|. All users are converted and the related
listener and consumer classes are removed.
With this patch, stream and listening sockets handle the setup of
accepted sockets internally. Sub-classes of |StreamSocket| don't
have to overload StreamSocket's |GetIO| any longer.
The new method |UnixSocketConnector::Duplicate| allows a socket
connector to duplicate itself. Listening sockets will used this
feature to create socket connectors for accepted connections.
This patch moves |BluetoothDaemonSocketConnector| into its own file,
renames it to |BluetoothDaemonConnector| and implements the new socket-
connector interface.
During restarts of the Bluetooth daemon, it can occur that Gecko tries
to send without having a connection to bluetoothd opened. This patch adds
a check to prevent this.
Bluedroid's A2DP manager is the same for Bluetooth v1 and v2, except
fixes for bug 1062697 and bug 1148311 in v1. This patch merges both
variants. The last remaining difference is a call to |DistributeSignal|,
which differs between both implementations.
The implementation of the Bluedroid HFP manager in Bluetoth v1 and v2
differs by a number of interface changes. This patch merges both variants
into a single one, were possible.
Bluedroid's OPP manager is the same for Bluetooth v1 and v2; except
for bug 1118177, which is fixed in v1. So with this patch, the v1
implementation is used for both variants.
During restarts of the Bluetooth daemon, it can occur that Gecko tries
to send without having a connection to bluetoothd opened. This patch adds
a check to prevent this.
This patch cleans up the inherited methods of Bluedroid's
|BluetooothSocket|. Methods of the same base class are grouped
within the file, and each method is labeled with 'override'.
With the current code, the Bluetooth result runnable is saved for
receiving before a command has been sent successfully. If sending
fails afterwards, the saved result runnable will still sit in the
result queue, and interfere with later, successful commands.
With this patch, the result runnable is saved only if the sending
was successful.
This patch removes the template parameters from
|SocketIORequestClosingRunnable| and moves its methods into
the C++ source file. All users have been adapted.
|ReceiveSocketData| receives socket data on the main thread. This
is a specific detail of the current socket classes, which should not
be required by future implementations.
This patch moves the receive method and the corresponding runnable
into socket classes.
This patch moves management of received socket I/O buffers from
|DataSocketIO| into the I/O classes. Each I/O class is responsible
for (de-)allocating buffers, and consuming them once data has been
received.
All current I/O classes forward their buffers to the main thread,
but other operations are possible. For example, received data can
be parsed and processed directly in the I/O thread.
This patch renames |SocketConsumerBase| to |DataSocket|, and for the
I/O classes |SocketConsumerIO| to |DataSocketIO|. |DataSocketIO| also
contains send and receive functionality from |SocketBaseIO|.
|DataSocket| is a virtual base class that represents a socket that
transfers data, without a particular constraints to what the data
represents. |DataSocketIO| is the corresponding helper class on the
I/O thread.
The v1 implementation of BluetoothInterfaceHelpers.{cpp,h} is more
up-to-date than the v2 variant. So we can just use the v1 version and
remove the v2 version entirely. Bluetooth v2 contains its own version
of |Convert(nsresult, BluetoothStatus)|, which has been removed in
favor of the shared implementation.
--HG--
rename : dom/bluetooth/bluetooth1/BluetoothInterfaceHelpers.cpp => dom/bluetooth/BluetoothInterfaceHelpers.cpp
rename : dom/bluetooth/bluetooth1/BluetoothInterfaceHelpers.h => dom/bluetooth/BluetoothInterfaceHelpers.h
With this patch, Bluetooth v1 and v2 share the same interfaces classes
for their backend code. Bluetooth v1 doesn't yet support GATT, so the
GATT interfaces are still not implemented.
The patch also fixes the GATT-specific classes to compile under recent GCC
versions 4.8 and later, which are used with Android L.
The patch also preserves the prefered backend for each version. Bluetooth
v1 defaults to 'bluetoothd,' v2 defaults to 'bluedroid.'
Bluetooth use different types for the second argument of their variant
of |BluetoothInterface::SspReply|. This patch standardizes them on the
v2 version.
The v1 implementation of BluetoothInterfaceHelpers.{cpp,h} is more
up-to-date than the v2 variant. So we can just use the v1 version and
remove the v2 version entirely. Bluetooth v2 contains its own version
of |Convert(nsresult, BluetoothStatus)|, which has been removed in
favor of the shared implementation.
--HG--
rename : dom/bluetooth/bluetooth1/BluetoothInterfaceHelpers.cpp => dom/bluetooth/BluetoothInterfaceHelpers.cpp
rename : dom/bluetooth/bluetooth1/BluetoothInterfaceHelpers.h => dom/bluetooth/BluetoothInterfaceHelpers.h
With this patch, Bluetooth v1 and v2 share the same interfaces classes
for their backend code. Bluetooth v1 doesn't yet support GATT, so the
GATT interfaces are still not implemented.
The patch also fixes the GATT-specific classes to compile under recent GCC
versions 4.8 and later, which are used with Android L.
The patch also preserves the prefered backend for each version. Bluetooth
v1 defaults to 'bluetoothd,' v2 defaults to 'bluedroid.'
Bluetooth use different types for the second argument of their variant
of |BluetoothInterface::SspReply|. This patch standardizes them on the
v2 version.
The only classes with significant differences between Bluetooth v1 and
v2 is |BluetoothServicebluedroid| and its helpers. The patch copies the
code from v2 into the shared backend's implementation and integrates
them by the use of ifdef. More fine-grained integration can be done later
on.
There are some minor differences between backends in Bluetooth v1 and
v2. Some of the types have been added, removed or renamed. This patch
prepares the HAL and daemon backend interfaces to support both variants.
This patch moves GATT support for Bluetooth v2 into the shared
backend code. No functional modifications are made.
--HG--
rename : dom/bluetooth2/bluedroid/BluetoothGattHALInterface.cpp => dom/bluetooth/bluedroid/BluetoothGattHALInterface.cpp
rename : dom/bluetooth2/bluedroid/BluetoothGattHALInterface.h => dom/bluetooth/bluedroid/BluetoothGattHALInterface.h
rename : dom/bluetooth2/bluedroid/BluetoothGattManager.cpp => dom/bluetooth/bluedroid/BluetoothGattManager.cpp
rename : dom/bluetooth2/bluedroid/BluetoothGattManager.h => dom/bluetooth/bluedroid/BluetoothGattManager.h