Bug 1365928 - patch 2 - Annotate style-struct getters with MOZ_NONNULL_RETURN for better optimization. r=mats

This commit is contained in:
Jonathan Kew 2017-05-22 19:00:19 +01:00
Родитель 67ca6e1f88
Коммит fcf175b16a
2 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -787,12 +787,13 @@ public:
* accepts an *optional* pointer the style struct.
*/
#define STYLE_STRUCT(name_, checkdata_cb_) \
const nsStyle##name_ * Style##name_ () const { \
const nsStyle##name_ * Style##name_ () const MOZ_NONNULL_RETURN { \
NS_ASSERTION(mStyleContext, "No style context found!"); \
return mStyleContext->Style##name_ (); \
} \
const nsStyle##name_ * Style##name_##WithOptionalParam( \
const nsStyle##name_ * aStyleStruct) const { \
const nsStyle##name_ * aStyleStruct) const \
MOZ_NONNULL_RETURN { \
if (aStyleStruct) { \
MOZ_ASSERT(aStyleStruct == Style##name_()); \
return aStyleStruct; \

Просмотреть файл

@ -345,7 +345,7 @@ public:
* function, both because they're easier to read and because they're
* faster.
*/
const void* NS_FASTCALL StyleData(nsStyleStructID aSID);
const void* NS_FASTCALL StyleData(nsStyleStructID aSID) MOZ_NONNULL_RETURN;
/**
* Define typesafe getter functions for each style struct by
@ -354,9 +354,9 @@ public:
* const nsStyleBorder* StyleBorder();
* const nsStyleColor* StyleColor();
*/
#define STYLE_STRUCT(name_, checkdata_cb_) \
const nsStyle##name_ * Style##name_() { \
return DoGetStyle##name_<true>(); \
#define STYLE_STRUCT(name_, checkdata_cb_) \
const nsStyle##name_ * Style##name_() MOZ_NONNULL_RETURN { \
return DoGetStyle##name_<true>(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT