[Libreoffice-commits] online.git: Branch 'libreoffice-7-0' - 2 commits - loleaflet/src wsd/Admin.cpp wsd/Admin.hpp wsd/AdminModel.cpp wsd/AdminModel.hpp
Marco Cecchetti (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 16 20:38:27 UTC 2020
loleaflet/src/control/Ruler.js | 7 ++++++-
loleaflet/src/layer/tile/GridLayer.js | 7 +------
wsd/Admin.cpp | 9 +++++++++
wsd/Admin.hpp | 1 +
wsd/AdminModel.cpp | 27 +++++++++++++++++++++++++--
wsd/AdminModel.hpp | 15 +++++++++++----
6 files changed, 53 insertions(+), 13 deletions(-)
New commits:
commit 83e530a434358935e5d864aedd4f221287aedb45
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun May 24 19:03:47 2020 +0200
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Jun 16 22:38:17 2020 +0200
loleaflet: writer zoom flickers
Change-Id: I9186bbae55269870fc693b65c3e90b149375eba9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95496
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Tested-by: Jenkins
Tested-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96445
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index a5537055e..ab6b61435 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -409,7 +409,12 @@ L.Control.Ruler = L.Control.extend({
var firstTileXTranslate = parseInt(firstTile.style.left) - this._map._docLayer._tileWidthPx * columnNumber;
var tileContainer = mapPane.getElementsByClassName('leaflet-tile-container');
- tileContainer = tileContainer[tileContainer.length - 1];
+ for (var i = 0; i < tileContainer.length; ++i) {
+ if (parseInt(tileContainer[i].style.zIndex) === this._map.getMaxZoom()) {
+ tileContainer = tileContainer[i];
+ break;
+ }
+ }
var tileContainerXTranslate = parseInt(tileContainer.style.transform.match(/\(([-0-9]*)/)[1]);
var mapPaneXTranslate = parseInt(mapPane.style.transform.match(/\(([-0-9]*)/)[1]);
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 850981777..91dd404e8 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -211,12 +211,7 @@ L.GridLayer = L.Layer.extend({
maxZoom = this.options.maxZoom;
for (var z in this._levels) {
- if (this._levels[z].el.children.length || z === zoom) {
- this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
- } else {
- L.DomUtil.remove(this._levels[z].el);
- delete this._levels[z];
- }
+ this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
}
var level = this._levels[zoom],
commit dfb3bf30a4f4c0df0f9cff2e2a4fa1c09153fba6
Author: Gabriel Masei <gabriel.masei at 1and1.ro>
AuthorDate: Fri May 29 14:32:04 2020 +0300
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Jun 16 22:38:05 2020 +0200
admin: notify subscribers that doc memory has changed
Change-Id: I139c7d49a2cd1b86c3a281613f5628f6af8b3365
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95133
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96444
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 92fe30e8a..80315676a 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -424,6 +424,8 @@ void Admin::pollingThread()
std::chrono::duration_cast<std::chrono::milliseconds>(now - lastMem).count();
if (memWait <= MinStatsIntervalMs / 2) // Close enough
{
+ _model.UpdateMemoryDirty();
+
const size_t totalMem = getTotalMemoryUsage();
_model.addMemStats(totalMem);
@@ -435,6 +437,8 @@ void Admin::pollingThread()
_lastTotalMemory = totalMem;
}
+ notifyDocsMemDirtyChanged();
+
memWait += _memStatsTaskIntervalMs;
lastMem = now;
}
@@ -658,6 +662,11 @@ void Admin::triggerMemoryCleanup(const size_t totalMem)
}
}
+void Admin::notifyDocsMemDirtyChanged()
+{
+ _model.notifyDocsMemDirtyChanged();
+}
+
void Admin::dumpState(std::ostream& os)
{
// FIXME: be more helpful ...
diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp
index 1e7ebe9a6..d556573c8 100644
--- a/wsd/Admin.hpp
+++ b/wsd/Admin.hpp
@@ -142,6 +142,7 @@ private:
/// Memory consumption has increased, start killing kits etc. till memory consumption gets back
/// under @hardModeLimit
void triggerMemoryCleanup(size_t hardModeLimit);
+ void notifyDocsMemDirtyChanged();
/// Round the interval up to multiples of MinStatsIntervalMs.
/// This is to avoid arbitrarily small intervals that hammer the server.
diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp
index 9579a4e51..967598cf3 100644
--- a/wsd/AdminModel.cpp
+++ b/wsd/AdminModel.cpp
@@ -134,16 +134,18 @@ std::string Document::to_string() const
return oss.str();
}
-int Document::getMemoryDirty() const
+void Document::updateMemoryDirty()
{
// Avoid accessing smaps too often
const time_t now = std::time(nullptr);
if (now - _lastTimeSMapsRead >= 5)
{
+ int lastMemDirty = _memoryDirty;
_memoryDirty = _procSMaps ? Util::getPssAndDirtyFromSMaps(_procSMaps).second : 0;
_lastTimeSMapsRead = now;
+ if (lastMemDirty != _memoryDirty)
+ _hasMemDirtyChanged = true;
}
- return _memoryDirty;
}
bool Subscriber::notify(const std::string& message)
@@ -1041,4 +1043,25 @@ std::set<pid_t> AdminModel::getDocumentPids() const
return pids;
}
+void AdminModel::UpdateMemoryDirty()
+{
+ for (const auto& it: _documents)
+ {
+ it.second->updateMemoryDirty();
+ }
+}
+
+void AdminModel::notifyDocsMemDirtyChanged()
+{
+ for (const auto& it: _documents)
+ {
+ int memoryDirty = it.second->getMemoryDirty();
+ if (it.second->hasMemDirtyChanged())
+ {
+ notify("propchange " + std::to_string(it.second->getPid()) + " mem " + std::to_string(memoryDirty));
+ it.second->setMemDirtyChanged(false);
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wsd/AdminModel.hpp b/wsd/AdminModel.hpp
index ae88ef8cd..98bd01495 100644
--- a/wsd/AdminModel.hpp
+++ b/wsd/AdminModel.hpp
@@ -121,7 +121,8 @@ public:
_wopiUploadDuration(0),
_procSMaps(nullptr),
_lastTimeSMapsRead(0),
- _isModified(false)
+ _isModified(false),
+ _hasMemDirtyChanged(true)
{
}
@@ -155,7 +156,8 @@ public:
const std::map<std::string, View>& getViews() const { return _views; }
void updateLastActivityTime() { _lastActivity = std::time(nullptr); }
- int getMemoryDirty() const;
+ void updateMemoryDirty();
+ int getMemoryDirty() const { return _memoryDirty; }
std::pair<std::time_t, std::string> getSnapshot() const;
const std::string getHistory() const;
@@ -182,6 +184,8 @@ public:
void setWopiUploadDuration(const std::chrono::milliseconds wopiUploadDuration) { _wopiUploadDuration = wopiUploadDuration; }
std::chrono::milliseconds getWopiUploadDuration() const { return _wopiUploadDuration; }
void setProcSMapsFD(const int smapsFD) { _procSMaps = fdopen(smapsFD, "r"); }
+ bool hasMemDirtyChanged() const { return _hasMemDirtyChanged; }
+ void setMemDirtyChanged(bool changeStatus) { _hasMemDirtyChanged = changeStatus; }
std::string to_string() const;
@@ -195,7 +199,7 @@ private:
/// Hosted filename
std::string _filename;
/// The dirty (ie. un-shared) memory of the document's Kit process.
- mutable int _memoryDirty;
+ int _memoryDirty;
/// Last noted Jiffy count
unsigned _lastJiffy;
@@ -212,11 +216,12 @@ private:
std::chrono::milliseconds _wopiUploadDuration;
FILE* _procSMaps;
- mutable std::time_t _lastTimeSMapsRead;
+ std::time_t _lastTimeSMapsRead;
/// Per-doc kit process settings.
DocProcSettings _docProcSettings;
bool _isModified;
+ bool _hasMemDirtyChanged;
};
/// An Admin session subscriber.
@@ -337,6 +342,8 @@ public:
void getMetrics(std::ostringstream &oss);
std::set<pid_t> getDocumentPids() const;
+ void UpdateMemoryDirty();
+ void notifyDocsMemDirtyChanged();
static int getPidsFromProcName(const std::regex& procNameRegEx, std::vector<int> *pids);
More information about the Libreoffice-commits
mailing list