Commit Graph

87 Commits

Author SHA1 Message Date
Ehsan Akhgari
f1e844fd62 Bug 935778 - Part 0.4: Spray even more MOZ_DECLARE_REFCOUNTED_TYPENAME across the tree 2014-02-21 09:11:33 -05:00
Thomas Zimmermann
5d3324a832 Bug 972253: Remove DBusThread.{cpp,h}, r=kyle
These files are obsolete and not used any longer.
2014-02-20 12:56:24 +01:00
Thomas Zimmermann
2b89bd61c1 Bug 968868: Move DBusWatcher to RawDBusConnection, r=qdot
DBusWatcher is a helper for RawDBusConnection. This patch moves
both classes into the same file. Calling RawDBusConnection::Watch
installs a DBusWatcher for the connection.
2014-02-07 12:01:27 +01:00
Thomas Zimmermann
ef2998974b Bug 968275: Remove task classes from RawDBusConnection, r=qdot
This patch removes the internal tasks from the implementation of
RawDBusConnection. All calls to RawDBusConnection are invoked on
the I/O thread, so the sender tasks only impose an overhead.
2014-02-06 17:28:44 +01:00
Thomas Zimmermann
b3753bb742 Bug 956841: Respect DBusWatch flags in I/O-thread watchers, r=qdot
Currently DBusWatcher registers read and write watchers on
the I/O thread unconditionally. Thus for read-only DBusWatch
structures, the write watcher on the I/O thread generates a
significant amount of CPU overhead by constantly reporting
success via calls to OnFileCanWriteWithoutBlocking.

This patch changes DBusWatcher to respect the status flags
of supplied DBusWatch structures. It will only poll for
read or write status if the DBus watch has the corresponding
flag set.

DBus keeps track of these flags and calls the toggle callback
when it needs to wait on a certain DBusWatch.
2014-01-15 09:32:11 +01:00
Ehsan Akhgari
124f372395 Bug 951207 - Rename the chromium LOG macro to CHROMIUM_LOG; r=bent 2013-12-17 13:26:45 -05:00
Thomas Zimmermann
62980cc2e7 Bug 932728: Run DBus on the I/O thread, r=qdot
This patch converts DBusWatcher to run on the I/O thread. When a
caller starts DBus, StartDBus creates a new connection and adds
it to the I/O thread's poll loop. DBusWatchers are created and
removed automatically by the DBus libary.

The I/O thread provides all features of the DBus thread. So most
of the existing code has been removed or rewritten. The former
includes the control socket and the DBus thread, the latter is in
the DBusWatcher code.
2013-10-29 16:03:40 +01:00
Thomas Zimmermann
aaf6e6902d Bug 932728: Use private DBus connection, r=qdot
Using a private DBus connection gives each of its users, such as
Bluetooth, its own connection to the DBus server. This simplifies
the use of DBusWatch structures and ensures that all resources of
a connection are free'd when the connection gets closed.
2013-10-29 16:03:40 +01:00
Thomas Zimmermann
ea7e350a24 Bug 932728: Open only one connection to DBus, r=echou,qdot
Bluetooth maintains two connections to the DBus server and the DBus
system itself maintains a third one. This implies some overhead and
makes the code more difficult to understand.

