mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
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:
parent
741531f1fc
commit
a22f746363
@ -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
|
||||
|
56
dom/bindings/RootedDictionary.h
Normal file
56
dom/bindings/RootedDictionary.h
Normal 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__ */
|
@ -27,6 +27,7 @@ EXPORTS.mozilla.dom += [
|
||||
'Nullable.h',
|
||||
'OwningNonNull.h',
|
||||
'PrimitiveConversions.h',
|
||||
'RootedDictionary.h',
|
||||
'TypedArray.h',
|
||||
'UnionMember.h',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user