Bug 1246931: Use |DBusConnection| in |DBusWatcher|, r=shuang

This patch replaces all references to |RawDBusConnection| in |DBusWatcher|
with |DBusConnection|.
This commit is contained in:
Thomas Zimmermann 2016-04-12 16:14:39 +02:00
parent c78e56f403
commit 4ec30bc8a8
3 changed files with 8 additions and 12 deletions

View File

@ -7,12 +7,11 @@
#include "DBusWatcher.h"
#include "mozilla/unused.h"
#include "nsThreadUtils.h"
#include "RawDBusConnection.h"
namespace mozilla {
namespace ipc {
DBusWatcher::DBusWatcher(RawDBusConnection* aConnection, DBusWatch* aWatch)
DBusWatcher::DBusWatcher(DBusConnection* aConnection, DBusWatch* aWatch)
: mConnection(aConnection)
, mWatch(aWatch)
{
@ -23,7 +22,7 @@ DBusWatcher::DBusWatcher(RawDBusConnection* aConnection, DBusWatch* aWatch)
DBusWatcher::~DBusWatcher()
{ }
RawDBusConnection*
DBusConnection*
DBusWatcher::GetConnection()
{
return mConnection;
@ -82,7 +81,7 @@ DBusWatcher::AddWatchFunction(DBusWatch* aWatch, void* aData)
{
MOZ_ASSERT(!NS_IsMainThread());
auto connection = static_cast<RawDBusConnection*>(aData);
auto connection = static_cast<DBusConnection*>(aData);
UniquePtr<DBusWatcher> dbusWatcher =
MakeUnique<DBusWatcher>(connection, aWatch);
@ -134,8 +133,7 @@ DBusWatcher::OnFileCanReadWithoutBlocking(int aFd)
DBusDispatchStatus dbusDispatchStatus;
do {
dbusDispatchStatus =
dbus_connection_dispatch(mConnection->GetConnection());
dbusDispatchStatus = dbus_connection_dispatch(mConnection);
} while (dbusDispatchStatus == DBUS_DISPATCH_DATA_REMAINS);
}

View File

@ -13,12 +13,10 @@
namespace mozilla {
namespace ipc {
class RawDBusConnection;
class DBusWatcher : public MessageLoopForIO::Watcher
{
public:
DBusWatcher(RawDBusConnection* aConnection, DBusWatch* aWatch);
DBusWatcher(DBusConnection* aConnection, DBusWatch* aWatch);
~DBusWatcher();
void StartWatching();
@ -29,7 +27,7 @@ public:
static void RemoveWatchFunction(DBusWatch* aWatch, void* aData);
static void ToggleWatchFunction(DBusWatch* aWatch, void* aData);
RawDBusConnection* GetConnection();
DBusConnection* GetConnection();
private:
void OnFileCanReadWithoutBlocking(int aFd);
@ -42,7 +40,7 @@ private:
MessageLoopForIO::FileDescriptorWatcher mWriteWatcher;
// DBus structures
RawDBusConnection* mConnection;
DBusConnection* mConnection;
DBusWatch* mWatch;
};

View File

@ -110,7 +110,7 @@ bool RawDBusConnection::Watch()
DBusWatcher::AddWatchFunction,
DBusWatcher::RemoveWatchFunction,
DBusWatcher::ToggleWatchFunction,
this, nullptr);
this->GetConnection(), nullptr);
NS_ENSURE_TRUE(success == TRUE, false);
return true;