From 80a4a753c5accfea756c4b357fc1586e8afbead8 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 17 Sep 2013 15:56:38 -0400 Subject: Pre-compile OpenCL kernels during xlsx file load as well. Change-Id: Id31190b2a9eb496f146fbbeaaf8a223d46492a99 --- sc/source/filter/inc/workbookhelper.hxx | 2 ++ sc/source/filter/oox/formulabuffer.cxx | 1 + sc/source/filter/oox/workbookhelper.cxx | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+) 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 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 -- cgit v1.2.3