From 89907aac54fdf704ff07260285ec0e1c3d3cc56a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 11 Mar 2015 03:33:00 -0400 Subject: [PATCH] Bug 1109592 - Move |NfcConnector| to a more public place. r=allstars.chh |NfcConnector| is required to listen for connections from within |NfcService|. This patch makes it available. --- ipc/nfc/Nfc.cpp | 30 ++++++++++-------------------- ipc/nfc/Nfc.h | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ipc/nfc/Nfc.cpp b/ipc/nfc/Nfc.cpp index 01e360b4e33..9f398c76ee5 100644 --- a/ipc/nfc/Nfc.cpp +++ b/ipc/nfc/Nfc.cpp @@ -22,7 +22,6 @@ #include "jsfriendapi.h" #include "mozilla/ArrayUtils.h" -#include "mozilla/ipc/UnixSocketConnector.h" #include "nsThreadUtils.h" // For NS_IsMainThread. using namespace mozilla::ipc; @@ -62,22 +61,14 @@ private: nsAutoPtr mRawData; }; -class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector -{ -public: - NfcConnector() - { } +} // anonymous namespace - int Create() MOZ_OVERRIDE; - bool CreateAddr(bool aIsServer, - socklen_t& aAddrSize, - sockaddr_any& aAddr, - const char* aAddress) MOZ_OVERRIDE; - bool SetUp(int aFd) MOZ_OVERRIDE; - bool SetUpListenSocket(int aFd) MOZ_OVERRIDE; - void GetSocketAddr(const sockaddr_any& aAddr, - nsAString& aAddrStr) MOZ_OVERRIDE; -}; +namespace mozilla { +namespace ipc { + +// +// NfcConnector +// int NfcConnector::Create() @@ -162,10 +153,9 @@ NfcConnector::GetSocketAddr(const sockaddr_any& aAddr, MOZ_CRASH("This should never be called!"); } -} // anonymous namespace - -namespace mozilla { -namespace ipc { +// +// NfcConsumer +// NfcConsumer::NfcConsumer(NfcSocketListener* aListener) : mListener(aListener) diff --git a/ipc/nfc/Nfc.h b/ipc/nfc/Nfc.h index 3a88101789d..53759ba1d4c 100644 --- a/ipc/nfc/Nfc.h +++ b/ipc/nfc/Nfc.h @@ -10,6 +10,7 @@ #define mozilla_ipc_Nfc_h 1 #include +#include namespace mozilla { namespace ipc { @@ -28,6 +29,23 @@ public: virtual void OnDisconnect(enum SocketType aSocketType) = 0; }; +class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector +{ +public: + NfcConnector() + { } + + int Create() MOZ_OVERRIDE; + bool CreateAddr(bool aIsServer, + socklen_t& aAddrSize, + sockaddr_any& aAddr, + const char* aAddress) MOZ_OVERRIDE; + bool SetUp(int aFd) MOZ_OVERRIDE; + bool SetUpListenSocket(int aFd) MOZ_OVERRIDE; + void GetSocketAddr(const sockaddr_any& aAddr, + nsAString& aAddrStr) MOZ_OVERRIDE; +}; + class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket { public: