Bug 785583 - BluetoothReplyRunnable instantiates nsAutoPtr template in the header r=qdot
authorDavid Zbarsky <dzbarsky@gmail.com>
Sat, 25 Aug 2012 12:33:51 -0400
changeset 103437 f7e7a78f6ff4bdaadeeb944a632ce16bb62dbc26
parent 103436 7112cff6bdbf958f12f9c49ea0911c02c866cd73
child 103438 4a40ae179ea2d665a48979b7daaf741edcc54982
push id23348
push userryanvm@gmail.com
push dateSun, 26 Aug 2012 02:09:16 +0000
treeherdermozilla-central@b3cce81fef1a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs785583
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 785583 - BluetoothReplyRunnable instantiates nsAutoPtr template in the header r=qdot
dom/bluetooth/BluetoothManager.cpp
dom/bluetooth/BluetoothReplyRunnable.cpp
dom/bluetooth/BluetoothReplyRunnable.h
--- a/dom/bluetooth/BluetoothManager.cpp
+++ b/dom/bluetooth/BluetoothManager.cpp
@@ -16,16 +16,17 @@
 #include "nsIDOMDOMRequest.h"
 #include "nsIPermissionManager.h"
 #include "nsDOMClassInfo.h"
 #include "nsDOMEvent.h"
 #include "nsThreadUtils.h"
 #include "nsXPCOMCIDInternal.h"
 #include "mozilla/LazyIdleThread.h"
 #include "mozilla/Util.h"
+#include "nsIDOMDOMRequest.h"
 
 using namespace mozilla;
 
 USING_BLUETOOTH_NAMESPACE
 
 DOMCI_DATA(BluetoothManager, BluetoothManager)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(BluetoothManager)
--- a/dom/bluetooth/BluetoothReplyRunnable.cpp
+++ b/dom/bluetooth/BluetoothReplyRunnable.cpp
@@ -2,19 +2,39 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #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)
 {
   nsCOMPtr<nsIDOMRequestService> rs =
     do_GetService("@mozilla.org/dom/dom-request-service;1");
   
   if (!rs) {
     NS_WARNING("No DOMRequest Service!");
@@ -67,8 +87,16 @@ BluetoothReplyRunnable::Run()
 
   ReleaseMembers();
   if (mDOMRequest) {
     NS_WARNING("mDOMRequest still alive! Deriving class should call BluetoothReplyRunnable::ReleaseMembers()!");
   }
 
   return rv;
 }
+
+BluetoothVoidReplyRunnable::BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq)
+  : BluetoothReplyRunnable(aReq)
+{}
+
+BluetoothVoidReplyRunnable::~BluetoothVoidReplyRunnable()
+{}
+
--- a/dom/bluetooth/BluetoothReplyRunnable.h
+++ b/dom/bluetooth/BluetoothReplyRunnable.h
@@ -4,80 +4,64 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_bluetooth_bluetoothreplyrunnable_h__
 #define mozilla_dom_bluetooth_bluetoothreplyrunnable_h__
 
 #include "BluetoothCommon.h"
 #include "nsThreadUtils.h"
-#include "nsIDOMDOMRequest.h"
 #include "jsapi.h"
 
+class nsIDOMDOMRequest;
+
 BEGIN_BLUETOOTH_NAMESPACE
 
 class BluetoothReply;
 
 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
   // header. We assume we'll only be running this once and it should die on
   // scope out of Run() anyways.
   nsAutoPtr<BluetoothReply> mReply;
 
 private:
   nsresult FireReply(const jsval& aVal);
   nsresult FireErrorString();
-  
+
   nsCOMPtr<nsIDOMDOMRequest> mDOMRequest;
   nsString mErrorString;
 };
 
 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)
   {
     *aValue = JSVAL_VOID;
     return true;
   }
 };