Bug 1259660 - Reordered the member definition in the class WidgetMouseEventBase to reduce the instance size. r=masayuki

To reduce the instance size, reordered the member definition in the class WidgetMouseEventBase, in the decreasing order of alignment size (alignof() value) to optimize the packing.

Differential Revision: https://phabricator.services.mozilla.com/D25308

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Srujana Peddinti 2019-04-21 18:20:58 +00:00
Родитель 1557978a85
Коммит 13cf06cfb2
1 изменённых файлов: 19 добавлений и 20 удалений

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

@ -95,26 +95,24 @@ class WidgetMouseEventBase : public WidgetInputEvent {
protected:
WidgetMouseEventBase()
: mButton(0),
: mPressure(0),
mButton(0),
mButtons(0),
mPressure(0),
mHitCluster(false)
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEvent_Binding::MOZ_SOURCE_MOUSE.
,
mInputSource(/* MouseEvent_Binding::MOZ_SOURCE_MOUSE = */ 1) {}
mInputSource(/* MouseEvent_Binding::MOZ_SOURCE_MOUSE = */ 1),
mHitCluster(false) {}
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEvent_Binding::MOZ_SOURCE_MOUSE.
WidgetMouseEventBase(bool aIsTrusted, EventMessage aMessage,
nsIWidget* aWidget, EventClassID aEventClassID)
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID),
mPressure(0),
mButton(0),
mButtons(0),
mPressure(0),
mHitCluster(false)
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEvent_Binding::MOZ_SOURCE_MOUSE.
,
mInputSource(/* MouseEvent_Binding::MOZ_SOURCE_MOUSE = */ 1) {}
mInputSource(/* MouseEvent_Binding::MOZ_SOURCE_MOUSE = */ 1),
mHitCluster(false) {}
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEvent_Binding::MOZ_SOURCE_MOUSE.
public:
virtual WidgetMouseEventBase* AsMouseEventBase() override { return this; }
@ -123,6 +121,12 @@ class WidgetMouseEventBase : public WidgetInputEvent {
MOZ_CRASH("WidgetMouseEventBase must not be most-subclass");
}
// ID of the canvas HitRegion
nsString mRegion;
// Finger or touch pressure of event. It ranges between 0.0 and 1.0.
float mPressure;
enum buttonType {
eNoButton = -1,
eLeftButton = 0,
@ -150,16 +154,11 @@ class WidgetMouseEventBase : public WidgetInputEvent {
// This is set at any mouse event, don't be confused with |mButton|.
int16_t mButtons;
// Finger or touch pressure of event. It ranges between 0.0 and 1.0.
float mPressure;
// Touch near a cluster of links (true)
bool mHitCluster;
// Possible values a in MouseEvent
uint16_t mInputSource;
// ID of the canvas HitRegion
nsString mRegion;
// Touch near a cluster of links (true)
bool mHitCluster;
bool IsLeftButtonPressed() const { return !!(mButtons & eLeftButtonFlag); }
bool IsRightButtonPressed() const { return !!(mButtons & eRightButtonFlag); }