merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / mozab / bootstrap / MNSRunnable.cxx
blobfce47b0d26e9f3f4c800aadeb31eef5134ef53ac
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MNSRunnable.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "MNSRunnable.hxx"
34 #include "MDatabaseMetaDataHelper.hxx"
35 #include "MQuery.hxx"
36 #include <osl/mutex.hxx>
37 #include <osl/conditn.hxx>
39 #include "pre_include_mozilla.h"
40 #include <nsIProxyObjectManager.h>
41 // More Mozilla includes for LDAP Connection Test
42 #include "prprf.h"
43 #include "nsILDAPURL.h"
44 #include "nsILDAPMessage.h"
45 #include "nsILDAPMessageListener.h"
46 #include "nsILDAPErrors.h"
47 #include "nsILDAPConnection.h"
48 #include "nsILDAPOperation.h"
49 #include "post_include_mozilla.h"
51 using namespace connectivity::mozab;
53 /* Implementation file */
54 NS_IMPL_ISUPPORTS1(MNSRunnable, nsIRunnable)
56 static ::osl::Mutex m_aThreadMutex;
58 nsIRunnable * MNSRunnable::ProxiedObject()
60 if (!_ProxiedObject)
63 nsresult rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ,
64 NS_GET_IID(nsIRunnable),
65 this,
66 PROXY_SYNC,
67 (void**)&_ProxiedObject);
68 (void)rv;
70 _ProxiedObject->AddRef();
72 return _ProxiedObject;
75 MNSRunnable::MNSRunnable()
77 NS_INIT_ISUPPORTS();
78 _ProxiedObject=NULL;
79 #if OSL_DEBUG_LEVEL > 0
80 m_oThreadID = osl_getThreadIdentifier(NULL);
81 #endif
82 AddRef();
85 MNSRunnable::~MNSRunnable()
88 sal_Int32 MNSRunnable::StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode)
90 OSL_TRACE( "IN : MNSRunnable::StartProxy() \n" );
91 ::osl::MutexGuard aGuard(m_aThreadMutex);
92 xCode = aCode;
93 return ProxiedObject()->Run();
97 NS_IMETHODIMP MNSRunnable::Run()
99 return static_cast<nsresult>(xCode->run());