1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
25 #include <rtl/ref.hxx>
26 #include <rtl/ustring.hxx>
27 #include <com/sun/star/ucb/Lock.hpp>
30 #include "CurlSession.hxx"
32 namespace http_dav_ucp
40 css::ucb::Lock m_Lock
;
41 rtl::Reference
<CurlSession
> m_xSession
;
42 sal_Int32 m_nLastChanceToSendRefreshRequest
;
45 : m_nLastChanceToSendRefreshRequest( -1 ) {}
47 LockInfo( OUString sToken
,
49 rtl::Reference
<CurlSession
> xSession
,
50 sal_Int32 nLastChanceToSendRefreshRequest
)
51 : m_sToken(std::move(sToken
))
52 , m_Lock(std::move(aLock
))
53 , m_xSession(std::move(xSession
))
54 , m_nLastChanceToSendRefreshRequest(nLastChanceToSendRefreshRequest
)
58 typedef std::map
< OUString
, LockInfo
> LockInfoMap
;
63 rtl::Reference
< TickerThread
> m_pTickerThread
;
64 LockInfoMap m_aLockInfoMap
;
70 OUString
const* getLockTokenForURI(OUString
const& rURI
, css::ucb::Lock
const* pLock
);
72 void addLock( const OUString
& rURI
,
73 css::ucb::Lock
const& rLock
,
74 const OUString
& sToken
,
75 rtl::Reference
<CurlSession
> const & xSession
,
76 // time in seconds since Jan 1 1970
77 // -1: infinite lock, no refresh
78 sal_Int32 nLastChanceToSendRefreshRequest
);
80 void removeLock(const OUString
& rURI
);
85 void removeLockImpl(std::unique_lock
<std::mutex
> & rGuard
, const OUString
& rURI
);
87 void stopTicker(std::unique_lock
<std::mutex
> & rGuard
);
90 } // namespace http_dav_ucp
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */