From e30ec8244e9f7ffb87ea64ebd9eb3b44838e119c Mon Sep 17 00:00:00 2001 From: Mirko Brodesser Date: Wed, 8 Sep 2021 10:34:58 +0000 Subject: [PATCH] Bug 1728955: part 3) Add logging to `nsBaseClipboard`. r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D124756 --- widget/nsBaseClipboard.cpp | 15 ++++++++++++++- widget/windows/nsClipboard.cpp | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/widget/nsBaseClipboard.cpp b/widget/nsBaseClipboard.cpp index 91da56d0ad98..0bb4500e77e5 100644 --- a/widget/nsBaseClipboard.cpp +++ b/widget/nsBaseClipboard.cpp @@ -5,10 +5,14 @@ #include "nsBaseClipboard.h" +#include "mozilla/Logging.h" + #include "nsIClipboardOwner.h" #include "nsCOMPtr.h" #include "nsXPCOM.h" +static mozilla::LazyLogModule sBaseClipboardLog("BaseClipboard"); + nsBaseClipboard::nsBaseClipboard() : mEmptyingForSetData(false), mIgnoreEmptyNotification(false) {} @@ -29,8 +33,13 @@ NS_IMETHODIMP nsBaseClipboard::SetData(nsITransferable* aTransferable, int32_t aWhichClipboard) { NS_ASSERTION(aTransferable, "clipboard given a null transferable"); - if (aTransferable == mTransferable && anOwner == mClipboardOwner) + MOZ_LOG(sBaseClipboardLog, mozilla::LogLevel::Debug, ("%s", __FUNCTION__)); + + if (aTransferable == mTransferable && anOwner == mClipboardOwner) { + MOZ_LOG(sBaseClipboardLog, mozilla::LogLevel::Debug, + ("%s: skipping update.", __FUNCTION__)); return NS_OK; + } bool selectClipPresent; SupportsSelectionClipboard(&selectClipPresent); bool findClipPresent; @@ -62,6 +71,8 @@ NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) { NS_ASSERTION(aTransferable, "clipboard given a null transferable"); + MOZ_LOG(sBaseClipboardLog, mozilla::LogLevel::Debug, ("%s", __FUNCTION__)); + bool selectClipPresent; SupportsSelectionClipboard(&selectClipPresent); bool findClipPresent; @@ -77,6 +88,8 @@ NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable* aTransferable, } NS_IMETHODIMP nsBaseClipboard::EmptyClipboard(int32_t aWhichClipboard) { + MOZ_LOG(sBaseClipboardLog, mozilla::LogLevel::Debug, ("%s: clipboard=%i", __FUNCTION__, aWhichClipboard)); + bool selectClipPresent; SupportsSelectionClipboard(&selectClipPresent); bool findClipPresent; diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index 12e58895fd8b..064a5afbbefc 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -253,6 +253,8 @@ nsresult nsClipboard::SetupNativeDataObject(nsITransferable* aTransferable, //------------------------------------------------------------------------- NS_IMETHODIMP nsClipboard::SetNativeClipboardData(int32_t aWhichClipboard) { + MOZ_LOG(gWin32ClipboardLog, LogLevel::Debug, ("%s", __FUNCTION__)); + if (aWhichClipboard != kGlobalClipboard) { return NS_ERROR_FAILURE; } -- 2.11.4.GIT