This patch changes the Bluetooth code to use the connection that is
established by the DBus system.
2013-12-12 12:56:00 +01:00
Thomas Zimmermann
a67d0d8348 Bug 932728: Don't inherit DBusWatcher from RawDBusConnection, r=qdot
DBusWatcher is not a DBus connection, so it shouldn't inherit from
it. This patch converts the inheritance into a class member.
2013-10-29 16:03:39 +01:00
Birunthan Mohanathas
2a97f4dc0d Bug 713082 - Part 1: Remove unnecessary Util.h includes. r=Waldo 2013-12-08 21:52:33 -05:00
Mike Hommey
a65383e1e9 Bug 939632 - Remove LIBRARY_NAME for leaf libraries. r=gps
Landing on a CLOSED TREE.
2013-11-19 11:50:54 +09:00
Mike Hommey
8ceb917350 Bug 939074 - Remove most LIBXUL_LIBRARY. rs=gps 2013-11-19 11:48:10 +09:00
Mike Hommey
bb6779efe3 Bug 939044 - Remove most definitions of MODULE. r=mshal 2013-11-19 11:47:39 +09:00
Mike Hommey
d7b6f95761 Bug 935881 - Use FINAL_LIBRARY for all (fake) libraries that end up linked in a single other library. r=gps 2013-11-19 11:47:14 +09:00
Bhargav Gurappadi
72deb74430 Bug 931306 - DBusThread fails to compile on latest compilers. r=tzimmermann, r=qDot 2013-10-25 19:37:57 -07:00
Thomas Zimmermann
b8cd66c1fd Bug 930952: Dispatch DBus messages after reading socket, r=qdot
DBusWatcher::Poll currently breaks after reading DBus data from the
socket. Thus, it never processes the data and dispatches the DBus
messages. This patch fixes the code to dispatch DBus messages after
reading the DBus socket.
2013-10-29 17:19:02 +01:00
Thomas Zimmermann
f4e9697133 Bug 931038: Remove blocking DBus interface, r=qdot
All blocking calls to DBus have been replaced by non-blocking
code. This patch removes the corresponding DBus interfaces.
2013-10-29 11:08:16 +01:00
Ed Morley
54bdd310c4 Merge mozilla-central and b2g-inbound 2013-10-25 12:12:23 +01:00
Mike Hommey
1d566f7586 Bug 929905 - Consolidate sources in moz.build. r=gps 2013-10-25 08:23:05 +09:00
Thomas Zimmermann
48534b761d Bug 927859: Cleanup DBus thread after DBusWatcher, r=qdot
This patch changes the DBus shutdown to only cleanup the DBus
thread from the main thread after DBusWatcher has completed.
This should ensure that the main thread will not have to wait
for the DBus thread.

--HG--
extra : rebase_source : 09ebb40a4e515ef5b0ebddfc1c3b7187cc546313
2013-10-25 09:31:20 +02:00
Thomas Zimmermann
25cd519f11 Bug 927459: Move helpers to DBusWatcher, r=qdot
PollFdComparator, DBusEventTypes and flag conversion are only used by
DBusWatcher. This patch moves them into DBusWatcher's namespace.

--HG--
extra : rebase_source : 688403e55e139440e6d6d28e9802f8a48d7c355d
2013-10-25 09:31:04 +02:00
Thomas Zimmermann
11476c076c Bug 927459: Add DBusWatcher::Stop, r=qdot
The Stop method encapsulates the code for sending the exit command
to a running DBus watcher.

--HG--
extra : rebase_source : 6963e6fa60b2e1e725046672a45cd325fc40a836
2013-10-25 09:30:54 +02:00
Thomas Zimmermann
33013d2e24 Bug 927459: Move poll functionality to DBusWatcher, r=qdot
The DBus poll functionality is actually part of DBusWatcher. This
patch moves it to a class method.

--HG--
extra : rebase_source : 012813cf1d0967d6c29f7e085e49940570e1d58d
2013-10-25 09:30:20 +02:00
Thomas Zimmermann
fe7861a957 Bug 927459: Cleanup DBusThread, r=qdot
This patch renames DBusThread to DBusWatcher to make its purpose
more clear. Several callback functions for DBus are converted to
methods of DBusWatcher. Their POSIX calls are now protected by
TEMP_FAILURE_RETRY.

