Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Extension migration from FF2 to FF3 and changes to nsIProxyObjectManager
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
tx.c.ri...@gmail.com  
View profile  
 More options Sep 19 2007, 11:51 am
Newsgroups: mozilla.dev.platform
From: tx.c.ri...@gmail.com
Date: Wed, 19 Sep 2007 15:51:49 -0000
Local: Wed, Sep 19 2007 11:51 am
Subject: Extension migration from FF2 to FF3 and changes to nsIProxyObjectManager
In our current extension, we have code like the following to ensure
that code is run on the UI thread.  The code below is an over-
simplification of the actual algorithm, just trying to show use
pattern.  Decision was made to use this pattern based on
http://www.mozilla.org/projects/xpcom/Proxies.html and ease of coding.

In FF2, nsIProxyObjectManager.h defines appropriate macros for being
able to find the proxy manager (NS_XPCOMPROXY_CONTRACTID) or also
gives visibility to NS_GetProxyForObject().

--- example code begin

int MyObject::notify( unsigned long cmd ) {
  nsresult rv;
  nsCOMPtr<nsIProxyObjectManager> spProxyManager;
  spProxyManager = do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv);

  nsCOMPtr<IMyObject> prox;
  spProxyManager->GetProxyForObject(
    NS_UI_THREAD_EVENTQ,
    NS_GET_IID(IMyObject),
    (IMyObject*)this,
    PROXY_ASYNC | PROXY_ALWAYS,
    (void**)&prox );

  prox->processCommand( cmd );

}

--- example code end

In FF3, now it appears that these are trying to be "hidden" (use is
discouraged?)
- NS_XPCOMPROXY_CONTRACTID now defined in nsXPCOMCIDInternal.h
- NS_GetProxyForObject is now hidden behind #ifdef
MOZILLA_INTERNAL_API

In FF3, is there a new preferred way for communicating from worker
threads to the main thread?  If so, is there a sample extension that
is already using this model?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Smedberg  
View profile  
 More options Sep 19 2007, 7:49 pm
Newsgroups: mozilla.dev.platform
From: Benjamin Smedberg <benja...@smedbergs.us>
Date: Wed, 19 Sep 2007 19:49:59 -0400
Local: Wed, Sep 19 2007 7:49 pm
Subject: Re: Extension migration from FF2 to FF3 and changes to nsIProxyObjectManager

tx.c.ri...@gmail.com wrote:
> In FF3, now it appears that these are trying to be "hidden" (use is
> discouraged?)
> - NS_XPCOMPROXY_CONTRACTID now defined in nsXPCOMCIDInternal.h

This is not hidden/discouraged. This is the header file we use for contracts
that are not frozen. Go ahead and use it with the ordinary cautions about
that it may change in future releases and your code may stop working.

> - NS_GetProxyForObject is now hidden behind #ifdef
> MOZILLA_INTERNAL_API

This is correct: you cannot link against this method. However, you can use
regular XPCOM calls to do the work, e.g.

  nsCOMPtr<nsIProxyObjectManager> proxyObjMgr =
    do_GetService(NS_XPCOMPROXY_CONTRACTID);
  if (!proxyObjMgr)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIFoo> proxyObject;
  nsresult rv = proxyObjMgr->
    GetProxyForObject(targetThread, NS_GET_IID(nsIFoo),
                      object, nsIProxyObjectManager::INVOKE_ASYNC,
                      getter_AddRefs(proxyObject));

--BDS


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris  
View profile  
 More options Sep 20 2007, 12:58 pm
Newsgroups: mozilla.dev.platform
From: Chris <tx.c.ri...@gmail.com>
Date: Thu, 20 Sep 2007 09:58:13 -0700
Local: Thurs, Sep 20 2007 12:58 pm
Subject: Re: Extension migration from FF2 to FF3 and changes to nsIProxyObjectManager
Would the following also work?

class MyEvent : public nsRunnable {
  private:
    unsigned long m_cmd;
    nsCOMPtr<IMyObject> m_spMyObject;

  public:
    MyEvent( unsigned long cmd, IMyObject *pObj )
      :m_cmd(cmd),
       m_spMyObject(pObj) {}
    NS_IMETHOD Run() { m_spMyObject->processCommand(m_cmd); }

}

int MyObject::notify( unsigned long cmd ) {
  MyEvent *pMyEvent = new MyEvent( cmd, this );
  NS_DispatchToMainThread(pMyEvent);


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »