Bug 913343 - Rename ReplyRunnable -> FMRadioReplyRunnable. r=khuey
authorpzhang <pzhang@mozilla.com>
Fri, 30 Aug 2013 14:16:49 +0800
changeset 146375 16af6a5074b4506465a679c49d2f50d74f0eb03b
parent 146374 38d48d8323e3e8cc00bf4f5e23465109fb367442
child 146376 6a8d3277faaf0a7dcc073075e8b3a14e9651153d
push id25257
push userryanvm@gmail.com
push dateTue, 10 Sep 2013 20:35:43 +0000
treeherdermozilla-central@ce127f081ebf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs913343
milestone26.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 913343 - Rename ReplyRunnable -> FMRadioReplyRunnable. r=khuey
dom/fmradio/FMRadio.cpp
dom/fmradio/FMRadioService.cpp
dom/fmradio/FMRadioService.h
dom/fmradio/ipc/FMRadioChild.cpp
dom/fmradio/ipc/FMRadioChild.h
dom/fmradio/ipc/FMRadioRequestChild.cpp
dom/fmradio/ipc/FMRadioRequestChild.h
dom/fmradio/ipc/FMRadioRequestParent.h
--- a/dom/fmradio/FMRadio.cpp
+++ b/dom/fmradio/FMRadio.cpp
@@ -22,17 +22,17 @@
 // If the pref is true, the antanna will be always available.
 #define DOM_FM_ANTENNA_INTERNAL_PREF "dom.fmradio.antenna.internal"
 
 using namespace mozilla::hal;
 using mozilla::Preferences;
 
 BEGIN_FMRADIO_NAMESPACE
 
-class FMRadioRequest MOZ_FINAL : public ReplyRunnable
+class FMRadioRequest MOZ_FINAL : public FMRadioReplyRunnable
                                , public DOMRequest
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   FMRadioRequest(nsPIDOMWindow* aWindow, FMRadio* aFMRadio)
     : DOMRequest(aWindow)
   {
--- a/dom/fmradio/FMRadioService.cpp
+++ b/dom/fmradio/FMRadioService.cpp
@@ -142,17 +142,17 @@ private:
  * Read the airplane-mode setting, if the airplane-mode is not enabled, we
  * enable the FM radio.
  */
 class ReadRilSettingTask MOZ_FINAL : public nsISettingsServiceCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
-  ReadRilSettingTask(nsRefPtr<ReplyRunnable> aPendingRequest)
+  ReadRilSettingTask(nsRefPtr<FMRadioReplyRunnable> aPendingRequest)
     : mPendingRequest(aPendingRequest) { }
 
   NS_IMETHOD
   Handle(const nsAString& aName, const JS::Value& aResult)
   {
     FMRadioService* fmRadioService = FMRadioService::Singleton();
     MOZ_ASSERT(mPendingRequest == fmRadioService->mPendingRequest);
 
@@ -189,17 +189,17 @@ public:
 
     fmRadioService->TransitionState(ErrorResponse(
       NS_LITERAL_STRING("Unexpected error")), Disabled);
 
     return NS_OK;
   }
 
 private:
-  nsRefPtr<ReplyRunnable> mPendingRequest;
+  nsRefPtr<FMRadioReplyRunnable> mPendingRequest;
 };
 
 NS_IMPL_ISUPPORTS1(ReadRilSettingTask, nsISettingsServiceCallback)
 
 class DisableRunnable MOZ_FINAL : public nsRunnable
 {
 public:
   DisableRunnable() { }
@@ -370,17 +370,18 @@ FMRadioService::GetFrequencyLowerBound()
 double
 FMRadioService::GetChannelWidth() const
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   return mChannelWidthInKHz / 1000.0;
 }
 
 void
-FMRadioService::Enable(double aFrequencyInMHz, ReplyRunnable* aReplyRunnable)
+FMRadioService::Enable(double aFrequencyInMHz,
+                       FMRadioReplyRunnable* aReplyRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   MOZ_ASSERT(aReplyRunnable);
 
   switch (mState) {
     case Seeking:
     case Enabled:
       aReplyRunnable->SetReply(
@@ -450,21 +451,21 @@ FMRadioService::Enable(double aFrequency
   }
 
   NS_DispatchToMainThread(new EnableRunnable(mUpperBoundInKHz,
                                              mLowerBoundInKHz,
                                              mChannelWidthInKHz));
 }
 
 void
-FMRadioService::Disable(ReplyRunnable* aReplyRunnable)
+FMRadioService::Disable(FMRadioReplyRunnable* aReplyRunnable)
 {
   // When airplane-mode is enabled, we will call this function from
-  // FMRadioService::Observe without passing a ReplyRunnable, so we have to
-  // check if |aReplyRunnable| is null before we dispatch it.
+  // FMRadioService::Observe without passing a FMRadioReplyRunnable,
+  // so we have to check if |aReplyRunnable| is null before we dispatch it.
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
   switch (mState) {
     case Disabling:
       if (aReplyRunnable) {
         aReplyRunnable->SetReply(
           ErrorResponse(NS_LITERAL_STRING("FM radio currently disabling")));
         NS_DispatchToMainThread(aReplyRunnable);
@@ -478,17 +479,17 @@ FMRadioService::Disable(ReplyRunnable* a
       }
       return;
     case Enabled:
     case Enabling:
     case Seeking:
       break;
   }
 
-  nsRefPtr<ReplyRunnable> enablingRequest = mPendingRequest;
+  nsRefPtr<FMRadioReplyRunnable> enablingRequest = mPendingRequest;
 
   // If the FM Radio is currently seeking, no fail-to-seek or similar
   // event will be fired, execute the seek callback manually.
   if (mState == Seeking) {
     TransitionState(ErrorResponse(
       NS_LITERAL_STRING("Seek action is cancelled")), Disabling);
   }
 
@@ -531,17 +532,17 @@ FMRadioService::DoDisable()
   //    };
   // we need to call hal::DisableFMRadio() asynchronously. Same reason for
   // EnableRunnable and SetFrequencyRunnable.
   NS_DispatchToMainThread(new DisableRunnable());
 }
 
 void
 FMRadioService::SetFrequency(double aFrequencyInMHz,
-                             ReplyRunnable* aReplyRunnable)
+                             FMRadioReplyRunnable* aReplyRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   MOZ_ASSERT(aReplyRunnable);
 
   switch (mState) {
     case Disabled:
       aReplyRunnable->SetReply(
         ErrorResponse(NS_LITERAL_STRING("FM radio currently disabled")));
@@ -578,17 +579,17 @@ FMRadioService::SetFrequency(double aFre
   NS_DispatchToMainThread(new SetFrequencyRunnable(roundedFrequency));
 
   aReplyRunnable->SetReply(SuccessResponse());
   NS_DispatchToMainThread(aReplyRunnable);
 }
 
 void
 FMRadioService::Seek(FMRadioSeekDirection aDirection,
-                     ReplyRunnable* aReplyRunnable)
+                     FMRadioReplyRunnable* aReplyRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   MOZ_ASSERT(aReplyRunnable);
 
   switch (mState) {
     case Enabling:
       aReplyRunnable->SetReply(
         ErrorResponse(NS_LITERAL_STRING("FM radio currently enabling")));
@@ -615,17 +616,17 @@ FMRadioService::Seek(FMRadioSeekDirectio
 
   SetState(Seeking);
   mPendingRequest = aReplyRunnable;
 
   NS_DispatchToMainThread(new SeekRunnable(aDirection));
 }
 
 void
-FMRadioService::CancelSeek(ReplyRunnable* aReplyRunnable)
+FMRadioService::CancelSeek(FMRadioReplyRunnable* aReplyRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   MOZ_ASSERT(aReplyRunnable);
 
   // We accept canceling seek request only if it's currently seeking.
   if (mState != Seeking) {
     aReplyRunnable->SetReply(
       ErrorResponse(NS_LITERAL_STRING("FM radio currently not seeking")));
--- a/dom/fmradio/FMRadioService.h
+++ b/dom/fmradio/FMRadioService.h
@@ -13,21 +13,21 @@
 #include "mozilla/StaticPtr.h"
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
 #include "nsIObserver.h"
 #include "nsXULAppAPI.h"
 
 BEGIN_FMRADIO_NAMESPACE
 
-class ReplyRunnable : public nsRunnable
+class FMRadioReplyRunnable : public nsRunnable
 {
 public:
-  ReplyRunnable() : mResponseType(SuccessResponse()) {}
-  virtual ~ReplyRunnable() {}
+  FMRadioReplyRunnable() : mResponseType(SuccessResponse()) {}
+  virtual ~FMRadioReplyRunnable() {}
 
   void
   SetReply(const FMRadioResponseType& aResponseType)
   {
     mResponseType = aResponseType;
   }
 
 protected:
@@ -48,26 +48,26 @@ protected:
  * All the requests coming from the content page will be redirected to the
  * concrete class object.
  *
  * Consider navigator.mozFMRadio.enable(). Here is the call sequence:
  *  - OOP
  *    Child:
  *      (1) Call navigator.mozFMRadio.enable().
  *      (2) Return a DOMRequest object, and call FMRadioChild.Enable() with a
- *          ReplyRunnable object.
+ *          FMRadioReplyRunnable object.
  *      (3) Send IPC message to main process.
  *    Parent:
- *      (4) Call FMRadioService::Enable() with a ReplyRunnable object.
+ *      (4) Call FMRadioService::Enable() with a FMRadioReplyRunnable object.
  *      (5) Call hal::EnableFMRadio().
  *      (6) Notify FMRadioService object when FM radio HW is enabled.
- *      (7) Dispatch the ReplyRunnable object created in (4).
+ *      (7) Dispatch the FMRadioReplyRunnable object created in (4).
  *      (8) Send IPC message back to child process.
  *    Child:
- *      (9) Dispatch the ReplyRunnable object created in (2).
+ *      (9) Dispatch the FMRadioReplyRunnable object created in (2).
  *     (10) Fire success callback of the DOMRequest Object created in (2).
  *                     _ _ _ _ _ _ _ _ _ _ _ _ _ _
  *                    |            OOP            |
  *                    |                           |
  *   Page  FMRadio    |    FMRadioChild       IPC |    FMRadioService   Hal
  *    | (1)  |        |          |             |  |           |          |
  *    |----->|    (2) |          |             |  |           |          |
  *    |      |--------|--------->|      (3)    |  |           |          |
@@ -95,22 +95,22 @@ protected:
 
 public:
   virtual bool IsEnabled() const = 0;
   virtual double GetFrequency() const = 0;
   virtual double GetFrequencyUpperBound() const = 0;
   virtual double GetFrequencyLowerBound() const = 0;
   virtual double GetChannelWidth() const = 0;
 
-  virtual void Enable(double aFrequency, ReplyRunnable* aReplyRunnable) = 0;
-  virtual void Disable(ReplyRunnable* aReplyRunnable) = 0;
-  virtual void SetFrequency(double aFrequency, ReplyRunnable* aReplyRunnable) = 0;
+  virtual void Enable(double aFrequency, FMRadioReplyRunnable* aReplyRunnable) = 0;
+  virtual void Disable(FMRadioReplyRunnable* aReplyRunnable) = 0;
+  virtual void SetFrequency(double aFrequency, FMRadioReplyRunnable* aReplyRunnable) = 0;
   virtual void Seek(mozilla::hal::FMRadioSeekDirection aDirection,
-                    ReplyRunnable* aReplyRunnable) = 0;
-  virtual void CancelSeek(ReplyRunnable* aReplyRunnable) = 0;
+                    FMRadioReplyRunnable* aReplyRunnable) = 0;
+  virtual void CancelSeek(FMRadioReplyRunnable* aReplyRunnable) = 0;
 
   /**
    * Register handler to receive the FM Radio events, including:
    *   - StateChangedEvent
    *   - FrequencyChangedEvent
    *
    * Called by FMRadio and FMRadioParent.
    */
@@ -147,22 +147,24 @@ public:
   NS_DECL_ISUPPORTS
 
   virtual bool IsEnabled() const MOZ_OVERRIDE;
   virtual double GetFrequency() const MOZ_OVERRIDE;
   virtual double GetFrequencyUpperBound() const MOZ_OVERRIDE;
   virtual double GetFrequencyLowerBound() const MOZ_OVERRIDE;
   virtual double GetChannelWidth() const MOZ_OVERRIDE;
 
-  virtual void Enable(double aFrequency, ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
-  virtual void Disable(ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
-  virtual void SetFrequency(double aFrequency, ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void Enable(double aFrequency,
+                      FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void Disable(FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void SetFrequency(double aFrequency,
+                            FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
   virtual void Seek(mozilla::hal::FMRadioSeekDirection aDirection,
-                    ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
-  virtual void CancelSeek(ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+                    FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void CancelSeek(FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
 
   virtual void AddObserver(FMRadioEventObserver* aObserver) MOZ_OVERRIDE;
   virtual void RemoveObserver(FMRadioEventObserver* aObserver) MOZ_OVERRIDE;
 
   /* FMRadioObserver */
   void Notify(const hal::FMRadioOperationInformation& aInfo) MOZ_OVERRIDE;
 
   NS_DECL_NSIOBSERVER
@@ -189,17 +191,17 @@ private:
 
   bool mHasReadRilSetting;
   bool mRilDisabled;
 
   double mUpperBoundInKHz;
   double mLowerBoundInKHz;
   double mChannelWidthInKHz;
 
-  nsRefPtr<ReplyRunnable> mPendingRequest;
+  nsRefPtr<FMRadioReplyRunnable> mPendingRequest;
 
   FMRadioEventObserverList mObserverList;
 
   static StaticRefPtr<FMRadioService> sFMRadioService;
 };
 
 END_FMRADIO_NAMESPACE
 
--- a/dom/fmradio/ipc/FMRadioChild.cpp
+++ b/dom/fmradio/ipc/FMRadioChild.cpp
@@ -65,42 +65,43 @@ FMRadioChild::GetFrequencyLowerBound() c
 
 double
 FMRadioChild::GetChannelWidth() const
 {
   return mChannelWidth;
 }
 
 void
-FMRadioChild::Enable(double aFrequency, ReplyRunnable* aReplyRunnable)
+FMRadioChild::Enable(double aFrequency, FMRadioReplyRunnable* aReplyRunnable)
 {
   SendRequest(aReplyRunnable, EnableRequestArgs(aFrequency));
 }
 
 void
-FMRadioChild::Disable(ReplyRunnable* aReplyRunnable)
+FMRadioChild::Disable(FMRadioReplyRunnable* aReplyRunnable)
 {
   SendRequest(aReplyRunnable, DisableRequestArgs());
 }
 
 void
 FMRadioChild::SetFrequency(double aFrequency,
-                                  ReplyRunnable* aReplyRunnable)
+                           FMRadioReplyRunnable* aReplyRunnable)
 {
   SendRequest(aReplyRunnable, SetFrequencyRequestArgs(aFrequency));
 }
 
 void
-FMRadioChild::Seek(FMRadioSeekDirection aDirection, ReplyRunnable* aReplyRunnable)
+FMRadioChild::Seek(FMRadioSeekDirection aDirection,
+                   FMRadioReplyRunnable* aReplyRunnable)
 {
   SendRequest(aReplyRunnable, SeekRequestArgs(aDirection));
 }
 
 void
-FMRadioChild::CancelSeek(ReplyRunnable* aReplyRunnable)
+FMRadioChild::CancelSeek(FMRadioReplyRunnable* aReplyRunnable)
 {
   SendRequest(aReplyRunnable, CancelSeekRequestArgs());
 }
 
 inline void
 FMRadioChild::NotifyFMRadioEvent(FMRadioEventType aType)
 {
   mObserverList.Broadcast(aType);
@@ -114,18 +115,18 @@ FMRadioChild::AddObserver(FMRadioEventOb
 
 void
 FMRadioChild::RemoveObserver(FMRadioEventObserver* aObserver)
 {
   mObserverList.RemoveObserver(aObserver);
 }
 
 void
-FMRadioChild::SendRequest(ReplyRunnable* aReplyRunnable,
-                                 FMRadioRequestArgs aArgs)
+FMRadioChild::SendRequest(FMRadioReplyRunnable* aReplyRunnable,
+                          FMRadioRequestArgs aArgs)
 {
   PFMRadioRequestChild* childRequest = new FMRadioRequestChild(aReplyRunnable);
   SendPFMRadioRequestConstructor(childRequest, aArgs);
 }
 
 bool
 FMRadioChild::RecvNotifyFrequencyChanged(const double& aFrequency)
 {
--- a/dom/fmradio/ipc/FMRadioChild.h
+++ b/dom/fmradio/ipc/FMRadioChild.h
@@ -24,32 +24,34 @@ BEGIN_FMRADIO_NAMESPACE
  */
 class FMRadioChild MOZ_FINAL : public IFMRadioService
                              , public PFMRadioChild
 {
 public:
   static FMRadioChild* Singleton();
   ~FMRadioChild();
 
-  void SendRequest(ReplyRunnable* aReplyRunnable, FMRadioRequestArgs aArgs);
+  void SendRequest(FMRadioReplyRunnable* aReplyRunnable,
+                   FMRadioRequestArgs aArgs);
 
   /* IFMRadioService */
   virtual bool IsEnabled() const MOZ_OVERRIDE;
   virtual double GetFrequency() const MOZ_OVERRIDE;
   virtual double GetFrequencyUpperBound() const MOZ_OVERRIDE;
   virtual double GetFrequencyLowerBound() const MOZ_OVERRIDE;
   virtual double GetChannelWidth() const MOZ_OVERRIDE;
 
-  virtual void Enable(double aFrequency, ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
-  virtual void Disable(ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void Enable(double aFrequency,
+                      FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void Disable(FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
   virtual void SetFrequency(double frequency,
-                            ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+                            FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
   virtual void Seek(mozilla::hal::FMRadioSeekDirection aDirection,
-                    ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
-  virtual void CancelSeek(ReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+                    FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
+  virtual void CancelSeek(FMRadioReplyRunnable* aReplyRunnable) MOZ_OVERRIDE;
 
   virtual void AddObserver(FMRadioEventObserver* aObserver) MOZ_OVERRIDE;
   virtual void RemoveObserver(FMRadioEventObserver* aObserver) MOZ_OVERRIDE;
 
   /* PFMRadioChild */
   virtual bool
   Recv__delete__() MOZ_OVERRIDE;
 
--- a/dom/fmradio/ipc/FMRadioRequestChild.cpp
+++ b/dom/fmradio/ipc/FMRadioRequestChild.cpp
@@ -4,17 +4,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/PFMRadioRequestChild.h"
 #include "FMRadioRequestChild.h"
 #include "FMRadioService.h"
 
 BEGIN_FMRADIO_NAMESPACE
 
-FMRadioRequestChild::FMRadioRequestChild(ReplyRunnable* aReplyRunnable)
+FMRadioRequestChild::FMRadioRequestChild(FMRadioReplyRunnable* aReplyRunnable)
   : mReplyRunnable(aReplyRunnable)
 {
   MOZ_COUNT_CTOR(FMRadioRequestChild);
 }
 
 FMRadioRequestChild::~FMRadioRequestChild()
 {
   MOZ_COUNT_DTOR(FMRadioRequestChild);
--- a/dom/fmradio/ipc/FMRadioRequestChild.h
+++ b/dom/fmradio/ipc/FMRadioRequestChild.h
@@ -8,27 +8,27 @@
 #define mozilla_dom_fmradiorequestchild_h__
 
 #include "FMRadioCommon.h"
 #include "mozilla/dom/PFMRadioRequestChild.h"
 #include "DOMRequest.h"
 
 BEGIN_FMRADIO_NAMESPACE
 
-class ReplyRunnable;
+class FMRadioReplyRunnable;
 
 class FMRadioRequestChild MOZ_FINAL : public PFMRadioRequestChild
 {
 public:
-  FMRadioRequestChild(ReplyRunnable* aReplyRunnable);
+  FMRadioRequestChild(FMRadioReplyRunnable* aReplyRunnable);
   ~FMRadioRequestChild();
 
   virtual bool
   Recv__delete__(const FMRadioResponseType& aResponse) MOZ_OVERRIDE;
 
 private:
-  nsRefPtr<ReplyRunnable> mReplyRunnable;
+  nsRefPtr<FMRadioReplyRunnable> mReplyRunnable;
 };
 
 END_FMRADIO_NAMESPACE
 
 #endif // mozilla_dom_fmradiorequestchild_h__
 
--- a/dom/fmradio/ipc/FMRadioRequestParent.h
+++ b/dom/fmradio/ipc/FMRadioRequestParent.h
@@ -9,17 +9,17 @@
 
 #include "FMRadioCommon.h"
 #include "mozilla/dom/PFMRadioRequestParent.h"
 #include "FMRadioService.h"
 
 BEGIN_FMRADIO_NAMESPACE
 
 class FMRadioRequestParent MOZ_FINAL : public PFMRadioRequestParent
-                                     , public ReplyRunnable
+                                     , public FMRadioReplyRunnable
 {
 public:
   FMRadioRequestParent();
   ~FMRadioRequestParent();
 
   virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
   NS_IMETHOD Run();