From f7fb883ca89e5de0f6ad0edc465c315e28bcedc3 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sat, 25 Aug 2012 12:33:51 -0400 Subject: [PATCH] Bug 785583 - BluetoothReplyRunnable instantiates nsAutoPtr template in the header r=qdot --- dom/bluetooth/BluetoothManager.cpp | 1 + dom/bluetooth/BluetoothReplyRunnable.cpp | 28 ++++++++++++++++++ dom/bluetooth/BluetoothReplyRunnable.h | 36 +++++++----------------- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/dom/bluetooth/BluetoothManager.cpp b/dom/bluetooth/BluetoothManager.cpp index d41375b5468d..7639e396700a 100644 --- a/dom/bluetooth/BluetoothManager.cpp +++ b/dom/bluetooth/BluetoothManager.cpp @@ -21,6 +21,7 @@ #include "nsXPCOMCIDInternal.h" #include "mozilla/LazyIdleThread.h" #include "mozilla/Util.h" +#include "nsIDOMDOMRequest.h" using namespace mozilla; diff --git a/dom/bluetooth/BluetoothReplyRunnable.cpp b/dom/bluetooth/BluetoothReplyRunnable.cpp index cdd59d544a08..385b2e1a1946 100644 --- a/dom/bluetooth/BluetoothReplyRunnable.cpp +++ b/dom/bluetooth/BluetoothReplyRunnable.cpp @@ -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() +{} + diff --git a/dom/bluetooth/BluetoothReplyRunnable.h b/dom/bluetooth/BluetoothReplyRunnable.h index bf55e0255e25..6a5d906aea09 100644 --- a/dom/bluetooth/BluetoothReplyRunnable.h +++ b/dom/bluetooth/BluetoothReplyRunnable.h @@ -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 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) {