Bug 918011 part 1. Move RootedDictionary into its own header. r=smaug

--HG--
rename : dom/bindings/BindingUtils.h => dom/bindings/RootedDictionary.h
This commit is contained in:
Boris Zbarsky 2013-09-26 00:04:59 -04:00
parent 741531f1fc
commit a22f746363
3 changed files with 58 additions and 36 deletions

View File

@ -17,6 +17,7 @@
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/RootedDictionary.h"
#include "mozilla/dom/workers/Workers.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Likely.h"
@ -1756,42 +1757,6 @@ public:
SequenceType mSequenceType;
};
template<typename T>
class MOZ_STACK_CLASS RootedDictionary : public T,
private JS::CustomAutoRooter
{
public:
RootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
{
this->TraceDictionary(trc);
}
};
template<typename T>
class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable<T>,
private JS::CustomAutoRooter
{
public:
NullableRootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
{
if (!this->IsNull()) {
this->Value().TraceDictionary(trc);
}
}
};
template<typename T>
class MOZ_STACK_CLASS RootedUnion : public T,
private JS::CustomAutoRooter

View File

@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
/* vim: set ts=2 sw=2 et tw=79: */
/* 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 mozilla_dom_RootedDictionary_h__
#define mozilla_dom_RootedDictionary_h__
#include "mozilla/GuardObjects.h"
#include "mozilla/dom/Nullable.h"
#include "jsapi.h"
namespace mozilla {
namespace dom {
template<typename T>
class MOZ_STACK_CLASS RootedDictionary : public T,
private JS::CustomAutoRooter
{
public:
RootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
{
this->TraceDictionary(trc);
}
};
template<typename T>
class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable<T>,
private JS::CustomAutoRooter
{
public:
NullableRootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
{
if (!this->IsNull()) {
this->Value().TraceDictionary(trc);
}
}
};
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_RootedDictionary_h__ */

View File

@ -27,6 +27,7 @@ EXPORTS.mozilla.dom += [
'Nullable.h',
'OwningNonNull.h',
'PrimitiveConversions.h',
'RootedDictionary.h',
'TypedArray.h',
'UnionMember.h',
]