зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616591 - Migrate APZ logging to use the MOZ_LOG framework. r=botond
The MOZ_LOG framework is the canonical Gecko logging framework, and provides better control over what gets logged and where it goes, as well as provides additional options like process/thread/timestamp prefixing of log output. This patch does the minimum necessary to migrate the logs; each pre-existing logging define is converted to a log module and all pre-existing log lines are defaulted to LogLevel::Debug. In addition, this prevents future breakage in the logging since everything gets compiled on at least some configurations (e.g. non-Release, non-Android builds). Differential Revision: https://phabricator.services.mozilla.com/D63548 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
319ceb2bae
Коммит
484f28c86a
|
@ -53,17 +53,11 @@
|
|||
#include "GestureEventListener.h" // for GestureEventListener::setLongTapEnabled
|
||||
#include "UnitTransforms.h" // for ViewAs
|
||||
|
||||
#define ENABLE_APZCTM_LOGGING 0
|
||||
// #define ENABLE_APZCTM_LOGGING 1
|
||||
static mozilla::LazyLogModule sApzMgrLog("apz.manager");
|
||||
#define APZCTM_LOG(...) MOZ_LOG(sApzMgrLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
#if ENABLE_APZCTM_LOGGING
|
||||
# define APZCTM_LOG(...) printf_stderr("APZCTM: " __VA_ARGS__)
|
||||
#else
|
||||
# define APZCTM_LOG(...)
|
||||
#endif
|
||||
|
||||
// #define APZ_KEY_LOG(...) printf_stderr("APZKEY: " __VA_ARGS__)
|
||||
#define APZ_KEY_LOG(...)
|
||||
static mozilla::LazyLogModule sApzKeyLog("apz.key");
|
||||
#define APZ_KEY_LOG(...) MOZ_LOG(sApzKeyLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -647,13 +641,10 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
|
|||
state.mNodesToDestroy[i]->Destroy();
|
||||
}
|
||||
|
||||
#if ENABLE_APZCTM_LOGGING
|
||||
// Make the hit-test tree line up with the layer dump
|
||||
printf_stderr("APZCTreeManager (%p)\n", this);
|
||||
APZCTM_LOG("APZCTreeManager (%p)\n", this);
|
||||
if (mRootNode) {
|
||||
mRootNode->Dump(" ");
|
||||
}
|
||||
#endif
|
||||
SendSubtreeTransformsToChromeMainThread(nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "ViewConfiguration.h"
|
||||
#include "mozilla/StaticPrefs_apz.h"
|
||||
|
||||
#define ANDROID_APZ_LOG(...)
|
||||
// #define ANDROID_APZ_LOG(...) printf_stderr("ANDROID_APZ: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzAndLog("apz.android");
|
||||
#define ANDROID_APZ_LOG(...) MOZ_LOG(sApzAndLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
static float sMaxFlingSpeed = 0.0f;
|
||||
|
||||
|
|
|
@ -97,22 +97,15 @@
|
|||
# include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
#define ENABLE_APZC_LOGGING 0
|
||||
// #define ENABLE_APZC_LOGGING 1
|
||||
|
||||
#if ENABLE_APZC_LOGGING
|
||||
# define APZC_LOG(...) printf_stderr("APZC: " __VA_ARGS__)
|
||||
# define APZC_LOG_FM(fm, prefix, ...) \
|
||||
{ \
|
||||
static mozilla::LazyLogModule sApzCtlLog("apz.controller");
|
||||
#define APZC_LOG(...) MOZ_LOG(sApzCtlLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
#define APZC_LOG_FM(fm, prefix, ...) \
|
||||
if (MOZ_LOG_TEST(sApzCtlLog, LogLevel::Debug)) { \
|
||||
std::stringstream ss; \
|
||||
ss << nsPrintfCString(prefix, __VA_ARGS__).get(); \
|
||||
AppendToString(ss, fm, ":", "", true); \
|
||||
APZC_LOG("%s\n", ss.str().c_str()); \
|
||||
}
|
||||
#else
|
||||
# define APZC_LOG(...)
|
||||
# define APZC_LOG_FM(fm, prefix, ...)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc
|
||||
#include "nscore.h" // for NS_IMETHOD
|
||||
|
||||
#define AXIS_LOG(...)
|
||||
// #define AXIS_LOG(...) printf_stderr("AXIS: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzAxsLog("apz.axis");
|
||||
#define AXIS_LOG(...) MOZ_LOG(sApzAxsLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/StaticPrefs_apz.h"
|
||||
|
||||
#define FLING_PHYS_LOG(...)
|
||||
// #define FLING_PHYS_LOG(...) printf_stderr("FLING: " __VA_ARGS__)
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "InputData.h"
|
||||
|
||||
#define DRAG_LOG(...)
|
||||
// #define DRAG_LOG(...) printf_stderr("DRAG: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzDrgLog("apz.drag");
|
||||
#define DRAG_LOG(...) MOZ_LOG(sApzDrgLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
|
||||
// #define FS_LOG(...) printf_stderr("FS: " __VA_ARGS__)
|
||||
#define FS_LOG(...)
|
||||
static mozilla::LazyLogModule sApzFstLog("apz.focusstate");
|
||||
#define FS_LOG(...) MOZ_LOG(sApzFstLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -15,16 +15,8 @@
|
|||
#include "nsIContentInlines.h" // for nsINode::IsEditable()
|
||||
#include "nsLayoutUtils.h" // for nsLayoutUtils
|
||||
|
||||
#define ENABLE_FT_LOGGING 0
|
||||
// #define ENABLE_FT_LOGGING 1
|
||||
|
||||
#if ENABLE_FT_LOGGING
|
||||
# define FT_LOG(FMT, ...) \
|
||||
printf_stderr("FT (%s): " FMT, \
|
||||
XRE_IsParentProcess() ? "chrome" : "content", __VA_ARGS__)
|
||||
#else
|
||||
# define FT_LOG(...)
|
||||
#endif
|
||||
static mozilla::LazyLogModule sApzFtgLog("apz.focustarget");
|
||||
#define FT_LOG(...) MOZ_LOG(sApzFtgLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layout;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#define FLING_LOG(...)
|
||||
// #define FLING_LOG(...) printf_stderr("FLING: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzFlgLog("apz.fling");
|
||||
#define FLING_LOG(...) MOZ_LOG(sApzFlgLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "nsDebug.h" // for NS_WARNING
|
||||
#include "nsMathUtils.h" // for NS_hypot
|
||||
|
||||
#define GEL_LOG(...)
|
||||
// #define GEL_LOG(...) printf_stderr("GEL: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzGelLog("apz.gesture");
|
||||
#define GEL_LOG(...) MOZ_LOG(sApzGelLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "nsPrintfCString.h" // for nsPrintfCString
|
||||
#include "UnitTransforms.h" // for ViewAs
|
||||
|
||||
static mozilla::LazyLogModule sApzMgrLog("apz.manager");
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
@ -415,13 +417,15 @@ void HitTestingTreeNode::Dump(const char* aPrefix) const {
|
|||
if (mPrevSibling) {
|
||||
mPrevSibling->Dump(aPrefix);
|
||||
}
|
||||
printf_stderr(
|
||||
"%sHitTestingTreeNode (%p) APZC (%p) g=(%s) %s%s%sr=(%s) t=(%s) "
|
||||
MOZ_LOG(
|
||||
sApzMgrLog, LogLevel::Debug,
|
||||
("%sHitTestingTreeNode (%p) APZC (%p) g=(%s) %s%s%sr=(%s) t=(%s) "
|
||||
"c=(%s)%s%s\n",
|
||||
aPrefix, this, mApzc.get(),
|
||||
mApzc ? Stringify(mApzc->GetGuid()).c_str()
|
||||
: nsPrintfCString("l=0x%" PRIx64, uint64_t(mLayersId)).get(),
|
||||
(mOverride & EventRegionsOverride::ForceDispatchToContent) ? "fdtc " : "",
|
||||
(mOverride & EventRegionsOverride::ForceDispatchToContent) ? "fdtc "
|
||||
: "",
|
||||
(mOverride & EventRegionsOverride::ForceEmptyHitRegion) ? "fehr " : "",
|
||||
(mFixedPosTarget != ScrollableLayerGuid::NULL_SCROLL_ID)
|
||||
? nsPrintfCString("fixed=%" PRIu64 " ", mFixedPosTarget).get()
|
||||
|
@ -429,7 +433,7 @@ void HitTestingTreeNode::Dump(const char* aPrefix) const {
|
|||
Stringify(mEventRegions).c_str(), Stringify(mTransform).c_str(),
|
||||
mClipRegion ? Stringify(mClipRegion.ref()).c_str() : "none",
|
||||
mScrollbarData.mDirection.isSome() ? " scrollbar" : "",
|
||||
IsScrollThumbNode() ? " scrollthumb" : "");
|
||||
IsScrollThumbNode() ? " scrollthumb" : ""));
|
||||
if (mLastChild) {
|
||||
mLastChild->Dump(nsPrintfCString("%s ", aPrefix).get());
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "OverscrollHandoffState.h"
|
||||
#include "QueuedInput.h"
|
||||
|
||||
#define TBS_LOG(...)
|
||||
// #define TBS_LOG(...) printf_stderr("TBS: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzIbsLog("apz.inputstate");
|
||||
#define TBS_LOG(...) MOZ_LOG(sApzIbsLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "mozilla/StaticPrefs_apz.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
|
||||
#define INPQ_LOG(...)
|
||||
// #define INPQ_LOG(...) printf_stderr("INPQ: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzInpLog("apz.inputqueue");
|
||||
#define INPQ_LOG(...) MOZ_LOG(sApzInpLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include "mozilla/StaticPrefs_apz.h"
|
||||
#include "mozilla/StaticPtr.h" // for StaticAutoPtr
|
||||
|
||||
#define SVT_LOG(...)
|
||||
// #define SVT_LOG(...) printf_stderr("SimpleVelocityTracker: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzSvtLog("apz.simplevelocitytracker");
|
||||
#define SVT_LOG(...) MOZ_LOG(sApzSvtLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -34,12 +34,8 @@
|
|||
#include "nsView.h"
|
||||
#include "Layers.h"
|
||||
|
||||
// #define APZCCH_LOGGING 1
|
||||
#ifdef APZCCH_LOGGING
|
||||
# define APZCCH_LOG(...) printf_stderr("APZCCH: " __VA_ARGS__)
|
||||
#else
|
||||
# define APZCCH_LOG(...)
|
||||
#endif
|
||||
static mozilla::LazyLogModule sApzHlpLog("apz.helper");
|
||||
#define APZCCH_LOG(...) MOZ_LOG(sApzHlpLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -700,7 +696,7 @@ static bool PrepareForSetTargetAPZCNotification(
|
|||
target ? target : aRootFrame);
|
||||
}
|
||||
|
||||
#ifdef APZCCH_LOGGING
|
||||
if (MOZ_LOG_TEST(sApzHlpLog, LogLevel::Debug)) {
|
||||
nsAutoString dpElementDesc;
|
||||
if (dpElement) {
|
||||
dpElement->Describe(dpElementDesc);
|
||||
|
@ -708,7 +704,7 @@ static bool PrepareForSetTargetAPZCNotification(
|
|||
APZCCH_LOG("For event at %s found scrollable element %p (%s)\n",
|
||||
Stringify(aRefPoint).c_str(), dpElement.get(),
|
||||
NS_LossyConvertUTF16toASCII(dpElementDesc).get());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool guidIsValid = APZCCallbackHelper::GetOrCreateScrollIdentifiers(
|
||||
dpElement, &(guid.mScrollableLayerGuid.mPresShellId),
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsQueryFrame.h"
|
||||
|
||||
#define APZES_LOG(...)
|
||||
// #define APZES_LOG(...) printf_stderr("APZES: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzEvtLog("apz.eventstate");
|
||||
#define APZES_LOG(...) MOZ_LOG(sApzEvtLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
// Static helper functions
|
||||
namespace {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
|
||||
#define AEM_LOG(...)
|
||||
// #define AEM_LOG(...) printf_stderr("AEM: " __VA_ARGS__)
|
||||
static mozilla::LazyLogModule sApzAemLog("apz.activeelement");
|
||||
#define AEM_LOG(...) MOZ_LOG(sApzAemLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
Загрузка…
Ссылка в новой задаче