Bug 975688 part.7 Rename nsDOMDataContainerEvent to mozilla::dom::DataContainerEvent r=smaug

--HG--
rename : dom/events/nsDOMDataContainerEvent.cpp => dom/events/DataContainerEvent.cpp
rename : dom/events/nsDOMDataContainerEvent.h => dom/events/DataContainerEvent.h
This commit is contained in:
Masayuki Nakano 2014-02-26 14:23:57 +09:00
parent ecd0285da8
commit 1aa46ecaec
4 changed files with 57 additions and 47 deletions

View File

@ -300,7 +300,7 @@ DOMInterfaces = {
},
'DataContainerEvent': {
'nativeType': 'nsDOMDataContainerEvent',
'nativeType': 'mozilla::dom::DataContainerEvent',
},
'DedicatedWorkerGlobalScope': {

View File

@ -3,41 +3,40 @@
* 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 "nsDOMDataContainerEvent.h"
#include "mozilla/dom/DataContainerEvent.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
using namespace mozilla;
namespace mozilla {
namespace dom {
nsDOMDataContainerEvent::nsDOMDataContainerEvent(
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent)
DataContainerEvent::DataContainerEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, aEvent)
{
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMDataContainerEvent)
NS_IMPL_CYCLE_COLLECTION_CLASS(DataContainerEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMDataContainerEvent,
nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DataContainerEvent, nsDOMEvent)
tmp->mData.Clear();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMDataContainerEvent,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DataContainerEvent,
nsDOMEvent)
tmp->mData.EnumerateRead(TraverseEntry, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(DataContainerEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(DataContainerEvent, nsDOMEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataContainerEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DataContainerEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDataContainerEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMETHODIMP
nsDOMDataContainerEvent::GetData(const nsAString& aKey, nsIVariant **aData)
DataContainerEvent::GetData(const nsAString& aKey, nsIVariant** aData)
{
NS_ENSURE_ARG_POINTER(aData);
@ -46,7 +45,7 @@ nsDOMDataContainerEvent::GetData(const nsAString& aKey, nsIVariant **aData)
}
NS_IMETHODIMP
nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
DataContainerEvent::SetData(const nsAString& aKey, nsIVariant* aData)
{
NS_ENSURE_ARG(aData);
@ -57,9 +56,9 @@ nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
}
void
nsDOMDataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
JS::Handle<JS::Value> aVal,
mozilla::ErrorResult& aRv)
DataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
JS::Handle<JS::Value> aVal,
ErrorResult& aRv)
{
if (!nsContentUtils::XPConnect()) {
aRv = NS_ERROR_FAILURE;
@ -75,22 +74,10 @@ nsDOMDataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
aRv = SetData(aKey, val);
}
nsresult
NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent)
{
nsDOMDataContainerEvent* it =
new nsDOMDataContainerEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}
PLDHashOperator
nsDOMDataContainerEvent::TraverseEntry(const nsAString& aKey,
nsIVariant *aDataItem,
void* aUserArg)
DataContainerEvent::TraverseEntry(const nsAString& aKey,
nsIVariant* aDataItem,
void* aUserArg)
{
nsCycleCollectionTraversalCallback *cb =
static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
@ -98,3 +85,20 @@ nsDOMDataContainerEvent::TraverseEntry(const nsAString& aKey,
return PL_DHASH_NEXT;
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent)
{
DataContainerEvent* it = new DataContainerEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -3,25 +3,28 @@
* 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 nsDOMDataContainerEvent_h___
#define nsDOMDataContainerEvent_h___
#ifndef mozilla_dom_DataContainerEvent_h_
#define mozilla_dom_DataContainerEvent_h_
#include "nsIDOMDataContainerEvent.h"
#include "nsDOMEvent.h"
#include "nsInterfaceHashtable.h"
#include "mozilla/dom/DataContainerEventBinding.h"
class nsDOMDataContainerEvent : public nsDOMEvent,
public nsIDOMDataContainerEvent
namespace mozilla {
namespace dom {
class DataContainerEvent : public nsDOMEvent,
public nsIDOMDataContainerEvent
{
public:
nsDOMDataContainerEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent);
DataContainerEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMDataContainerEvent, nsDOMEvent)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DataContainerEvent, nsDOMEvent)
NS_FORWARD_TO_NSDOMEVENT
@ -30,7 +33,7 @@ public:
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::DataContainerEventBinding::Wrap(aCx, aScope, this);
return DataContainerEventBinding::Wrap(aCx, aScope, this);
}
already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
@ -41,14 +44,16 @@ public:
}
void SetData(JSContext* aCx, const nsAString& aKey,
JS::Handle<JS::Value> aVal, mozilla::ErrorResult& aRv);
JS::Handle<JS::Value> aVal, ErrorResult& aRv);
private:
static PLDHashOperator
TraverseEntry(const nsAString& aKey, nsIVariant *aDataItem, void* aUserArg);
TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg);
nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
};
#endif
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DataContainerEvent_h_

View File

@ -41,6 +41,7 @@ EXPORTS.mozilla.dom += [
'ClipboardEvent.h',
'CommandEvent.h',
'CompositionEvent.h',
'DataContainerEvent.h',
'EventTarget.h',
'PointerEvent.h',
'Touch.h',
@ -56,10 +57,10 @@ UNIFIED_SOURCES += [
'ClipboardEvent.cpp',
'CommandEvent.cpp',
'CompositionEvent.cpp',
'DataContainerEvent.cpp',
'EventTarget.cpp',
'nsAsyncDOMEvent.cpp',
'nsContentEventHandler.cpp',
'nsDOMDataContainerEvent.cpp',
'nsDOMDataTransfer.cpp',
'nsDOMDeviceMotionEvent.cpp',
'nsDOMDragEvent.cpp',