LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/ucb/source/ucp/webdav-neon - NeonLockStore.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2013-07-09 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_NEONLOCKSTORE_HXX
      29             : #define INCLUDED_NEONLOCKSTORE_HXX
      30             : 
      31             : #include <config_lgpl.h>
      32             : #include <map>
      33             : #include "warnings_guard_ne_locks.h"
      34             : #include "osl/mutex.hxx"
      35             : #include "rtl/ref.hxx"
      36             : #include "NeonTypes.hxx"
      37             : 
      38             : namespace webdav_ucp
      39             : {
      40             : 
      41             : class TickerThread;
      42             : class NeonSession;
      43             : 
      44             : struct ltptr
      45             : {
      46           0 :     bool operator()( const NeonLock * p1, const NeonLock * p2 ) const
      47             :     {
      48           0 :         return p1 < p2;
      49             :     }
      50             : };
      51             : 
      52           0 : typedef struct _LockInfo
      53             : {
      54             :     rtl::Reference< NeonSession > xSession;
      55             :     sal_Int32 nLastChanceToSendRefreshRequest;
      56             : 
      57           0 :     _LockInfo()
      58           0 :         : nLastChanceToSendRefreshRequest( -1 ) {}
      59             : 
      60           0 :     _LockInfo( rtl::Reference< NeonSession > const & _xSession,
      61             :               sal_Int32 _nLastChanceToSendRefreshRequest )
      62             :     : xSession( _xSession ),
      63           0 :       nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
      64             : 
      65             : } LockInfo;
      66             : 
      67             : typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap;
      68             : 
      69             : class NeonLockStore
      70             : {
      71             :     osl::Mutex         m_aMutex;
      72             :     ne_lock_store    * m_pNeonLockStore;
      73             :     rtl::Reference< TickerThread > m_pTickerThread;
      74             :     LockInfoMap        m_aLockInfoMap;
      75             : 
      76             : public:
      77             :     NeonLockStore();
      78             :     ~NeonLockStore();
      79             : 
      80             :     void registerSession( HttpSession * pHttpSession );
      81             : 
      82             :     NeonLock * findByUri( OUString const & rUri );
      83             : 
      84             :     void addLock( NeonLock * pLock,
      85             :                   rtl::Reference< NeonSession > const & xSession,
      86             :                   // time in seconds since Jan 1 1970
      87             :                   // -1: infinite lock, no refresh
      88             :                   sal_Int32 nLastChanceToSendRefreshRequest );
      89             : 
      90             :     void updateLock( NeonLock * pLock,
      91             :                      sal_Int32 nLastChanceToSendRefreshRequest );
      92             : 
      93             :     void removeLock( NeonLock * pLock );
      94             : 
      95             :     void refreshLocks();
      96             : 
      97             : private:
      98             :     void startTicker();
      99             :     void stopTicker(osl::ClearableMutexGuard & rGuard);
     100             : };
     101             : 
     102             : } // namespace webdav_ucp
     103             : 
     104             : #endif // INCLUDED_NEONLOCKSTORE_HXX
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10