This patch cleans up the inherited methods of BlueZ's |BluetooothSocket|.
Methods of the same base class are grouped within the file, and each
method is labeled with 'override'.
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.
Without unregistering the bluetooth signal handler when a object unlinked, we
might end up exposing a deleted object to JS or accessing deleted objects while
receiving signals from parent process.
This patch unregister signal handlers in unlink for each Bluetooth* classes
which registers signal handlers. And also checks if the signal handler is not
unregistered before handling signals in content process.
|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.
|BluetoothSocket| is the last remaining user of |UnixSocketConsumer|. Since
the latter class is deprecated, it's the best option to merge it into the
socket class.
The functionality of |UnixSocketConsumer| is provided by |ListenSocket| and
|StreamSocket|.
BluetoothUUID of v1 and v2 are the same, except for bug 1015819 in
v1. So this patch moves the v1 variant to a shared location and removes
the v2 variant completely.
With this patch, Bluetooth v1 and v2 share the same files for
BluetoothUtils.{cpp,h}. Some of the functions are still version specific
and cannot be shared. The v1 variants can be removed after switching to
v2.