diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-21 16:00:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-22 12:27:55 +0100 |
commit | 27352b81638f2f1e792ab48ec532eaacf6f61718 (patch) | |
tree | eb744c30643272b219d59f2782ffc96f62bf379c /connectivity/source/drivers | |
parent | 6ccdd0d164b16da9a13ab5d8290a1a0f041caaf7 (diff) |
Add XWeak constructor and operator= to uno::WeakReference
which is faster since we can skip the UNO_QUERY.
Change-Id: Id95ad9f3568213e974bd13659d92d4ea94dbfbd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130282
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/drivers')
7 files changed, 9 insertions, 12 deletions
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index 5816f6456a32..bb5bda634cfc 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -53,7 +53,6 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet :ODatabaseMetaDataResultSet_BASE(m_aMutex) ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper) ,m_pRecordSet(_pRecordSet) - ,m_aStatement(nullptr) ,m_nRowPos(0) ,m_bWasNull(false) ,m_bEOF(false) @@ -88,7 +87,7 @@ void ODatabaseMetaDataResultSet::disposing() ::osl::MutexGuard aGuard(m_aMutex); if(m_pRecordSet) m_pRecordSet->Close(); - m_aStatement = nullptr; + m_aStatement.clear(); m_xMetaData.clear(); } diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index e6a43dab7687..53b50a5c3c1a 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -914,8 +914,7 @@ Reference< XInterface > SAL_CALL OEvoabResultSet::getStatement( ) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - css::uno::WeakReferenceHelper aStatement(static_cast<OWeakObject*>(m_pStatement)); - return aStatement.get(); + return static_cast<cppu::OWeakObject*>(m_pStatement); } diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 1f3e21a2ef90..8e556800871b 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -614,7 +614,7 @@ Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryDa pResult->construct( _rQueryData ); // done - m_xResultSet = pResult; + m_xResultSet = Reference<XWeak>(pResult); return pResult; } diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 79c69b3ee62e..2ae516800b06 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -100,7 +100,7 @@ rtl::Reference<OResultSet> OPreparedStatement::makeResultSet() closeResultSet(); rtl::Reference<OResultSet> xResultSet(createResultSet()); - m_xResultSet = xResultSet; + m_xResultSet = uno::Reference<uno::XWeak>(xResultSet); initializeResultSet(xResultSet.get()); initResultSet(xResultSet.get()); return xResultSet; diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx index 24208ae244af..90d0e3d8746a 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx @@ -183,7 +183,7 @@ OPreparedResultSet::OPreparedResultSet(OConnection& rConn, OPreparedStatement* p : OPreparedResultSet_BASE(m_aMutex) , OPropertySetHelper(OPreparedResultSet_BASE::rBHelper) , m_rConnection(rConn) - , m_aStatement(static_cast<OWeakObject*>(pStmt)) + , m_aStatement(css::uno::Reference<css::uno::XWeak>(static_cast<OWeakObject*>(pStmt))) , m_pStmt(pMyStmt) , m_encoding(rConn.getConnectionEncoding()) , m_nColumnCount(mysql_stmt_field_count(pMyStmt)) @@ -201,7 +201,7 @@ void OPreparedResultSet::disposing() MutexGuard aGuard(m_aMutex); - m_aStatement = nullptr; + m_aStatement.clear(); m_xMetaData = nullptr; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index 348283b56505..182e74b7fcb9 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -107,7 +107,7 @@ OResultSet::OResultSet(OConnection& rConn, OCommonStatement* pStmt, MYSQL_RES* p : OResultSet_BASE(m_aMutex) , OPropertySetHelper(OResultSet_BASE::rBHelper) , m_pMysql(rConn.getMysqlConnection()) - , m_aStatement(static_cast<OWeakObject*>(pStmt)) + , m_aStatement(css::uno::Reference<css::uno::XWeak>(static_cast<OWeakObject*>(pStmt))) , m_pResult(pResult) , m_encoding(_encoding) { @@ -181,7 +181,7 @@ void OResultSet::disposing() mysql_free_result(m_pResult); m_pResult = nullptr; } - m_aStatement = nullptr; + m_aStatement.clear(); m_xMetaData = nullptr; } diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 39a9e39896dc..5fbe8bf8f460 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -47,7 +47,6 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper) ,m_aStatementHandle(_pConnection->createStatementHandle()) - ,m_aStatement(nullptr) ,m_pConnection(_pConnection) ,m_nTextEncoding(_pConnection->getTextEncoding()) ,m_nRowPos(-1) @@ -84,7 +83,7 @@ void ODatabaseMetaDataResultSet::disposing() m_pConnection->freeStatementHandle(m_aStatementHandle); - m_aStatement = nullptr; + m_aStatement.clear(); m_xMetaData.clear(); m_pConnection.clear(); } |