fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / webdav-neon / NeonLockStore.hxx
blob1006f8ad4bed0ea7d5ada8c144a273c372c38589
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
28 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
29 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
31 #include <config_lgpl.h>
32 #include <map>
34 #include <ne_locks.h>
36 #include "osl/mutex.hxx"
37 #include "rtl/ref.hxx"
38 #include "NeonTypes.hxx"
40 namespace webdav_ucp
43 class TickerThread;
44 class NeonSession;
46 struct ltptr
48 bool operator()( const NeonLock * p1, const NeonLock * p2 ) const
50 return p1 < p2;
54 typedef struct _LockInfo
56 rtl::Reference< NeonSession > xSession;
57 sal_Int32 nLastChanceToSendRefreshRequest;
59 _LockInfo()
60 : nLastChanceToSendRefreshRequest( -1 ) {}
62 _LockInfo( rtl::Reference< NeonSession > const & _xSession,
63 sal_Int32 _nLastChanceToSendRefreshRequest )
64 : xSession( _xSession ),
65 nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
67 } LockInfo;
69 typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap;
71 class NeonLockStore
73 osl::Mutex m_aMutex;
74 ne_lock_store * m_pNeonLockStore;
75 rtl::Reference< TickerThread > m_pTickerThread;
76 LockInfoMap m_aLockInfoMap;
78 public:
79 NeonLockStore();
80 ~NeonLockStore();
82 void registerSession( HttpSession * pHttpSession );
84 NeonLock * findByUri( OUString const & rUri );
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 );
92 void updateLock( NeonLock * pLock,
93 sal_Int32 nLastChanceToSendRefreshRequest );
95 void removeLock( NeonLock * pLock );
97 void refreshLocks();
99 private:
100 void startTicker();
101 void stopTicker(osl::ClearableMutexGuard & rGuard);
104 } // namespace webdav_ucp
106 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONLOCKSTORE_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */