[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - 6 commits - kit/ForKit.cpp kit/Kit.cpp loleaflet/src net/Socket.hpp wsd/Admin.cpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp
Miklos Vajna
vmiklos at collabora.co.uk
Tue Apr 11 14:16:53 UTC 2017
kit/ForKit.cpp | 4 ++++
kit/Kit.cpp | 1 +
loleaflet/src/layer/AnnotationManager.js | 16 +++++++++++++++-
net/Socket.hpp | 2 ++
wsd/Admin.cpp | 2 +-
wsd/DocumentBroker.cpp | 8 ++++----
wsd/DocumentBroker.hpp | 8 ++++----
wsd/LOOLWSD.cpp | 7 ++++---
8 files changed, 35 insertions(+), 13 deletions(-)
New commits:
commit c87c8db954454d5f64336d031ca3d08cb2084c1e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Apr 11 08:54:09 2017 +0200
DocumentBroker: avoid unnecessary copying
Change-Id: Iaa555ed8e347d0e1712c617839f007d0b4f3204b
(cherry picked from commit 8a1f321c8492d6c2824317c7e4be1a3bdfa81665)
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 33f88ef7..e041db70 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -522,7 +522,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
return true;
}
-bool DocumentBroker::saveToStorage(const std::string sessionId,
+bool DocumentBroker::saveToStorage(const std::string& sessionId,
bool success, const std::string& result)
{
assertCorrectThread();
@@ -823,7 +823,7 @@ size_t DocumentBroker::addSession(const std::shared_ptr<ClientSession>& session)
return count;
}
-size_t DocumentBroker::removeSession(const std::string id, bool destroyIfLast)
+size_t DocumentBroker::removeSession(const std::string& id, bool destroyIfLast)
{
assertCorrectThread();
@@ -846,7 +846,7 @@ size_t DocumentBroker::removeSession(const std::string id, bool destroyIfLast)
return _sessions.size();
}
-size_t DocumentBroker::removeSessionInternal(const std::string id)
+size_t DocumentBroker::removeSessionInternal(const std::string& id)
{
assertCorrectThread();
try
@@ -894,7 +894,7 @@ size_t DocumentBroker::removeSessionInternal(const std::string id)
return _sessions.size();
}
-void DocumentBroker::addCallback(SocketPoll::CallbackFn fn)
+void DocumentBroker::addCallback(const SocketPoll::CallbackFn& fn)
{
_poll->addCallback(fn);
}
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 20bdc496..62cb6a95 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -233,7 +233,7 @@ public:
void setLoaded();
/// Save the document to Storage if it needs persisting.
- bool saveToStorage(const std::string sesionId, bool success, const std::string& result = "");
+ bool saveToStorage(const std::string& sesionId, bool success, const std::string& result = "");
bool isModified() const { return _isModified; }
void setModified(const bool value);
@@ -265,10 +265,10 @@ public:
size_t addSession(const std::shared_ptr<ClientSession>& session);
/// Removes a session by ID. Returns the new number of sessions.
- size_t removeSession(const std::string id, bool destroyIfLast = false);
+ size_t removeSession(const std::string& id, bool destroyIfLast = false);
/// Add a callback to be invoked in our polling thread.
- void addCallback(SocketPoll::CallbackFn fn);
+ void addCallback(const SocketPoll::CallbackFn& fn);
/// Transfer this socket into our polling thread / loop.
void addSocketToPoll(const std::shared_ptr<Socket>& socket);
@@ -342,7 +342,7 @@ private:
bool saveToStorageInternal(const std::string& sesionId, bool success, const std::string& result = "");
/// Removes a session by ID. Returns the new number of sessions.
- size_t removeSessionInternal(const std::string id);
+ size_t removeSessionInternal(const std::string& id);
/// Forward a message from child session to its respective client session.
bool forwardToClient(const std::shared_ptr<Message>& payload);
commit f6c91d8edd074bbb23d343e9c19ebe4be6f6c017
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Apr 10 10:44:11 2017 +0200
wsd: make requestURI a const reference
It's copy-constructed from a const reference but is only used as const
reference.
Change-Id: I9a58561616bcfeff0c45803f3244f8e78d54731a
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 78da7ac1..a9039f2b 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -253,7 +253,7 @@ bool AdminSocketHandler::handleInitialRequest(
// Different session id pool for admin sessions (?)
const auto sessionId = Util::decodeId(LOOLWSD::GenSessionId());
- std::string requestURI = request.getURI();
+ const std::string& requestURI = request.getURI();
StringTokenizer pathTokens(requestURI, "/", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
if (request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0)
commit 229c02be3155c063b6413ce98b2ad1175bd94b86
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Apr 10 21:43:42 2017 -0400
loleaflet: add line between the currently selected comment ...
and the associated selection
Change-Id: I58d548f78e9d6594336abed8e77993d2fafe867e
(cherry picked from commit 7521e9bb91993af2dfbe7cf3a1507b32b9e5b906)
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 8308d485..8f178357 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -5,13 +5,15 @@
L.AnnotationManager = L.Class.extend({
options: {
marginX: 50,
- marginY: 10
+ marginY: 10,
+ offset: 5
},
initialize: function (map) {
this._map = map;
this._items = [];
this._selected = null;
+ this._arrow = L.polyline([], {color: 'darkblue', weight: 1});
this._map.on('AnnotationCancel', this._onAnnotationCancel, this);
this._map.on('AnnotationClick', this._onAnnotationClick, this);
this._map.on('AnnotationReply', this._onAnnotationReply, this);
@@ -29,6 +31,7 @@ L.AnnotationManager = L.Class.extend({
}
this._items = [];
this._selected = null;
+ this._map.removeLayer(this._arrow);
},
// Remove only change tracking comments from the document
@@ -146,6 +149,17 @@ L.AnnotationManager = L.Class.extend({
},
update: function () {
+ if (this._selected) {
+ var point0, point1, point2;
+ var topRight = this._map.project(this._map.options.maxBounds.getNorthEast());
+ point0 = this._map._docLayer._twipsToPixels(this._selected._data.anchorPos.max);
+ point1 = L.point(point0.x, point0.y + this.options.offset);
+ point2 = L.point(topRight.x, point1.y);
+ this._arrow.setLatLngs([this._map.unproject(point0), this._map.unproject(point1), this._map.unproject(point2)]);
+ this._map.addLayer(this._arrow);
+ } else {
+ this._map.removeLayer(this._arrow);
+ }
this.layout();
},
commit e20d068881ad30a709eb0824bb30aaa177090a43
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Apr 8 13:31:07 2017 +0100
Clear display to avoid potential problems.
Running --nocaps under massif; it is unexpected to see
fire_glxtest_process doing heavy lifting glx work.
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 59da5d64..035f69a9 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -453,6 +453,10 @@ int main(int argc, char** argv)
"user:*file://" LOOLWSD_CONFIGDIR "/loolkitconfig.xcu "
#endif
);
+
+ // No-caps tracing can spawn eg. glxinfo & other oddness.
+ unsetenv("DISPLAY");
+
::setenv("CONFIGURATION_LAYERS", layers.c_str(),
1 /* override */);
commit 8a0727c2a8fe6cd7ddec12d5581b7ce16f19295c
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Apr 7 22:33:01 2017 +0100
Re-allocate vector storage to compressed size.
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 6717c677..121f20e8 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -373,6 +373,7 @@ class PngCache
{
if (hash)
{
+ newEntry._data->shrink_to_fit();
_cache.emplace(hash, newEntry);
_cacheSize += newEntry._data->size();
}
commit 1a6bdb6ca332e08be887b6e4c55100c1388f83e3
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Apr 7 20:47:10 2017 +0100
Clear ownership of socket while it is being transferred.
This addresses a gap between ServerSocket accepting new sockets,
and their being added to their new polls.
diff --git a/net/Socket.hpp b/net/Socket.hpp
index f2c65d0c..89844912 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -454,6 +454,8 @@ public:
{
std::lock_guard<std::mutex> lock(_mutex);
LOG_DBG("Inserting socket #" << newSocket->getFD() << " into " << _name);
+ // sockets in transit are un-owned.
+ newSocket->setThreadOwner(std::thread::id(0));
_newSockets.emplace_back(newSocket);
wakeup();
}
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7b54bfd2..d5a7fd0b 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1449,12 +1449,13 @@ private:
UnitWSD::get().newChild(*this);
auto child = std::make_shared<ChildProcess>(pid, socket, request);
- _childProcess = child; // weak
- addNewChild(child);
- // We no longer own this socket.
+ // Drop pretentions of ownership before adding to the list.
socket->setThreadOwner(std::thread::id(0));
+ _childProcess = child; // weak
+ addNewChild(child);
+
// Remove from prisoner poll since there is no activity
// until we attach the childProcess (with this socket)
// to a docBroker, which will do the polling.
More information about the Libreoffice-commits
mailing list