summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-05-08 21:33:55 -0400
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-25 19:24:03 +0200
commit4289b86e33b3658a131781ce0e26d86a70b967a8 (patch)
tree62c97cf4f96bf938fb8476c06b4b6248fa6d9ae4 /desktop
parent1e1a345a18a4162a7e265cf91bcb0c5dc206d576 (diff)
LOK: Reduce and improve logging of event compression
Change-Id: I84e0e8806eb6f4fbda063ebc29fafa791d472bb8 (cherry picked from commit d5b900630caefc4d3b62a31906117cf4acd623b1) Reviewed-on: https://gerrit.libreoffice.org/76322 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx59
1 files changed, 32 insertions, 27 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2db298e3998c..ebb52d175027 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1179,11 +1179,13 @@ void CallbackFlushHandler::queue(const int type, const char* data)
// Dump the queue state and validate cached data.
int i = 1;
std::ostringstream oss;
- oss << '\n';
+ if (m_queue.empty())
+ oss << "Empty";
+ else
+ oss << m_queue.size() << " items\n";
for (const CallbackData& c : m_queue)
oss << i++ << ": [" << c.Type << "] [" << c.PayloadString << "].\n";
- const std::string aQueued = oss.str();
- SAL_INFO("lok", "Current Queue: " << (aQueued.empty() ? "Empty" : aQueued));
+ SAL_INFO("lok", "Current Queue: " << oss.str());
for (const CallbackData& c : m_queue)
assert(c.validate());
}
@@ -1396,45 +1398,53 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
const boost::property_tree::ptree& aOldTree = elem.getJson();
if (aOldTree.get<std::string>("action", "") == "invalidate")
{
- const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0);
- std::string aOldRectStr = aOldTree.get<std::string>("rectangle", "");
- // not possible that we encounter an empty
- // rectangle here; we already handled this
- // case before
- std::istringstream aOldRectStream(aOldRectStr);
+ // Not possible that we encounter an empty rectangle here; we already handled this case above.
+ std::istringstream aOldRectStream(aOldTree.get<std::string>("rectangle", ""));
long nOldLeft, nOldTop, nOldWidth, nOldHeight;
char nOldComma;
aOldRectStream >> nOldLeft >> nOldComma >> nOldTop >> nOldComma >> nOldWidth
>> nOldComma >> nOldHeight;
- tools::Rectangle aOldRect = tools::Rectangle(
+ const tools::Rectangle aOldRect = tools::Rectangle(
nOldLeft, nOldTop, nOldLeft + nOldWidth, nOldTop + nOldHeight);
- if (nLOKWindowId == nOldDialogId)
+ if (nLOKWindowId == aOldTree.get<unsigned>("id", 0))
{
+ if (aNewRect == aOldRect)
+ {
+ SAL_INFO("lok.dialog", "Duplicate rect [" << aNewRect.toString()
+ << "]. Skipping new.");
+ // We have a rectangle in the queue already that makes the current Callback useless.
+ currentIsRedundant = true;
+ return false;
+ }
// new one engulfs the old one?
- if (aNewRect.IsInside(aOldRect))
+ else if (aNewRect.IsInside(aOldRect))
{
- SAL_INFO("lok.dialog", "New " << aNewRect.toString() << " engulfs old "
- << aOldRect.toString() << ".");
+ SAL_INFO("lok.dialog",
+ "New rect [" << aNewRect.toString() << "] engulfs old ["
+ << aOldRect.toString() << "]. Replacing old.");
return true;
}
// old one engulfs the new one?
else if (aOldRect.IsInside(aNewRect))
{
- SAL_INFO("lok.dialog", "Old " << aOldRect.toString() << " engulfs new "
- << aNewRect.toString() << ".");
- // we have a rectangle in the queue
- // already that makes the current
- // Callback useless
+ SAL_INFO("lok.dialog",
+ "Old rect [" << aOldRect.toString() << "] engulfs new ["
+ << aNewRect.toString() << "]. Skipping new.");
+ // We have a rectangle in the queue already that makes the current Callback useless.
currentIsRedundant = true;
return false;
}
else
{
- SAL_INFO("lok.dialog", "Merging " << aNewRect.toString() << " & "
- << aOldRect.toString());
+ // Overlapping rects.
+ const tools::Rectangle aPreMergeRect = aNewRect;
aNewRect.Union(aOldRect);
- SAL_INFO("lok.dialog", "Merged: " << aNewRect.toString());
+ SAL_INFO("lok.dialog", "Merging rects ["
+ << aPreMergeRect.toString() << "] & ["
+ << aOldRect.toString() << "] = ["
+ << aNewRect.toString()
+ << "]. Replacing old.");
return true;
}
}
@@ -1446,12 +1456,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
// Do not enqueue if redundant.
if (currentIsRedundant)
- {
- SAL_INFO("lok.dialog", "Current payload is engulfed by one already in the queue. "
- "Skipping redundant payload: "
- << aNewRect.toString());
return true;
- }
aTree.put("rectangle", aNewRect.toString().getStr());
aCallbackData.setJson(aTree);