LCOV - code coverage report
Current view: top level - ucb/source/ucp/webdav-neon - NeonLockStore.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 7 0.0 %
Date: 2014-11-03 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*************************************************************************
       3             :  *
       4             :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5             :  *
       6             :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7             :  *
       8             :  * OpenOffice.org - a multi-platform office productivity suite
       9             :  *
      10             :  * This file is part of OpenOffice.org.
      11             :  *
      12             :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13             :  * it under the terms of the GNU Lesser General Public License version 3
      14             :  * only, as published by the Free Software Foundation.
      15             :  *
      16             :  * OpenOffice.org is distributed in the hope that it will be useful,
      17             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19             :  * GNU Lesser General Public License version 3 for more details
      20             :  * (a copy is included in the LICENSE file that accompanied this code).
      21             :  *
      22             :  * You should have received a copy of the GNU Lesser General Public License
      23             :  * version 3 along with OpenOffice.org.  If not, see
      24             :  * <http://www.openoffice.org/license.html>
      25             :  * for a copy of the LGPLv3 License.
      26             :  *
      27             :  ************************************************************************/
      28             : #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
      29             : #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
      30             : 
      31             : #include <config_lgpl.h>
      32             : #include <map>
      33             : 
      34             : #include <ne_locks.h>
      35             : 
      36             : #include "osl/mutex.hxx"
      37             : #include "rtl/ref.hxx"
      38             : #include "NeonTypes.hxx"
      39             : 
      40             : namespace webdav_ucp
      41             : {
      42             : 
      43             : class TickerThread;
      44             : class NeonSession;
      45             : 
      46             : struct ltptr
      47             : {
      48           0 :     bool operator()( const NeonLock * p1, const NeonLock * p2 ) const
      49             :     {
      50           0 :         return p1 < p2;
      51             :     }
      52             : };
      53             : 
      54           0 : typedef struct _LockInfo
      55             : {
      56             :     rtl::Reference< NeonSession > xSession;
      57             :     sal_Int32 nLastChanceToSendRefreshRequest;
      58             : 
      59           0 :     _LockInfo()
      60           0 :         : nLastChanceToSendRefreshRequest( -1 ) {}
      61             : 
      62           0 :     _LockInfo( rtl::Reference< NeonSession > const & _xSession,
      63             :               sal_Int32 _nLastChanceToSendRefreshRequest )
      64             :     : xSession( _xSession ),
      65           0 :       nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
      66             : 
      67             : } LockInfo;
      68             : 
      69             : typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap;
      70             : 
      71             : class NeonLockStore
      72             : {
      73             :     osl::Mutex         m_aMutex;
      74             :     ne_lock_store    * m_pNeonLockStore;
      75             :     rtl::Reference< TickerThread > m_pTickerThread;
      76             :     LockInfoMap        m_aLockInfoMap;
      77             : 
      78             : public:
      79             :     NeonLockStore();
      80             :     ~NeonLockStore();
      81             : 
      82             :     void registerSession( HttpSession * pHttpSession );
      83             : 
      84             :     NeonLock * findByUri( OUString const & rUri );
      85             : 
      86             :     void addLock( NeonLock * pLock,
      87             :                   rtl::Reference< NeonSession > const & xSession,
      88             :                   // time in seconds since Jan 1 1970
      89             :                   // -1: infinite lock, no refresh
      90             :                   sal_Int32 nLastChanceToSendRefreshRequest );
      91             : 
      92             :     void updateLock( NeonLock * pLock,
      93             :                      sal_Int32 nLastChanceToSendRefreshRequest );
      94             : 
      95             :     void removeLock( NeonLock * pLock );
      96             : 
      97             :     void refreshLocks();
      98             : 
      99             : private:
     100             :     void startTicker();
     101             :     void stopTicker(osl::ClearableMutexGuard & rGuard);
     102             : };
     103             : 
     104             : } // namespace webdav_ucp
     105             : 
     106             : #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10