VirtualBox

Changeset 1472 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Mar 14, 2007 2:59:26 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19532
Message:

Main: XPCOM: Initial implementation of auto-startable "out-of-proc" VirtualBox component (VBoxSVC).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/ptr.h

    r1 r1472  
    251251     *  manage a reference to the created object in case of success.
    252252     */
    253     HRESULT createInprocObject (const CLSID &clsid) {
     253    HRESULT createInprocObject (const CLSID &clsid)
     254    {
    254255        HRESULT rc;
    255256        I *obj = NULL;
     
    274275     *  to manage a reference to the created object in case of success.
    275276     *
    276      *  @param serverName
    277      *      name of the server to create the object within (Linux only)
     277     *  Note: In XPCOM, the out-of-process functionality is currently emulated
     278     *  through in-process wrapper objects (that start a dedicated process and
     279     *  redirect all object requests to that process). For this reason, this
     280     *  method is fully equivalent to #createInprocObject() for now.
    278281     */
    279     HRESULT createLocalObject (const CLSID &clsid, const char *serverName) {
     282    HRESULT createLocalObject (const CLSID &clsid)
     283    {
     284#if defined (__WIN__)
    280285        HRESULT rc;
    281286        I *obj = NULL;
    282 #if defined (__WIN__)
    283287        rc = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, _ATL_IIDOF (I),
    284288                               (void **) &obj);
     289        *this = obj;
     290        if (SUCCEEDED (rc))
     291            obj->Release();
     292        return rc;
    285293#else
     294        return createInprocObject (clsid);
     295#endif
     296    }
     297
     298#ifdef VBOX_WITH_XPCOM
     299    /**
     300     *  Createas an object of the given class ID on the specified server and
     301     *  starts to manage a reference to the created object in case of success.
     302     *
     303     *  @param serverName   Name of the server to create an object within.
     304     */
     305    HRESULT createObjectOnServer (const CLSID &clsid, const char *serverName)
     306    {
     307        HRESULT rc;
     308        I *obj = NULL;
    286309        nsCOMPtr <ipcIService> ipcServ = do_GetService (IPC_SERVICE_CONTRACTID, &rc);
    287         if (SUCCEEDED (rc)) {
     310        if (SUCCEEDED (rc))
     311        {
    288312            PRUint32 serverID = 0;
    289313            rc = ipcServ->ResolveClientName (serverName, &serverID);
     
    296320            }
    297321        }
    298 #endif
    299322        *this = obj;
    300323        if (SUCCEEDED (rc))
     
    302325        return rc;
    303326    }
     327#endif
    304328};
    305329
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette