Bug 878745 - BluetoothService cleanup, r=echou

This commit is contained in:
Gina Yeh 2013-06-10 12:18:00 +08:00
parent 93c97c6d9b
commit ea0fa55fff
6 changed files with 592 additions and 783 deletions

View File

@ -820,3 +820,13 @@ BluetoothService::Notify(const BluetoothSignal& aData)
systemMessenger->BroadcastMessage(oldType, OBJECT_TO_JSVAL(obj));
}
}
void
BluetoothService::DispatchToCommandThread(nsRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aRunnable);
MOZ_ASSERT(mBluetoothCommandThread);
mBluetoothCommandThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
}

View File

@ -158,16 +158,6 @@ public:
virtual nsresult
StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) = 0;
/**
* Fetches the propertes for the specified device
*
* @param aSignal BluetoothSignal to be distrubuted after retrieving device properties
*
* @return NS_OK on function run, NS_ERROR_FAILURE otherwise
*/
virtual nsresult
GetDevicePropertiesInternal(const BluetoothSignal& aSignal) = 0;
/**
* Set a property for the specified object
*
@ -246,9 +236,6 @@ public:
SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow,
BluetoothReplyRunnable* aRunnable) = 0;
virtual nsresult
PrepareAdapterInternal() = 0;
virtual void
Connect(const nsAString& aDeviceAddress,
uint16_t aProfileId,
@ -299,6 +286,9 @@ public:
void
RemoveObserverFromTable(const nsAString& key);
void
DispatchToCommandThread(nsRunnable* aRunnable);
protected:
BluetoothService()
: mEnabled(false)

View File

@ -102,14 +102,6 @@ BluetoothServiceChildProcess::GetDefaultAdapterPathInternal(
return NS_OK;
}
nsresult
BluetoothServiceChildProcess::GetDevicePropertiesInternal(
const BluetoothSignal& aSignal)
{
MOZ_NOT_REACHED("Should never be called from child");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
BluetoothServiceChildProcess::GetConnectedDevicePropertiesInternal(
uint16_t aProfileId,
@ -277,13 +269,6 @@ BluetoothServiceChildProcess::SetAuthorizationInternal(
return true;
}
nsresult
BluetoothServiceChildProcess::PrepareAdapterInternal()
{
MOZ_NOT_REACHED("Should never be called from child");
return NS_ERROR_NOT_IMPLEMENTED;
}
void
BluetoothServiceChildProcess::Connect(
const nsAString& aDeviceAddress,

View File

@ -185,14 +185,6 @@ private:
virtual bool
IsEnabledInternal() MOZ_OVERRIDE;
// Should never be called from the child
virtual nsresult
GetDevicePropertiesInternal(const BluetoothSignal& aSignal) MOZ_OVERRIDE;
// This method should never be called from the child.
virtual nsresult
PrepareAdapterInternal() MOZ_OVERRIDE;
bool
IsSignalRegistered(const nsAString& aNodeName) {
return !!mBluetoothSignalObserverTable.Get(aNodeName);

File diff suppressed because it is too large Load Diff

View File

@ -47,9 +47,6 @@ public:
virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
virtual nsresult
GetDevicePropertiesInternal(const BluetoothSignal& aSignal) MOZ_OVERRIDE;
virtual nsresult
SetProperty(BluetoothObjectType aType,
const BluetoothNamedValue& aValue,
@ -119,9 +116,6 @@ public:
SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow,
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
virtual nsresult
PrepareAdapterInternal() MOZ_OVERRIDE;
virtual void
Connect(const nsAString& aDeviceAddress,
const uint16_t aProfileId,