wsd: simplify DocumentBroker construction

Change-Id: I5e908f0f5aed9146e14175eb79335fe9c80db2f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
pull/8691/head
Ashod Nakashian 2024-03-24 09:15:54 -04:00 committed by Michael Meeks
parent 062574341f
commit de985834e2
3 changed files with 19 additions and 19 deletions

View File

@ -174,7 +174,7 @@ findOrCreateDocBroker(DocumentBroker::ChildType type, const std::string& uri,
// Set the one we just created.
LOG_DBG("New DocumentBroker for docKey [" << docKey << ']');
docBroker = std::make_shared<DocumentBroker>(type, uri, uriPublic, docKey, mobileAppDocId);
docBroker = std::make_shared<DocumentBroker>(type, uri, uriPublic, docKey, mobileAppDocId, nullptr);
DocBrokers.emplace(docKey, docBroker);
LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after inserting [" << docKey << ']');
}

View File

@ -146,7 +146,8 @@ public:
std::atomic<unsigned> DocumentBroker::DocBrokerId(1);
DocumentBroker::DocumentBroker(ChildType type, const std::string& uri, const Poco::URI& uriPublic,
const std::string& docKey, unsigned mobileAppDocId)
const std::string& docKey, unsigned mobileAppDocId,
std::unique_ptr<WopiStorage::WOPIFileInfo> wopiFileInfo)
: _limitLifeSeconds(std::chrono::seconds::zero())
, _uriOrig(uri)
, _type(type)
@ -204,17 +205,13 @@ DocumentBroker::DocumentBroker(ChildType type, const std::string& uri, const Poc
{
_unitWsd->onDocBrokerCreate(_docKey);
}
}
DocumentBroker::DocumentBroker(ChildType type, const std::string& uri, const Poco::URI& uriPublic,
const std::string& docKey,
std::unique_ptr<WopiStorage::WOPIFileInfo> wopiFileInfo)
: DocumentBroker(type, uri, uriPublic, docKey, /*mobileAppDocId=*/0)
{
_initialWopiFileInfo = std::move(wopiFileInfo);
LOG_DBG("Starting DocBrokerPoll thread");
_poll->startThread();
if (_initialWopiFileInfo)
{
LOG_DBG("Starting DocBrokerPoll thread");
_poll->startThread();
}
}
void DocumentBroker::setupPriorities()

View File

@ -296,17 +296,20 @@ public:
Interactive, Batch
};
DocumentBroker(ChildType type,
const std::string& uri,
const Poco::URI& uriPublic,
const std::string& docKey,
unsigned mobileAppDocId = 0);
/// Overloaded for early loading.
DocumentBroker(ChildType type, const std::string& uri, const Poco::URI& uriPublic,
const std::string& docKey,
const std::string& docKey, unsigned mobileAppDocId,
std::unique_ptr<WopiStorage::WOPIFileInfo> wopiFileInfo);
protected:
/// Used by derived classes.
DocumentBroker(ChildType type, const std::string& uri, const Poco::URI& uriPublic,
const std::string& docKey)
: DocumentBroker(type, uri, uriPublic, docKey, /*mobileAppDocId=*/0,
/*wopiFileInfo=*/nullptr)
{
}
public:
virtual ~DocumentBroker();
/// Called when removed from the DocBrokers list