зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1204518 - Fix warnings in widget/gonk/. r=mwu.
Warnings fixed include the following. - Several cases where macros (|LOG| and |ALOGE|) were redefined. I just did a simple #undef to fix these. - In GonkMemoryPressureMonitoring.cpp, "the address of NuwaMarkCurrentThread will never be NULL". - In OrientationObserver.cpp, several signed/unsigned comparison warnings. - Several warnings about variables that are unused or set but not used: in InputDispatcher.cpp, InputReader.cpp. Also in SpriteController, where several loops were all but empty if HAVE_ANDROID_OS is undefined; for these I moved the HAVE_ANDROID_OS check outside the loop. The patch also disallows the introduction of new warnings by removing the ALLOW_COMPILER_WARNINGS flag. --HG-- extra : rebase_source : 6dc19235cf992b929d1308fd98baa03e16701874
This commit is contained in:
Родитель
0ed820f845
Коммит
8da254d570
|
@ -38,6 +38,7 @@
|
|||
#include <unistd.h>
|
||||
#include <utils/Timers.h>
|
||||
|
||||
#undef LOG
|
||||
#define LOG(args...) \
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args)
|
||||
|
||||
|
|
|
@ -121,8 +121,6 @@ public:
|
|||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (IsNuwaProcess()) {
|
||||
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
|
||||
"NuwaMarkCurrentThread is undefined!");
|
||||
NuwaMarkCurrentThread(nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#undef LOG
|
||||
#include <android/log.h>
|
||||
#undef ALOGE
|
||||
#define ALOGE(args...) __android_log_print(ANDROID_LOG_ERROR, "gonkperm" , ## args)
|
||||
|
||||
using namespace android;
|
||||
|
|
|
@ -43,8 +43,8 @@ static OrientationMapping sOrientationMappings[] = {
|
|||
{nsIScreen::ROTATION_270_DEG, eScreenOrientation_LandscapeSecondary},
|
||||
};
|
||||
|
||||
const static int sDefaultLandscape = 2;
|
||||
const static int sDefaultPortrait = 0;
|
||||
const static uint32_t sDefaultLandscape = 2;
|
||||
const static uint32_t sDefaultPortrait = 0;
|
||||
|
||||
static uint32_t sOrientationOffset = 0;
|
||||
|
||||
|
@ -108,7 +108,7 @@ DetectDefaultOrientation()
|
|||
static nsresult
|
||||
ConvertToScreenRotation(ScreenOrientationInternal aOrientation, uint32_t *aResult)
|
||||
{
|
||||
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
for (uint32_t i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
if (aOrientation & sOrientationMappings[i].mDomOrientation) {
|
||||
// Shift the mappings in sOrientationMappings so devices with default
|
||||
// landscape orientation map landscape-primary to 0 degree and so forth.
|
||||
|
@ -134,7 +134,7 @@ ConvertToScreenRotation(ScreenOrientationInternal aOrientation, uint32_t *aResul
|
|||
nsresult
|
||||
ConvertToDomOrientation(uint32_t aRotation, ScreenOrientationInternal *aResult)
|
||||
{
|
||||
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
for (uint32_t i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
if (aRotation == sOrientationMappings[i].mScreenRotation) {
|
||||
// Shift the mappings in sOrientationMappings so devices with default
|
||||
// landscape orientation map 0 degree to landscape-primary and so forth.
|
||||
|
@ -213,7 +213,7 @@ OrientationObserver::Notify(const hal::SensorData& aSensorData)
|
|||
}
|
||||
|
||||
int rotation = mOrientation->OnSensorChanged(aSensorData, static_cast<int>(currRotation));
|
||||
if (rotation < 0 || rotation == currRotation) {
|
||||
if (rotation < 0 || uint32_t(rotation) == currRotation) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1112,8 +1112,6 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
|
|||
INJECTION_PERMISSION_DENIED
|
||||
};
|
||||
|
||||
nsecs_t startTime = now();
|
||||
|
||||
// For security reasons, we defer updating the touch state until we are sure that
|
||||
// event injection will be allowed.
|
||||
//
|
||||
|
@ -2241,7 +2239,6 @@ InputDispatcher::MotionEntry*
|
|||
InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds) {
|
||||
ALOG_ASSERT(pointerIds.value != 0);
|
||||
|
||||
uint32_t splitPointerIndexMap[MAX_POINTERS];
|
||||
PointerProperties splitPointerProperties[MAX_POINTERS];
|
||||
PointerCoords splitPointerCoords[MAX_POINTERS];
|
||||
|
||||
|
@ -2254,7 +2251,6 @@ InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet
|
|||
originalMotionEntry->pointerProperties[originalPointerIndex];
|
||||
uint32_t pointerId = uint32_t(pointerProperties.id);
|
||||
if (pointerIds.hasBit(pointerId)) {
|
||||
splitPointerIndexMap[splitPointerCount] = originalPointerIndex;
|
||||
splitPointerProperties[splitPointerCount].copyFrom(pointerProperties);
|
||||
splitPointerCoords[splitPointerCount].copyFrom(
|
||||
originalMotionEntry->pointerCoords[originalPointerIndex]);
|
||||
|
|
|
@ -1592,11 +1592,15 @@ void MultiTouchMotionAccumulator::clearSlots(int32_t initialSlot) {
|
|||
|
||||
void MultiTouchMotionAccumulator::process(const RawEvent* rawEvent) {
|
||||
if (rawEvent->type == EV_ABS) {
|
||||
#if DEBUG_POINTERS
|
||||
bool newSlot = false;
|
||||
#endif
|
||||
if (mUsingSlotsProtocol) {
|
||||
if (rawEvent->code == ABS_MT_SLOT) {
|
||||
mCurrentSlot = rawEvent->value;
|
||||
#if DEBUG_POINTERS
|
||||
newSlot = true;
|
||||
#endif
|
||||
}
|
||||
} else if (mCurrentSlot < 0) {
|
||||
mCurrentSlot = 0;
|
||||
|
@ -4650,18 +4654,15 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when,
|
|||
// Otherwise choose an arbitrary remaining pointer.
|
||||
// This guarantees we always have an active touch id when there is at least one pointer.
|
||||
// We keep the same active touch id for as long as possible.
|
||||
bool activeTouchChanged = false;
|
||||
int32_t lastActiveTouchId = mPointerGesture.activeTouchId;
|
||||
int32_t activeTouchId = lastActiveTouchId;
|
||||
if (activeTouchId < 0) {
|
||||
if (!mCurrentFingerIdBits.isEmpty()) {
|
||||
activeTouchChanged = true;
|
||||
activeTouchId = mPointerGesture.activeTouchId =
|
||||
mCurrentFingerIdBits.firstMarkedBit();
|
||||
mPointerGesture.firstTouchTime = when;
|
||||
}
|
||||
} else if (!mCurrentFingerIdBits.hasBit(activeTouchId)) {
|
||||
activeTouchChanged = true;
|
||||
if (!mCurrentFingerIdBits.isEmpty()) {
|
||||
activeTouchId = mPointerGesture.activeTouchId =
|
||||
mCurrentFingerIdBits.firstMarkedBit();
|
||||
|
@ -4757,7 +4758,6 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when,
|
|||
}
|
||||
if (bestId >= 0 && bestId != activeTouchId) {
|
||||
mPointerGesture.activeTouchId = activeTouchId = bestId;
|
||||
activeTouchChanged = true;
|
||||
#if DEBUG_GESTURES
|
||||
ALOGD("Gestures: BUTTON_CLICK_OR_DRAG switched pointers, "
|
||||
"bestId=%d, bestSpeed=%0.3f", bestId, bestSpeed);
|
||||
|
|
|
@ -243,7 +243,6 @@ static int32_t toggleLockedMetaState(int32_t mask, bool down, int32_t oldMetaSta
|
|||
}
|
||||
|
||||
int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState) {
|
||||
int32_t mask;
|
||||
switch (keyCode) {
|
||||
case AKEYCODE_ALT_LEFT:
|
||||
return setEphemeralMetaState(AMETA_ALT_LEFT_ON, down, oldMetaState);
|
||||
|
|
|
@ -141,10 +141,9 @@ void SpriteController::doUpdateSprites() {
|
|||
|
||||
// Create missing surfaces.
|
||||
bool surfaceChanged = false;
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
for (size_t i = 0; i < numSprites; i++) {
|
||||
SpriteUpdate& update = updates.editItemAt(i);
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (update.state.surfaceControl == NULL && update.state.wantSurfaceVisible()) {
|
||||
update.state.surfaceWidth = update.state.icon.bitmap.width();
|
||||
update.state.surfaceHeight = update.state.icon.bitmap.height();
|
||||
|
@ -156,15 +155,14 @@ void SpriteController::doUpdateSprites() {
|
|||
update.surfaceChanged = surfaceChanged = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Resize sprites if needed, inside a global transaction.
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
bool haveGlobalTransaction = false;
|
||||
for (size_t i = 0; i < numSprites; i++) {
|
||||
SpriteUpdate& update = updates.editItemAt(i);
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (update.state.surfaceControl != NULL && update.state.wantSurfaceVisible()) {
|
||||
int32_t desiredWidth = update.state.icon.bitmap.width();
|
||||
int32_t desiredHeight = update.state.icon.bitmap.height();
|
||||
|
@ -197,8 +195,8 @@ void SpriteController::doUpdateSprites() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (haveGlobalTransaction) {
|
||||
SurfaceComposerClient::closeGlobalTransaction();
|
||||
|
@ -258,16 +256,15 @@ void SpriteController::doUpdateSprites() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
// Set sprite surface properties and make them visible.
|
||||
bool haveTransaction = false;
|
||||
for (size_t i = 0; i < numSprites; i++) {
|
||||
SpriteUpdate& update = updates.editItemAt(i);
|
||||
|
||||
bool wantSurfaceVisibleAndDrawn = update.state.wantSurfaceVisible()
|
||||
&& update.state.surfaceDrawn;
|
||||
bool becomingVisible = wantSurfaceVisibleAndDrawn && !update.state.surfaceVisible;
|
||||
bool becomingHidden = !wantSurfaceVisibleAndDrawn && update.state.surfaceVisible;
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (update.state.surfaceControl != NULL && (becomingVisible || becomingHidden
|
||||
|| (wantSurfaceVisibleAndDrawn && (update.state.dirty & (DIRTY_ALPHA
|
||||
| DIRTY_POSITION | DIRTY_TRANSFORMATION_MATRIX | DIRTY_LAYER
|
||||
|
@ -337,8 +334,8 @@ void SpriteController::doUpdateSprites() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (haveTransaction) {
|
||||
|
@ -346,6 +343,7 @@ void SpriteController::doUpdateSprites() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
// If any surfaces were changed, write back the new surface properties to the sprites.
|
||||
if (surfaceChanged) { // acquire lock
|
||||
AutoMutex _l(mLock);
|
||||
|
@ -353,15 +351,14 @@ void SpriteController::doUpdateSprites() {
|
|||
for (size_t i = 0; i < numSprites; i++) {
|
||||
const SpriteUpdate& update = updates.itemAt(i);
|
||||
|
||||
#ifdef HAVE_ANDROID_OS
|
||||
if (update.surfaceChanged) {
|
||||
update.sprite->setSurfaceLocked(update.state.surfaceControl,
|
||||
update.state.surfaceWidth, update.state.surfaceHeight,
|
||||
update.state.surfaceDrawn, update.state.surfaceVisible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // release lock
|
||||
#endif
|
||||
|
||||
// Clear the sprite update vector outside the lock. It is very important that
|
||||
// we do not clear sprite references inside the lock since we could be releasing
|
||||
|
|
|
@ -77,9 +77,6 @@ SOURCES += [
|
|||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
# XXX: We should fix these warnings.
|
||||
ALLOW_COMPILER_WARNINGS = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "GeckoTouchDispatcher.h"
|
||||
|
||||
#undef LOG
|
||||
#define LOG(args...) \
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args)
|
||||
#ifdef VERBOSE_LOG_ENABLED
|
||||
|
|
Загрузка…
Ссылка в новой задаче