зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1192130 - Part 2: Use MOZ_NON_AUTOABLE to validate the usage of already_AddRefed, r=ehsan
This commit is contained in:
Родитель
40e60e8a8e
Коммит
f8b012d537
|
@ -29,7 +29,7 @@ struct unused_t;
|
|||
* because of the sheer number of usages of already_AddRefed.
|
||||
*/
|
||||
template<class T>
|
||||
struct MOZ_MUST_USE already_AddRefed
|
||||
struct MOZ_MUST_USE MOZ_NON_AUTOABLE already_AddRefed
|
||||
{
|
||||
/*
|
||||
* We want to allow returning nullptr from functions returning
|
||||
|
|
|
@ -475,6 +475,10 @@
|
|||
* declarations where an instance of the template should be considered, for
|
||||
* static analysis purposes, to inherit any type annotations (such as
|
||||
* MOZ_MUST_USE and MOZ_STACK_CLASS) from its template arguments.
|
||||
* MOZ_NON_AUTOABLE: Applies to class declarations. Makes it a compile time error to
|
||||
* use `auto` in place of this type in variable declarations. This is intended to
|
||||
* be used with types which are intended to be implicitly constructed into other
|
||||
* other types before being assigned to variables.
|
||||
*/
|
||||
#ifdef MOZ_CLANG_PLUGIN
|
||||
# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
|
||||
|
@ -499,8 +503,9 @@
|
|||
# define MOZ_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type")))
|
||||
# define MOZ_NON_MEMMOVABLE __attribute__((annotate("moz_non_memmovable")))
|
||||
# define MOZ_NEEDS_MEMMOVABLE_TYPE __attribute__((annotate("moz_needs_memmovable_type")))
|
||||
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
|
||||
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
|
||||
__attribute__((annotate("moz_inherit_type_annotations_from_template_args")))
|
||||
# define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable")))
|
||||
/*
|
||||
* It turns out that clang doesn't like void func() __attribute__ {} without a
|
||||
* warning, so use pragmas to disable the warning. This code won't work on GCC
|
||||
|
@ -530,6 +535,7 @@
|
|||
# define MOZ_NON_MEMMOVABLE /* nothing */
|
||||
# define MOZ_NEEDS_MEMMOVABLE_TYPE /* nothing */
|
||||
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS /* nothing */
|
||||
# define MOZ_NON_AUTOABLE /* nothing */
|
||||
#endif /* MOZ_CLANG_PLUGIN */
|
||||
|
||||
/*
|
||||
|
|
|
@ -649,15 +649,14 @@ ThreadSafeChromeUtils::ReadHeapSnapshot(GlobalObject& global,
|
|||
if (rv.Failed())
|
||||
return nullptr;
|
||||
|
||||
auto snapshot = HeapSnapshot::Create(cx, global,
|
||||
reinterpret_cast<const uint8_t*>(mm.address()),
|
||||
mm.size(), rv);
|
||||
nsRefPtr<HeapSnapshot> snapshot = HeapSnapshot::Create(
|
||||
cx, global, reinterpret_cast<const uint8_t*>(mm.address()), mm.size(), rv);
|
||||
|
||||
if (!rv.Failed())
|
||||
Telemetry::AccumulateTimeDelta(Telemetry::DEVTOOLS_READ_HEAP_SNAPSHOT_MS,
|
||||
start);
|
||||
|
||||
return snapshot;
|
||||
return snapshot.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
Загрузка…
Ссылка в новой задаче