Bug 785583 - BluetoothReplyRunnable instantiates nsAutoPtr template in the header r=qdot

This commit is contained in:
David Zbarsky 2012-08-25 12:33:51 -04:00
parent 5f0b208a77
commit f7fb883ca8
3 changed files with 39 additions and 26 deletions

View File

@ -21,6 +21,7 @@
#include "nsXPCOMCIDInternal.h"
#include "mozilla/LazyIdleThread.h"
#include "mozilla/Util.h"
#include "nsIDOMDOMRequest.h"
using namespace mozilla;

View File

@ -7,9 +7,29 @@
#include "base/basictypes.h"
#include "BluetoothTypes.h"
#include "BluetoothReplyRunnable.h"
#include "nsIDOMDOMRequest.h"
USING_BLUETOOTH_NAMESPACE
BluetoothReplyRunnable::BluetoothReplyRunnable(nsIDOMDOMRequest* aReq)
: mDOMRequest(aReq)
{}
void
BluetoothReplyRunnable::SetReply(BluetoothReply* aReply)
{
mReply = aReply;
}
void
BluetoothReplyRunnable::ReleaseMembers()
{
mDOMRequest = nullptr;
}
BluetoothReplyRunnable::~BluetoothReplyRunnable()
{}
nsresult
BluetoothReplyRunnable::FireReply(const jsval& aVal)
{
@ -72,3 +92,11 @@ BluetoothReplyRunnable::Run()
return rv;
}
BluetoothVoidReplyRunnable::BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq)
: BluetoothReplyRunnable(aReq)
{}
BluetoothVoidReplyRunnable::~BluetoothVoidReplyRunnable()
{}

View File

@ -9,9 +9,10 @@
#include "BluetoothCommon.h"
#include "nsThreadUtils.h"
#include "nsIDOMDOMRequest.h"
#include "jsapi.h"
class nsIDOMDOMRequest;
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothReply;
@ -21,31 +22,20 @@ class BluetoothReplyRunnable : public nsRunnable
public:
NS_DECL_NSIRUNNABLE
BluetoothReplyRunnable(nsIDOMDOMRequest* aReq) :
mDOMRequest(aReq)
{
}
BluetoothReplyRunnable(nsIDOMDOMRequest* aReq);
void SetReply(BluetoothReply* aReply)
{
mReply = aReply;
}
void SetReply(BluetoothReply* aReply);
void SetError(const nsAString& aError)
{
mErrorString = aError;
}
virtual void ReleaseMembers()
{
mDOMRequest = nullptr;
}
virtual void ReleaseMembers();
protected:
virtual ~BluetoothReplyRunnable()
{
}
virtual ~BluetoothReplyRunnable();
virtual bool ParseSuccessfulReply(jsval* aValue) = 0;
// This is an autoptr so we don't have to bring the ipdl include into the
@ -56,7 +46,7 @@ protected:
private:
nsresult FireReply(const jsval& aVal);
nsresult FireErrorString();
nsCOMPtr<nsIDOMDOMRequest> mDOMRequest;
nsString mErrorString;
};
@ -64,15 +54,9 @@ private:
class BluetoothVoidReplyRunnable : public BluetoothReplyRunnable
{
public:
BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq) :
BluetoothReplyRunnable(aReq)
{
}
BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq);
~BluetoothVoidReplyRunnable();
virtual void ReleaseMembers()
{
BluetoothReplyRunnable::ReleaseMembers();
}
protected:
virtual bool ParseSuccessfulReply(jsval* aValue)
{