diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-12-04 11:00:48 -0500 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2016-12-05 04:07:06 +0000 |
commit | 2a5d8d7306776cc59a6311f20f32e1007dcac858 (patch) | |
tree | 8607ea83bf5b46b1efef01819a94a7c85a0fd268 /desktop | |
parent | a8b2e3e948c507d71fd01b219dc77838f6bf785f (diff) |
Lok: better logging and warnings
Change-Id: Ia933ae65197893592eeb04cb8a1a617a931ad623
Reviewed-on: https://gerrit.libreoffice.org/31606
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index defc79bd8f88..073be47e681f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -606,6 +606,7 @@ void CallbackFlushHandler::callback(const int type, const char* payload, void* d void CallbackFlushHandler::queue(const int type, const char* data) { std::string payload(data ? data : "(nil)"); + //SAL_WARN("lok", "Queue: " << type << " : " << payload); if (m_bPartTilePainting) { // We drop notifications when this is set, except for important ones. @@ -622,7 +623,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) type != LOK_CALLBACK_VIEW_CURSOR_VISIBLE && type != LOK_CALLBACK_TEXT_SELECTION) { - SAL_WARN("lok", "Skipping while painting [" + std::to_string(type) + "]: [" + payload + "]."); + SAL_WARN("lok", "Skipping while painting [" << type << "]: [" << payload << "]."); return; } @@ -639,7 +640,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) // issuing it, instead of the absolute one that we expect. // This is temporary however, and, once the control is created and initialized // correctly, it eventually emits the correct absolute coordinates. - SAL_WARN("lok", "Skipping invalid event [" + std::to_string(type) + "]: [" + payload + "]."); + SAL_WARN("lok", "Skipping invalid event [" << type << "]: [" << payload << "]."); return; } @@ -670,7 +671,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) if (pos != m_queue.rend() && pos->second == payload) { - //SAL_WARN("lok", "Skipping queue duplicate [" + std::to_string(type) + "]: [" + payload + "]."); + //SAL_WARN("lok", "Skipping queue duplicate [" << type << + "]: [" << payload << "]."); return; } } @@ -719,6 +720,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) case LOK_CALLBACK_GRAPHIC_SELECTION: case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: case LOK_CALLBACK_INVALIDATE_TILES: + //SAL_WARN("lok", "Removing dups of [" << type << "]: [" << payload << "]."); removeAll([type] (const queue_type::value_type& elem) { return (elem.first == type); }); break; } @@ -778,7 +780,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) //SAL_WARN("lok", "New: " << rcNew.toString()); if (rcNew.isInfinite()) { - SAL_WARN("lok", "Have Empty [" << type << "]: [" << payload << "] so removing all."); + SAL_WARN("lok", "Have Empty [" << type << "]: [" << payload << "] so removing all with part " << rcNew.m_nPart << "."); removeAll( [type, &rcNew] (const queue_type::value_type& elem) { if (elem.first == type) @@ -797,6 +799,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) { const auto rcOrig = rcNew; + //SAL_WARN("lok", "Have [" << type << "]: [" << payload << "] so merging overlapping."); removeAll( [type, &rcNew] (const queue_type::value_type& elem) { if (elem.first == type) @@ -804,14 +807,15 @@ void CallbackFlushHandler::queue(const int type, const char* data) const RectangleAndPart rcOld = RectangleAndPart::Create(elem.second); if (rcOld.m_nPart != rcNew.m_nPart) return false; - //SAL_WARN("lok", "#" << i << " Old: " << rcOld.toString()); + const Rectangle rcOverlap = rcNew.m_aRectangle.GetIntersection(rcOld.m_aRectangle); - //SAL_WARN("lok", "#" << i << " Overlap: " << rcOverlap.toString()); bool bOverlap = (rcOverlap.GetWidth() > 0 && rcOverlap.GetHeight() > 0); + SAL_WARN("lok", "Merging " << rcNew.toString() << " & " << rcOld.toString() << " => " << + rcOverlap.toString() << " Overlap: " << bOverlap); if (bOverlap) { - //SAL_WARN("lok", rcOld.toString() << " U " << rcNew.toString()); rcNew.m_aRectangle.Union(rcOld.m_aRectangle); + SAL_WARN("lok", "Merged: " << rcNew.toString()); } return bOverlap; } @@ -825,6 +829,12 @@ void CallbackFlushHandler::queue(const int type, const char* data) if (rcNew.m_aRectangle != rcOrig.m_aRectangle) { SAL_WARN("lok", "Replacing: " << rcOrig.toString() << " by " << rcNew.toString()); + if (rcNew.m_aRectangle.GetWidth() < rcOrig.m_aRectangle.GetWidth() || + rcNew.m_aRectangle.GetHeight() < rcOrig.m_aRectangle.GetHeight()) + { + SAL_WARN("lok", "Error: merged rect smaller."); + } + payload = rcNew.toString().getStr(); } } @@ -852,6 +862,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) } m_queue.emplace_back(type, payload); + SAL_WARN("lok", "Queued [" << type << "]: [" << payload << "] to have " << m_queue.size() << " entries."); lock.unlock(); if (!IsActive()) @@ -866,6 +877,7 @@ void CallbackFlushHandler::Invoke() { std::unique_lock<std::mutex> lock(m_mutex); + //SAL_WARN("lok", "Flushing " << m_queue.size() << " elements."); for (auto& pair : m_queue) { const int type = pair.first; @@ -880,7 +892,7 @@ void CallbackFlushHandler::Invoke() // If the state didn't change, it's safe to ignore. if (stateIt->second == payload) { - //SAL_WARN("lok", "Skipping duplicate [" + std::to_string(type) + "]: [" + payload + "]."); + //SAL_WARN("lok", "Skipping duplicate [" << type << "]: [" << payload << "]."); continue; } @@ -899,24 +911,26 @@ void CallbackFlushHandler::Invoke() // If the state didn't change, it's safe to ignore. if (stateIt->second == payload) { - //SAL_WARN("lok", "Skipping view duplicate [" + std::to_string(type) + "," + std::to_string(viewId) + "]: [" + payload + "]."); + //SAL_WARN("lok", "Skipping view duplicate [" << type << ',' << viewId << "]: [" << payload << "]."); continue; } stateIt->second = payload; - //SAL_WARN("lok", "Replacing an element in view states [" + std::to_string(type) + "," + std::to_string(viewId) + "]: [" + payload + "]."); + //SAL_WARN("lok", "Replacing an element in view states [" << type << ',' << viewId << "]: [" << payload << "]."); } else { states.emplace(type, payload); - //SAL_WARN("lok", "Inserted a new element in view states: [" + std::to_string(type) + "," + std::to_string(viewId) + "]: [" + payload + "]"); + //SAL_WARN("lok", "Inserted a new element in view states: [" << type << ',' << viewId << "]: [" << payload << "]"); } } } + //SAL_WARN("lok", "Emitting [" << type << "]: [" << payload << "]."); m_pCallback(type, payload.c_str(), m_pData); } + //SAL_WARN("lok", "Done flushing."); m_queue.clear(); } } |