mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-06 08:40:56 +00:00
Bug 1123651: Inherit |NfcConsumer| from |StreamSocket|, r=allstars.chh
With this patch, |NfcConsumer| inherits from |StreamSocket| instead of |UnixSocketConsumer|. Some methods have been renamed. |NfcConsumer| now contains the method |GetIO|, which is required by |StreamSocket| for integration with |ListenSocket|.
This commit is contained in:
parent
0215081264
commit
5cbe35fbd5
@ -22,6 +22,7 @@
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/ipc/UnixSocketConnector.h"
|
||||
#include "nsThreadUtils.h" // For NS_IsMainThread.
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
@ -172,7 +173,7 @@ NfcConsumer::NfcConsumer(NfcSocketListener* aListener)
|
||||
{
|
||||
mAddress = NFC_SOCKET_NAME;
|
||||
|
||||
ConnectSocket(new NfcConnector(), mAddress.get());
|
||||
Connect(new NfcConnector(), mAddress.get());
|
||||
}
|
||||
|
||||
void
|
||||
@ -181,7 +182,7 @@ NfcConsumer::Shutdown()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mShutdown = true;
|
||||
CloseSocket();
|
||||
Close();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -216,7 +217,7 @@ void
|
||||
NfcConsumer::OnConnectError()
|
||||
{
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
CloseSocket();
|
||||
Close();
|
||||
}
|
||||
|
||||
void
|
||||
@ -224,10 +225,15 @@ NfcConsumer::OnDisconnect()
|
||||
{
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
if (!mShutdown) {
|
||||
ConnectSocket(new NfcConnector(), mAddress.get(),
|
||||
GetSuggestedConnectDelayMs());
|
||||
Connect(new NfcConnector(), mAddress.get(), GetSuggestedConnectDelayMs());
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionOrientedSocketIO*
|
||||
NfcConsumer::GetIO()
|
||||
{
|
||||
return PrepareAccept(new NfcConnector());
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef mozilla_ipc_Nfc_h
|
||||
#define mozilla_ipc_Nfc_h 1
|
||||
|
||||
#include <mozilla/ipc/UnixSocket.h>
|
||||
#include <mozilla/ipc/StreamSocket.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
@ -20,7 +20,7 @@ public:
|
||||
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData) = 0;
|
||||
};
|
||||
|
||||
class NfcConsumer MOZ_FINAL : public mozilla::ipc::UnixSocketConsumer
|
||||
class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
|
||||
{
|
||||
public:
|
||||
NfcConsumer(NfcSocketListener* aListener);
|
||||
@ -28,6 +28,8 @@ public:
|
||||
void Shutdown();
|
||||
bool PostToNfcDaemon(const uint8_t* aData, size_t aSize);
|
||||
|
||||
ConnectionOrientedSocketIO* GetIO() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
void ReceiveSocketData(
|
||||
nsAutoPtr<UnixSocketRawData>& aData) MOZ_OVERRIDE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user