diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-07 13:01:40 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-11 16:17:27 -0500 |
commit | 82d6b0c64698e356a950d9b516ca5332817b71a3 (patch) | |
tree | 29e9c438c04c92451e792ddfa87a21f625ef6d21 | |
parent | 7f18186a9c2e381f383f14b55d8c15676d71cb1a (diff) |
Move the API guard out of the worker threads onto the manager thread.
Just set this once before spawning multiple worker threads.
Change-Id: I9cb60721f633f939d4a95f1d80e2ed8e4542a8fa
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index c3e1d24f1b0c..f58e9f739a71 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -107,7 +107,6 @@ void applyCellFormulas( ScDocumentImport& rDoc, SvNumberFormatter& rFormatter, const std::vector<FormulaBuffer::TokenAddressItem>& rCells ) { - ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc()); std::vector<FormulaBuffer::TokenAddressItem>::const_iterator it = rCells.begin(), itEnd = rCells.end(); for (; it != itEnd; ++it) { @@ -225,8 +224,11 @@ void FormulaBuffer::FinalizeThread::execute() { ScDocumentImport& rDoc = mrParent.getDocImport(); rDoc.getDoc().SetAutoNameCache(new ScAutoNameCache(&rDoc.getDoc())); + ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc()); + SCTAB nTabCount = rDoc.getDoc().GetTableCount(); + // Fetch all the formulas to process first. std::vector<SheetItem> aSheetItems; aSheetItems.reserve(nTabCount); for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) @@ -238,6 +240,10 @@ void FormulaBuffer::FinalizeThread::execute() std::vector<SheetItem>::iterator it = aSheetItems.begin(), itEnd = aSheetItems.end(); + // TODO: Right now we are spawning multiple threads all at once and block + // on them all at once. Any more clever thread management would require + // use of condition variables which our own osl thread framework seems to + // lack. while (it != itEnd) { for (size_t i = 0; i < mnThreadCount; ++i) |