Kaydet (Commit) 9575edc8 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

We don't need to put this in a separate thread.

We can do this on the main thread.

Change-Id: I58a32d9e0ce2599c5822903393a5b698233599df
üst a4a60b67
...@@ -31,20 +31,6 @@ namespace oox { namespace xls { ...@@ -31,20 +31,6 @@ namespace oox { namespace xls {
class FormulaBuffer : public WorkbookHelper class FormulaBuffer : public WorkbookHelper
{ {
class FinalizeThread : public salhelper::Thread
{
FormulaBuffer& mrParent;
size_t mnThreadCount;
public:
FinalizeThread( FormulaBuffer& rParent, size_t nThreadCount );
virtual ~FinalizeThread();
protected:
virtual void execute();
};
friend class FinalizeThread;
public: public:
/** /**
* Represents a shared formula definition. * Represents a shared formula definition.
......
...@@ -214,15 +214,16 @@ FormulaBuffer::SheetItem::SheetItem() : ...@@ -214,15 +214,16 @@ FormulaBuffer::SheetItem::SheetItem() :
mpSharedFormulaEntries(NULL), mpSharedFormulaEntries(NULL),
mpSharedFormulaIDs(NULL) {} mpSharedFormulaIDs(NULL) {}
FormulaBuffer::FinalizeThread::FinalizeThread( FormulaBuffer& rParent, size_t nThreadCount ) : FormulaBuffer::FormulaBuffer( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper )
salhelper::Thread("xlsx-import-formula-buffer-finalize-thread"), {
mrParent(rParent), mnThreadCount(nThreadCount) {} }
FormulaBuffer::FinalizeThread::~FinalizeThread() {}
void FormulaBuffer::FinalizeThread::execute() void FormulaBuffer::finalizeImport()
{ {
ScDocumentImport& rDoc = mrParent.getDocImport(); ISegmentProgressBarRef xFormulaBar = getProgressBar().createSegment( getProgressBar().getFreeLength() );
const size_t nThreadCount = 1;
ScDocumentImport& rDoc = getDocImport();
rDoc.getDoc().SetAutoNameCache(new ScAutoNameCache(&rDoc.getDoc())); rDoc.getDoc().SetAutoNameCache(new ScAutoNameCache(&rDoc.getDoc()));
ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc()); ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc());
...@@ -232,11 +233,11 @@ void FormulaBuffer::FinalizeThread::execute() ...@@ -232,11 +233,11 @@ void FormulaBuffer::FinalizeThread::execute()
std::vector<SheetItem> aSheetItems; std::vector<SheetItem> aSheetItems;
aSheetItems.reserve(nTabCount); aSheetItems.reserve(nTabCount);
for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
aSheetItems.push_back(mrParent.getSheetItem(nTab)); aSheetItems.push_back(getSheetItem(nTab));
typedef rtl::Reference<WorkerThread> WorkerThreadRef; typedef rtl::Reference<WorkerThread> WorkerThreadRef;
std::vector<WorkerThreadRef> aThreads; std::vector<WorkerThreadRef> aThreads;
aThreads.reserve(mnThreadCount); aThreads.reserve(nThreadCount);
std::vector<SheetItem>::iterator it = aSheetItems.begin(), itEnd = aSheetItems.end(); std::vector<SheetItem>::iterator it = aSheetItems.begin(), itEnd = aSheetItems.end();
...@@ -246,7 +247,7 @@ void FormulaBuffer::FinalizeThread::execute() ...@@ -246,7 +247,7 @@ void FormulaBuffer::FinalizeThread::execute()
// lack. // lack.
while (it != itEnd) while (it != itEnd)
{ {
for (size_t i = 0; i < mnThreadCount; ++i) for (size_t i = 0; i < nThreadCount; ++i)
{ {
if (it == itEnd) if (it == itEnd)
break; break;
...@@ -267,21 +268,6 @@ void FormulaBuffer::FinalizeThread::execute() ...@@ -267,21 +268,6 @@ void FormulaBuffer::FinalizeThread::execute()
} }
rDoc.getDoc().SetAutoNameCache(NULL); rDoc.getDoc().SetAutoNameCache(NULL);
}
FormulaBuffer::FormulaBuffer( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper )
{
}
void FormulaBuffer::finalizeImport()
{
ISegmentProgressBarRef xFormulaBar = getProgressBar().createSegment( getProgressBar().getFreeLength() );
rtl::Reference<FinalizeThread> xThreadMgr(new FinalizeThread(*this, 1));
xThreadMgr->launch();
if (xThreadMgr.is())
xThreadMgr->join();
xFormulaBar->setPosition( 1.0 ); xFormulaBar->setPosition( 1.0 );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment