27 #include <nsAutoPtr.h>
34 NS_ASSERTION(NS_IsMainThread(),
"Not main thread!");
36 nsCOMPtr<nsIProxyObjectManager> pom =
37 do_GetService(NS_XPCOMPROXY_CONTRACTID, &mResult);
38 if (NS_FAILED(mResult)) {
42 nsCOMPtr<nsISupports> supports;
45 supports = do_GetService(mContractID, &mResult);
48 supports = do_GetService(mCID, &mResult);
53 supports = do_CreateInstance(mContractID, &mResult);
56 supports = do_CreateInstance(mCID, &mResult);
60 if (NS_FAILED(mResult)) {
64 mResult = pom->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
67 NS_PROXY_SYNC | NS_PROXY_ALWAYS,
68 getter_AddRefs(mSupports));
76 nsRefPtr<sbProxiedComponentManagerRunnable> runnable =
81 *mErrorPtr = NS_ERROR_OUT_OF_MEMORY;
82 return NS_ERROR_OUT_OF_MEMORY;
85 nsresult rv = NS_DispatchToMainThread(runnable, NS_DISPATCH_SYNC);
93 if (NS_FAILED(runnable->mResult)) {
96 *mErrorPtr = runnable->mResult;
97 return runnable->mResult;
100 runnable->mSupports.forget(reinterpret_cast<nsISupports**>(aInstancePtr));
103 *mErrorPtr = runnable->mResult;
110 void** aInstancePtr)
const
115 if (NS_IsMainThread()) {
117 rv = mSupports->QueryInterface(aIID, aInstancePtr);
121 nsCOMPtr<nsIThread> mainThread;
122 rv = NS_GetMainThread(getter_AddRefs(mainThread));
123 if (NS_SUCCEEDED(rv)) {
127 NS_PROXY_SYNC | NS_PROXY_ALWAYS,
134 *aInstancePtr = nsnull;
nsresult do_GetProxyForObject(nsIEventTarget *aTarget, REFNSIID aIID, nsISupports *aObj, PRInt32 aProxyType, void **aProxyObject)
virtual nsresult NS_FASTCALL operator()(const nsIID &, void **) const
virtual nsresult NS_FASTCALL operator()(const nsIID &, void **) const
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility