diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-09-17 15:56:38 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-19 17:03:24 +0200 |
commit | 80a4a753c5accfea756c4b357fc1586e8afbead8 (patch) | |
tree | 5f562d3104109608dc9db9a20ff16fcf233f5cb3 | |
parent | 8f56dc0bf547c20404f98493e49dc88bf454a604 (diff) |
Pre-compile OpenCL kernels during xlsx file load as well.
Change-Id: Id31190b2a9eb496f146fbbeaaf8a223d46492a99
-rw-r--r-- | sc/source/filter/inc/workbookhelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 23 |
3 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index e540ba0d8038..9ea2353dc6a1 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -275,6 +275,8 @@ public: /** Returns the codec helper that stores the encoder/decoder object. */ BiffCodecHelper& getCodecHelper() const; + void compileOpenCLKernels(); + private: WorkbookGlobals& mrBookGlob; }; diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 21e383fe97b7..cc8a50a8492e 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -65,6 +65,7 @@ void FormulaBuffer::finalizeImport() FormulaDataMap::iterator cellIt = maCellFormulas.find( nTab ); if ( cellIt != maCellFormulas.end() ) { + compileOpenCLKernels(); applyCellFormulas( cellIt->second ); } diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 7a9a58f21ee7..9ae6fea6deaf 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -71,6 +71,8 @@ #include "dbdata.hxx" #include "datauno.hxx" #include "globalnames.hxx" +#include "clkernelthread.hxx" +#include "rtl/ref.hxx" #include "formulabuffer.hxx" #include "vcl/mapmod.hxx" @@ -223,6 +225,8 @@ public: /** Returns the codec helper that stores the encoder/decoder object. */ inline BiffCodecHelper& getCodecHelper() { return *mxCodecHelper; } + void compileOpenCLKernels(); + private: /** Initializes some basic members and sets needed document properties. */ void initialize( bool bWorkbookFile ); @@ -253,6 +257,8 @@ private: typedef ::std::auto_ptr< PageSettingsConverter > PageSettConvPtr; typedef ::std::auto_ptr< BiffCodecHelper > BiffCodecHelperPtr; + rtl::Reference<sc::CLBuildKernelThread> mxCLKernelThread; + OUString maCellStyles; /// Style family name for cell styles. OUString maPageStyles; /// Style family name for page styles. OUString maCellStyleServ; /// Service name for a cell style. @@ -504,6 +510,15 @@ void WorkbookGlobals::useInternalChartDataTable( bool bInternal ) // private -------------------------------------------------------------------- +void WorkbookGlobals::compileOpenCLKernels() +{ + if (mxCLKernelThread.is()) + return; + + mxCLKernelThread.set(new sc::CLBuildKernelThread); + mxCLKernelThread->launch(); +} + void WorkbookGlobals::initialize( bool bWorkbookFile ) { maCellStyles = "CellStyles"; @@ -634,6 +649,9 @@ void WorkbookGlobals::finalize() //ScDocShell::AfterXMLLoading() for ods getScDocument().SetInsertingFromOtherDoc(false); getScDocument().RebuildFormulaGroups(); + + if (mxCLKernelThread.is()) + mxCLKernelThread->join(); } } @@ -949,6 +967,11 @@ BiffCodecHelper& WorkbookHelper::getCodecHelper() const return mrBookGlob.getCodecHelper(); } +void WorkbookHelper::compileOpenCLKernels() +{ + mrBookGlob.compileOpenCLKernels(); +} + // ============================================================================ } // namespace xls |