--HG--
extra : rebase_source : d8c6963aa8388c462917180d78e8e4289f9e987a
2013-10-25 09:30:09 +02:00
Eric Chou
a2a3c126f7 Bug 923369 - Return true when RawDBusConnection::SendWithError() executed without any error, r=tzimmerman, r=qdot 2013-10-05 14:35:00 +08:00
Ms2ger
7ffcd856c2 Bug 900980 - Part a: Move unconditional assignments to EXPORT_LIBRARY to moz.build; rs=gps 2013-10-03 09:11:13 +02:00
Thomas Zimmermann
19ae300ab9 Bug 919913: Introduce DBusReplyCallback, r=qdot,echou
DBusReplyCallback replaces the removed DBusCallback as type for
reply-handler functions. Bluetooth, the only user of DBus, has
been updated as well.
2013-10-01 10:20:55 +02:00
Thomas Zimmermann
2f4cef68a1 Bug 919913: Cleanup DBusUtils, r=qdot
This patch cleans up the DBus utilitys and helper classes. All functions
for sending have been removed. Their users have been converted to the
new methods in RawDBusConnection. Include statements have been cleaned
up as well. Some methods of DBusMessageRefPtr have been moved from the
header to the source file to prevent inclusion of the DBus API from within
the header file.
2013-10-01 10:20:39 +02:00
Thomas Zimmermann
7eaed0c5d5 Bug 919913: Add send methods to RawDBusConnection, r=qdot
This patch adds methods for sending DBus messages to the class
RawDBusConnection. There are 3 types of interfaces.

 - Send             Sends a message over DBus. No error checking or
                    handling of replies is performed. These methods
                    do not block the sending thread.

 - SendWithReply    Sends a message over DBus and runs a call-back
                    function for the reply. This should be the default
                    case for most scenarios. These methods do not
                    block the sending thread.

 - SendWithError    Sends a message over DBus and waits for the reply
                    or an error. This interface has only been added for
                    some existing code that can safely block the sending
                    thread. Don't use it in new code.

These 3 types of interfaces represent what is currently used of the
existing send functions in DBusUtils. When all users have been converted
to the new methods, the interfaces in DBusUtils can be removed.
2013-10-01 10:20:21 +02:00
Wes Kocher
8bba56d03f Merge m-c to inbound 2013-09-04 18:04:50 -07:00
Mike Hommey
f1cf3b4238 Bug 912293 - Remove now redundant boilerplate from Makefile.in. r=gps 2013-09-05 09:01:46 +09:00
Thomas Zimmermann
fa9d8dc375 Bug 853550: Cleanup DBus thread handling, r=qdot
For replacing the Bluetooth command thread with a LazyIdleThread,
we need to make sure that the DBus service thread is shutdown from
within the main thread.

This patch changes the DBus stop code to cleanup the DBusThread
structure from the service thread to prevent race conditions during
shutdown. The DBus service thread itself gets shutdown from the main
thread to fulfill the requirements of LazyIdleThread. The patch also
makes sure that it's not possible to accidently dispatch a runnable
while the DBus thread terminates.
2013-08-30 20:18:40 +02:00
Brian O'Keefe
4f68eb9b02 Bug 875934 - Move LIBRARY_NAME to moz.build, batch 3; r=mshal 2013-08-15 09:02:09 -04:00
Birunthan Mohanathas
f1b1f329c2 Bug 784739 - Switch from NULL to nullptr in ipc/. r=ehsan 2013-08-23 15:51:44 -04:00
Ms2ger
dba42e4001 Bug 883284 - Part d: Move LIBXUL_LIBRARY into moz.build (f-j); r=bsmedberg 2013-08-22 08:56:00 +02:00
Brian O'Keefe
3a92f0ae7c Bug 896177 - Remove useless config.mk includes; r=gps 2013-07-17 16:06:53 -04:00
Thomas Zimmermann
1e8cda935b Bug 891866: Use AtomicRefCounted for RawDBusConnection, r=Ms2ger
RawDBusConnection incorrectly uses detail::RefCounted, which it
shouldn't. This patch converts it to use AtomicRefCounted instead.

--HG--
extra : rebase_source : 229bbbae3b43a47b362ab73dba5d1134a5ae1dac
2013-07-23 11:00:20 +02:00
Thomas Zimmermann
e997c2f1ce Bug 891866: Support nsRefPtr<RawDBusConnection>, r=qdot
Instances of RawDBusConnection can now be contained in nsRefPtr. This
allows to share the DBus connection among multiple threads.

--HG--
extra : rebase_source : fb24472b3b55e77abc7354f17ef679661f62b7fb
2013-07-22 13:30:22 +02:00
Brian O'Keefe
a2b1403eb0 Bug 883502 - Part 1: Move 'chromium_config.mk' includes after rules.mk. r=gps 2013-07-04 08:28:43 -04:00
Trevor Saunders
82e5558b37 bug 887483 - remove a bunch of useless assignments to FORCE_STATIC_LIB implied by LIBXUL_LIBRARY=1 r=mshal 2013-07-11 11:06:34 -04:00
Thomas Zimmermann
c32434ad28 Bug 891276: Removed unused function dbus_returns_uint32, r=echou
AddServiceRecords was the only user of this function. This patch
cleans it up.
2013-07-11 09:58:53 +02:00
Thomas Zimmermann
79b015cfa0 Bug 884840: Reimplement GetServiceChannel without Bluetooth command thread, r=echou
The method BluetoothDBusService::GetServiceChannel currently blocks the
Bluetooth command thread while waiting for a DBus message, before it
dispatches a runnable to the main thread.

With this patch, the DBus message is processed asyncronously, and the
runnable gets dispatched from the DBus reply handler.

--HG--
extra : rebase_source : 24519b7dd8d59fcbbf78436092610c8db195f6a2
2013-07-09 09:56:14 +02:00
Thomas Zimmermann
4256032016 Bug 884840: Added DBusReplyHandler, r=qdot
Handler functions for DBus replies sometimes need several data fields
or need to keep state over replies for multiple messages. The DBus API
itself only allows for a single pointer to user data.

The class DBusReplyHandler is a base class for implementing DBus reply-
message handlers. Users of DBus can inherit from this class to implement
message-specific handlers.

--HG--
extra : rebase_source : 91c5f6e8d365922fd3b52fbaf502052f86274f16
2013-07-09 09:55:08 +02:00
Thomas Zimmermann
371a3aeb48 Bug 830290: Don't block DBus while waiting for replies r=bent,qdot 2013-03-11 15:22:56 +01:00
Thomas Zimmermann
8e03a258df Bug 830290: Send blocking DBus messages from within DBus thread r=bent,qdot
The this commit moves the sending of blocking DBus messages to the
DBus thread. This allows us to avoid concurrency problems within the
DBus library, which is not explicitly thread-safe.

As a side note, I'd like to mention that blocking in distributed
systems simply doesn't work. The dbus library is especially broken
in this regard as it delays all unrelated messages until the reply
for the blocking request has been received. A future commit should
implement this functionality with an asyncronous call and make the
related thread wait for the reply.
2013-03-01 15:05:50 +01:00
Thomas Zimmermann
438dbbcced Bug 830290: Execute DBus send operation in DBus thread r=bent,qdot
The DBus send operation simply sends a DBus message without further
processing of replies. If the sender is interested in a reply, the
respective serial number can be returned. In this case, the sending
operation (and only the sending) is serialized with the calling
thread.
2013-03-01 13:43:45 +01:00
Thomas Zimmermann
c22d7de8b9 Bug 830290: Cleanup DBusConnectionSendWithReplyTask r=bent,qdot
The class DBusConnectionSendWithReplyTask has been renamed to
DBusConnectionSendWithReplyRunnable, which better fits its purpose. The
internal callback function and data has been move into the implementation
of DBusConnectionSendWithReplyRunnable. Additionally, there is now an
abstract base class for DBus send runnables. This class will become useful
for implementing send classes with different policies.
2013-03-01 12:49:57 +01:00
Thomas Zimmermann
f5a46f4d42 Bug 830290: Setup asyncronous DBus messages in DBus thread r=bent,qdot
This patch finally fixes bug 827888 were a message's reply was
received before the respective handler function could be installed.

The patch adds the class DBusConnectionSendWithReplyTask, which
asyncronously sends a DBus message and installs the reply's handler
function. The DBus utility functions for asyncronous messages create
an instance of this class and dispatch it to the DBus thread. This
intercepts the DBusPollTask, so no DBus replies can be received until
the dispatched DBusConnectionSendWithReplyTask has finished.
2013-01-28 10:15:31 +01:00
Thomas Zimmermann
659600f7e7 Bug 830290: Added dispatch function for DBus thread r=bent,qdot
The new function allows to schedule nsRunnables to an existing DBus
thread. This intercepts the running instance of DBusPollTask and
makes the DBus thread process the dispatched runnable. The intercepted
poll task automatically continues polling once all pending runnables
have been processed.
2013-01-14 11:50:27 +01:00