DAVSessionFactory.cxx (421ed02e) DAVSessionFactory.cxx (51ba086b)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_webdav.hxx"
26#include "DAVSessionFactory.hxx"
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_webdav.hxx"
26#include "DAVSessionFactory.hxx"
27#include "SerfSession.hxx"
28#include "SerfUri.hxx"
27#include "CurlSession.hxx"
28#include "CurlUri.hxx"
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
30
31using namespace http_dav_ucp;
32using namespace com::sun::star;
33
34DAVSessionFactory::~DAVSessionFactory()
35{
36}

--- 18 unchanged lines hidden (view full) ---

55 if ( (*aIt).second->CanUse( inUri ) )
56 break;
57
58 ++aIt;
59 }
60
61 if ( aIt == aEnd )
62 {
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
30
31using namespace http_dav_ucp;
32using namespace com::sun::star;
33
34DAVSessionFactory::~DAVSessionFactory()
35{
36}

--- 18 unchanged lines hidden (view full) ---

55 if ( (*aIt).second->CanUse( inUri ) )
56 break;
57
58 ++aIt;
59 }
60
61 if ( aIt == aEnd )
62 {
63 SerfUri aURI( inUri );
63 CurlUri aURI( inUri );
64
65 std::auto_ptr< DAVSession > xElement(
64
65 std::auto_ptr< DAVSession > xElement(
66 new SerfSession( this, inUri, *m_xProxyDecider.get() ) );
66 new CurlSession( this, inUri, *m_xProxyDecider.get() ) );
67
68 aIt = m_aMap.insert( Map::value_type( inUri, xElement.get() ) ).first;
69 aIt->second->m_aContainerIt = aIt;
70 xElement.release();
71 return aIt->second;
72 }
73 else if ( osl_incrementInterlockedCount( &aIt->second->m_nRefCount ) > 1 )
74 {

--- 4 unchanged lines hidden (view full) ---

79 else
80 {
81 osl_decrementInterlockedCount( &aIt->second->m_nRefCount );
82 aIt->second->m_aContainerIt = m_aMap.end();
83
84 // If URL scheme is different from http or https we definitely
85 // have to use a proxy and therefore can optimize the getProxy
86 // call a little:
67
68 aIt = m_aMap.insert( Map::value_type( inUri, xElement.get() ) ).first;
69 aIt->second->m_aContainerIt = aIt;
70 xElement.release();
71 return aIt->second;
72 }
73 else if ( osl_incrementInterlockedCount( &aIt->second->m_nRefCount ) > 1 )
74 {

--- 4 unchanged lines hidden (view full) ---

79 else
80 {
81 osl_decrementInterlockedCount( &aIt->second->m_nRefCount );
82 aIt->second->m_aContainerIt = m_aMap.end();
83
84 // If URL scheme is different from http or https we definitely
85 // have to use a proxy and therefore can optimize the getProxy
86 // call a little:
87 SerfUri aURI( inUri );
87 CurlUri aURI( inUri );
88
88
89 aIt->second = new SerfSession( this, inUri, *m_xProxyDecider.get() );
89 aIt->second = new CurlSession( this, inUri, *m_xProxyDecider.get() );
90 aIt->second->m_aContainerIt = aIt;
91 return aIt->second;
92 }
93}
94
95void DAVSessionFactory::releaseElement( DAVSession * pElement ) SAL_THROW(())
96{
97 OSL_ASSERT( pElement );
98 osl::MutexGuard aGuard( m_aMutex );
99 if ( pElement->m_aContainerIt != m_aMap.end() )
100 m_aMap.erase( pElement->m_aContainerIt );
101}
102
90 aIt->second->m_aContainerIt = aIt;
91 return aIt->second;
92 }
93}
94
95void DAVSessionFactory::releaseElement( DAVSession * pElement ) SAL_THROW(())
96{
97 OSL_ASSERT( pElement );
98 osl::MutexGuard aGuard( m_aMutex );
99 if ( pElement->m_aContainerIt != m_aMap.end() )
100 m_aMap.erase( pElement->m_aContainerIt );
101}
102