Bug 975688 part.21 Rename nsDOMNotifyAudioAvailableEvent to mozilla::dom::NotifyAudioAvailableEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 28 Feb 2014 23:58:42 +0900
changeset 171519 031dc7e7c0742dca42bbd82d866dffc097b0bbdf
parent 171518 07ed9eef2248236c008b8c232df236b23a3f8312
child 171520 78f44c7e55f107eec6b38bcd7b6fa86a43b8a84f
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.21 Rename nsDOMNotifyAudioAvailableEvent to mozilla::dom::NotifyAudioAvailableEvent r=smaug
dom/bindings/Bindings.conf
dom/events/NotifyAudioAvailableEvent.cpp
dom/events/NotifyAudioAvailableEvent.h
dom/events/moz.build
dom/events/nsDOMNotifyAudioAvailableEvent.cpp
dom/events/nsDOMNotifyAudioAvailableEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -827,20 +827,16 @@ DOMInterfaces = {
     'nativeType': 'nsINodeList',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'NotifyPaintEvent': {
     'nativeType': 'nsDOMNotifyPaintEvent',
 },
 
-'NotifyAudioAvailableEvent': {
-    'nativeType': 'nsDOMNotifyAudioAvailableEvent',
-},
-
 'OfflineAudioCompletionEvent': {
     'resultNotAddRefed': [ 'renderedBuffer' ],
 },
 
 'OfflineAudioContext': {
     'nativeType': 'mozilla::dom::AudioContext',
     'resultNotAddRefed': [ 'destination', 'listener' ],
 },
rename from dom/events/nsDOMNotifyAudioAvailableEvent.cpp
rename to dom/events/NotifyAudioAvailableEvent.cpp
--- a/dom/events/nsDOMNotifyAudioAvailableEvent.cpp
+++ b/dom/events/NotifyAudioAvailableEvent.cpp
@@ -1,77 +1,81 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "nsDOMNotifyAudioAvailableEvent.h"
-
+#include "mozilla/dom/NotifyAudioAvailableEvent.h"
+#include "mozilla/HoldDropJSObjects.h"
 #include "nsError.h"
-#include "mozilla/HoldDropJSObjects.h"
 #include "jsfriendapi.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-nsDOMNotifyAudioAvailableEvent::nsDOMNotifyAudioAvailableEvent(EventTarget* aOwner,
-                                                               nsPresContext* aPresContext,
-                                                               WidgetEvent* aEvent,
-                                                               uint32_t aEventType,
-                                                               float* aFrameBuffer,
-                                                               uint32_t aFrameBufferLength,
-                                                               float aTime)
-  : nsDOMEvent(aOwner, aPresContext, aEvent),
-    mFrameBuffer(aFrameBuffer),
-    mFrameBufferLength(aFrameBufferLength),
-    mTime(aTime),
-    mCachedArray(nullptr),
-    mAllowAudioData(false)
+NotifyAudioAvailableEvent::NotifyAudioAvailableEvent(
+                             EventTarget* aOwner,
+                             nsPresContext* aPresContext,
+                             WidgetEvent* aEvent,
+                             uint32_t aEventType,
+                             float* aFrameBuffer,
+                             uint32_t aFrameBufferLength,
+                             float aTime)
+  : nsDOMEvent(aOwner, aPresContext, aEvent)
+  , mFrameBuffer(aFrameBuffer)
+  , mFrameBufferLength(aFrameBufferLength)
+  , mTime(aTime)
+  , mCachedArray(nullptr)
+  , mAllowAudioData(false)
 {
-  MOZ_COUNT_CTOR(nsDOMNotifyAudioAvailableEvent);
+  MOZ_COUNT_CTOR(NotifyAudioAvailableEvent);
   if (mEvent) {
     mEvent->message = aEventType;
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
+NS_IMPL_ADDREF_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
+NS_IMPL_RELEASE_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMNotifyAudioAvailableEvent)
+NS_IMPL_CYCLE_COLLECTION_CLASS(NotifyAudioAvailableEvent)
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(NotifyAudioAvailableEvent,
+                                                nsDOMEvent)
   if (tmp->mCachedArray) {
     tmp->mCachedArray = nullptr;
-    mozilla::DropJSObjects(tmp);
+    DropJSObjects(tmp);
   }
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
+                                                  nsDOMEvent)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
+                                               nsDOMEvent)
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCachedArray)
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMNotifyAudioAvailableEvent)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(NotifyAudioAvailableEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyAudioAvailableEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
-nsDOMNotifyAudioAvailableEvent::~nsDOMNotifyAudioAvailableEvent()
+NotifyAudioAvailableEvent::~NotifyAudioAvailableEvent()
 {
-  MOZ_COUNT_DTOR(nsDOMNotifyAudioAvailableEvent);
+  MOZ_COUNT_DTOR(NotifyAudioAvailableEvent);
   if (mCachedArray) {
     mCachedArray = nullptr;
     mozilla::DropJSObjects(this);
   }
 }
 
 NS_IMETHODIMP
-nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
+NotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx,
+                                          JS::MutableHandle<JS::Value> aResult)
 {
   if (!mAllowAudioData) {
     // Media is not same-origin, don't allow the data out.
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   if (mCachedArray) {
     aResult.setObject(*mCachedArray);
@@ -81,37 +85,38 @@ nsDOMNotifyAudioAvailableEvent::GetFrame
   // Cache this array so we don't recreate on next call.
   mozilla::HoldJSObjects(this);
 
   mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
   if (!mCachedArray) {
     mozilla::DropJSObjects(this);
     return NS_ERROR_FAILURE;
   }
-  memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
+  memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(),
+         mFrameBufferLength * sizeof(float));
 
   aResult.setObject(*mCachedArray);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMNotifyAudioAvailableEvent::GetTime(float *aRetVal)
+NotifyAudioAvailableEvent::GetTime(float* aRetVal)
 {
   *aRetVal = Time();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
-                                                        bool aCanBubble,
-                                                        bool aCancelable,
-                                                        float* aFrameBuffer,
-                                                        uint32_t aFrameBufferLength,
-                                                        float aTime,
-                                                        bool aAllowAudioData)
+NotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
+                                                   bool aCanBubble,
+                                                   bool aCancelable,
+                                                   float* aFrameBuffer,
+                                                   uint32_t aFrameBufferLength,
+                                                   float aTime,
+                                                   bool aAllowAudioData)
 {
   // Auto manage the memory which stores the frame buffer. This ensures
   // that if we exit due to some error, the memory will be freed. Otherwise,
   // the framebuffer's memory will be freed when this event is destroyed.
   nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
   nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -119,24 +124,25 @@ nsDOMNotifyAudioAvailableEvent::InitAudi
   mFrameBufferLength = aFrameBufferLength;
   mTime = aTime;
   mAllowAudioData = aAllowAudioData;
   mCachedArray = nullptr;
   return NS_OK;
 }
 
 void
-nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
-                                                        bool aCanBubble,
-                                                        bool aCancelable,
-                                                        const Nullable<Sequence<float> >& aFrameBuffer,
-                                                        uint32_t aFrameBufferLength,
-                                                        float aTime,
-                                                        bool aAllowAudioData,
-                                                        ErrorResult& aRv)
+NotifyAudioAvailableEvent::InitAudioAvailableEvent(
+                             const nsAString& aType,
+                             bool aCanBubble,
+                             bool aCancelable,
+                             const Nullable<Sequence<float> >& aFrameBuffer,
+                             uint32_t aFrameBufferLength,
+                             float aTime,
+                             bool aAllowAudioData,
+                             ErrorResult& aRv)
 {
   if ((aFrameBuffer.IsNull() && aFrameBufferLength > 0) ||
       (!aFrameBuffer.IsNull() &&
        aFrameBuffer.Value().Length() < aFrameBufferLength)) {
     aRv = NS_ERROR_UNEXPECTED;
     return;
   }
 
@@ -148,22 +154,29 @@ nsDOMNotifyAudioAvailableEvent::InitAudi
   }
 
   aRv = InitAudioAvailableEvent(aType, aCanBubble, aCancelable,
                                 buffer.forget(),
                                 aFrameBufferLength,
                                 aTime, aAllowAudioData);
 }
 
-nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
-                                      EventTarget* aOwner,
-                                      nsPresContext* aPresContext,
-                                      WidgetEvent* aEvent,
-                                      uint32_t aEventType,
-                                      float* aFrameBuffer,
-                                      uint32_t aFrameBufferLength,
-                                      float aTime)
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
+                             EventTarget* aOwner,
+                             nsPresContext* aPresContext,
+                             WidgetEvent* aEvent,
+                             uint32_t aEventType,
+                             float* aFrameBuffer,
+                             uint32_t aFrameBufferLength,
+                             float aTime)
 {
-  nsDOMNotifyAudioAvailableEvent* it =
-    new nsDOMNotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
-                                       aFrameBuffer, aFrameBufferLength, aTime);
+  NotifyAudioAvailableEvent* it =
+    new NotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
+                                  aFrameBuffer, aFrameBufferLength, aTime);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMNotifyAudioAvailableEvent.h
rename to dom/events/NotifyAudioAvailableEvent.h
--- a/dom/events/nsDOMNotifyAudioAvailableEvent.h
+++ b/dom/events/NotifyAudioAvailableEvent.h
@@ -1,79 +1,78 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
-#ifndef nsDOMNotifyAudioAvailableEvent_h_
-#define nsDOMNotifyAudioAvailableEvent_h_
+#ifndef mozilla_dom_NotifyAudioAvailableEvent_h_
+#define mozilla_dom_NotifyAudioAvailableEvent_h_
 
 #include "nsIDOMNotifyAudioAvailableEvent.h"
 #include "nsDOMEvent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
 
 class nsPresContext;
 
-class nsDOMNotifyAudioAvailableEvent : public nsDOMEvent,
-                                       public nsIDOMNotifyAudioAvailableEvent
+namespace mozilla {
+namespace dom {
+
+class NotifyAudioAvailableEvent : public nsDOMEvent,
+                                  public nsIDOMNotifyAudioAvailableEvent
 {
 public:
-  nsDOMNotifyAudioAvailableEvent(mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext,
-                                 mozilla::WidgetEvent* aEvent,
-                                 uint32_t aEventType, float * aFrameBuffer,
-                                 uint32_t aFrameBufferLength, float aTime);
+  NotifyAudioAvailableEvent(EventTarget* aOwner,
+                            nsPresContext* aPresContext,
+                            WidgetEvent* aEvent,
+                            uint32_t aEventType,
+                            float* aFrameBuffer,
+                            uint32_t aFrameBufferLength,
+                            float aTime);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMNotifyAudioAvailableEvent,
-                                                         nsDOMEvent)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
+    NotifyAudioAvailableEvent, nsDOMEvent)
 
   NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
   NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
 
-  nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
-                                        mozilla::dom::EventTarget* aOwner,
-                                        nsPresContext* aPresContext,
-                                        mozilla::WidgetEvent* aEvent,
-                                        uint32_t aEventType,
-                                        float * aFrameBuffer,
-                                        uint32_t aFrameBufferLength,
-                                        float aTime);
-
-  ~nsDOMNotifyAudioAvailableEvent();
+  ~NotifyAudioAvailableEvent();
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
+    return NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
   }
 
-  JSObject* GetFrameBuffer(JSContext* aCx, mozilla::ErrorResult& aRv)
+  JSObject* GetFrameBuffer(JSContext* aCx, ErrorResult& aRv)
   {
     JS::Rooted<JS::Value> dummy(aCx);
     aRv = GetFrameBuffer(aCx, &dummy);
     return mCachedArray;
   }
 
   float Time()
   {
     return mTime;
   }
 
   void InitAudioAvailableEvent(const nsAString& aType,
                                bool aCanBubble,
                                bool aCancelable,
-                               const mozilla::dom::Nullable<mozilla::dom::Sequence<float> >& aFrameBuffer,
+                               const Nullable<Sequence<float> >& aFrameBuffer,
                                uint32_t aFrameBufferLength,
                                float aTime,
                                bool aAllowAudioData,
-                               mozilla::ErrorResult& aRv);
+                               ErrorResult& aRv);
 private:
   nsAutoArrayPtr<float> mFrameBuffer;
   uint32_t mFrameBufferLength;
   float mTime;
   JS::Heap<JSObject*> mCachedArray;
   bool mAllowAudioData;
 };
 
-#endif // nsDOMNotifyAudioAvailableEvent_h_
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_NotifyAudioAvailableEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -46,16 +46,17 @@ EXPORTS.mozilla.dom += [
     'DragEvent.h',
     'EventTarget.h',
     'FocusEvent.h',
     'KeyboardEvent.h',
     'MessageEvent.h',
     'MouseEvent.h',
     'MouseScrollEvent.h',
     'MutationEvent.h',
+    'NotifyAudioAvailableEvent.h',
     'PointerEvent.h',
     'SimpleGestureEvent.h',
     'Touch.h',
     'TouchEvent.h',
     'WheelEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
@@ -73,20 +74,20 @@ UNIFIED_SOURCES += [
     'DragEvent.cpp',
     'EventTarget.cpp',
     'FocusEvent.cpp',
     'KeyboardEvent.cpp',
     'MessageEvent.cpp',
     'MouseEvent.cpp',
     'MouseScrollEvent.cpp',
     'MutationEvent.cpp',
+    'NotifyAudioAvailableEvent.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
     'nsDOMEventTargetHelper.cpp',
-    'nsDOMNotifyAudioAvailableEvent.cpp',
     'nsDOMTextEvent.cpp',
     'nsDOMTransitionEvent.cpp',
     'nsDOMXULCommandEvent.cpp',
     'nsEventDispatcher.cpp',
     'nsEventListenerService.cpp',
     'nsIMEStateManager.cpp',
     'nsJSEventListener.cpp',
     'nsPaintRequest.cpp',