diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-22 20:57:40 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-25 10:55:10 -0500 |
commit | e00562d9835bd82d74ef0301ea7425ff769915df (patch) | |
tree | 60a1b5331b09171a852c318afbcc7f4d7b8870d7 /sc | |
parent | 8e5fd4a15ae2c7d55842b1b768b7807a2d3a298e (diff) |
Allow worker threads to use their own FastParser instances.
To prevent deadlock during threaded sheet stream parsing. It now
deadlocks at a different place.
Change-Id: I0ba0f2c9a257e71b0a340ab14e369b06d5fd8829
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/workbookhelper.hxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookfragment.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 7 |
3 files changed, 18 insertions, 4 deletions
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index abafb20b7421..1f472c3860f6 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -53,6 +53,7 @@ namespace oox { namespace core { class FilterBase; class FragmentHandler; class XmlFilterBase; + class FastParser; } } class ScDocument; @@ -269,7 +270,10 @@ public: /** Imports a fragment using the passed fragment handler, which contains the full path to the fragment stream. */ - bool importOoxFragment( const ::rtl::Reference< ::oox::core::FragmentHandler >& rxHandler ); + bool importOoxFragment( const rtl::Reference<oox::core::FragmentHandler>& rxHandler ); + + bool importOoxFragment( const rtl::Reference<oox::core::FragmentHandler>& rxHandler, oox::core::FastParser& rParser ); + // BIFF2-BIFF8 specific (MUST NOT be called in OOXML/BIFF12 filter) ------- diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index e9471cbdd624..81eb2ed62ffd 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -49,6 +49,7 @@ #include "globstr.hrc" #include "calcconfig.hxx" +#include <oox/core/fastparser.hxx> #include <comphelper/processfactory.hxx> #include <officecfg/Office/Calc.hxx> #include <salhelper/thread.hxx> @@ -240,13 +241,17 @@ class WorkerThread : public salhelper::Thread WorkbookFragment& mrWorkbookHandler; size_t mnID; FragmentHandlerRef mxHandler; + boost::scoped_ptr<oox::core::FastParser> mxParser; osl::Mutex maMtxAction; osl::Condition maCondActionChanged; WorkerAction meAction; public: WorkerThread( WorkbookFragment& rWorkbookHandler, size_t nID ) : salhelper::Thread("sheet-import-worker-thread"), - mrWorkbookHandler(rWorkbookHandler), mnID(nID), meAction(None) {} + mrWorkbookHandler(rWorkbookHandler), + mnID(nID), + mxParser(rWorkbookHandler.getOoxFilter().createParser()), + meAction(None) {} virtual void execute() { @@ -271,7 +276,7 @@ public: #if 0 // TODO : This still deadlocks in the fast parser code. - mrWorkbookHandler.importOoxFragment(mxHandler); + mrWorkbookHandler.importOoxFragment(mxHandler, *mxParser); #else double val = rand() / static_cast<double>(RAND_MAX); val *= 1000000; // normalize to 1 second. diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 33270e5b13a4..66a51b4e0072 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -961,11 +961,16 @@ XmlFilterBase& WorkbookHelper::getOoxFilter() const return mrBookGlob.getOoxFilter(); } -bool WorkbookHelper::importOoxFragment( const ::rtl::Reference< FragmentHandler >& rxHandler ) +bool WorkbookHelper::importOoxFragment( const rtl::Reference<FragmentHandler>& rxHandler ) { return getOoxFilter().importFragment( rxHandler ); } +bool WorkbookHelper::importOoxFragment( const rtl::Reference<FragmentHandler>& rxHandler, oox::core::FastParser& rParser ) +{ + return getOoxFilter().importFragment(rxHandler, rParser); +} + // BIFF specific -------------------------------------------------------------- BiffType WorkbookHelper::getBiff() const |