VirtualBox

Changeset 52248 in vbox


Ignore:
Timestamp:
Jul 31, 2014 7:00:11 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95331
Message:

Main: ISession fully converted to use API wrappers

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/apiwrap-server.xsl

    r51601 r52248  
    805805
    806806<xsl:template match="attribute" mode="public">
     807    <xsl:param name="target"/>
     808
     809    <xsl:call-template name="emitTargetBegin">
     810        <xsl:with-param name="target" select="$target"/>
     811    </xsl:call-template>
     812
    807813    <xsl:variable name="attrbasename">
    808814        <xsl:call-template name="capitalize">
     
    826832</xsl:text>
    827833    </xsl:if>
     834
     835    <xsl:call-template name="emitTargetEnd">
     836        <xsl:with-param name="target" select="$target"/>
     837    </xsl:call-template>
    828838</xsl:template>
    829839
    830840<xsl:template match="attribute" mode="wrapped">
     841    <xsl:param name="target"/>
     842
     843    <xsl:call-template name="emitTargetBegin">
     844        <xsl:with-param name="target" select="$target"/>
     845    </xsl:call-template>
     846
    831847    <xsl:variable name="attrbasename">
    832848        <xsl:call-template name="capitalize">
     
    862878</xsl:text>
    863879    </xsl:if>
     880
     881    <xsl:call-template name="emitTargetEnd">
     882        <xsl:with-param name="target" select="$target"/>
     883    </xsl:call-template>
    864884</xsl:template>
    865885
    866886<xsl:template match="attribute" mode="code">
    867887    <xsl:param name="topclass"/>
     888    <xsl:param name="target"/>
     889
     890    <xsl:call-template name="emitTargetBegin">
     891        <xsl:with-param name="target" select="$target"/>
     892    </xsl:call-template>
    868893
    869894    <xsl:variable name="attrbasename">
     
    960985    return hrc;
    961986}
    962 
    963987</xsl:text>
    964988    <xsl:if test="not(@readonly) or @readonly!='yes'">
     989    <xsl:text>
     990</xsl:text>
    965991        <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
    966992        <xsl:apply-templates select="@type" mode="public">
     
    10261052    return hrc;
    10271053}
    1028 
    1029 </xsl:text>
    1030     </xsl:if>
     1054</xsl:text>
     1055    </xsl:if>
     1056
     1057    <xsl:call-template name="emitTargetEnd">
     1058        <xsl:with-param name="target" select="$target"/>
     1059    </xsl:call-template>
     1060
     1061    <xsl:text>
     1062</xsl:text>
    10311063</xsl:template>
    10321064
     
    10651097    <xsl:choose>
    10661098        <xsl:when test="$pmode='public'">
    1067             <xsl:apply-templates select="$iface/attribute" mode="public"/>
     1099            <xsl:apply-templates select="$iface/attribute | $iface/if" mode="public">
     1100                <xsl:with-param name="emitmode" select="'attribute'"/>
     1101            </xsl:apply-templates>
    10681102        </xsl:when>
    10691103        <xsl:when test="$pmode='wrapped'">
    1070             <xsl:apply-templates select="$iface/attribute" mode="wrapped"/>
     1104            <xsl:apply-templates select="$iface/attribute | $iface/if" mode="wrapped">
     1105                <xsl:with-param name="emitmode" select="'attribute'"/>
     1106            </xsl:apply-templates>
    10711107        </xsl:when>
    10721108        <xsl:when test="$pmode='code'">
    1073             <xsl:apply-templates select="$iface/attribute" mode="code">
     1109            <xsl:apply-templates select="$iface/attribute | $iface/if" mode="code">
    10741110                <xsl:with-param name="topclass" select="$topclass"/>
     1111                <xsl:with-param name="emitmode" select="'attribute'"/>
    10751112            </xsl:apply-templates>
    10761113        </xsl:when>
     
    10781115    </xsl:choose>
    10791116</xsl:template>
     1117
     1118<xsl:template name="emitTargetBegin">
     1119    <xsl:param name="target"/>
     1120
     1121    <xsl:choose>
     1122        <xsl:when test="$target = 'xpidl'">
     1123            <xsl:text>#ifdef VBOX_WITH_XPCOM
     1124</xsl:text>
     1125        </xsl:when>
     1126        <xsl:when test="$target = 'midl'">
     1127            <xsl:text>#ifndef VBOX_WITH_XPCOM
     1128</xsl:text>
     1129        </xsl:when>
     1130        <xsl:otherwise/>
     1131    </xsl:choose>
     1132</xsl:template>
     1133
     1134<xsl:template name="emitTargetEnd">
     1135    <xsl:param name="target"/>
     1136
     1137    <xsl:choose>
     1138        <xsl:when test="$target = 'xpidl'">
     1139            <xsl:text>#endif /* VBOX_WITH_XPCOM */
     1140</xsl:text>
     1141        </xsl:when>
     1142        <xsl:when test="$target = 'midl'">
     1143            <xsl:text>#endif /* !VBOX_WITH_XPCOM */
     1144</xsl:text>
     1145        </xsl:when>
     1146        <xsl:otherwise/>
     1147    </xsl:choose>
     1148</xsl:template>
     1149
    10801150
    10811151<!-- - - - - - - - - - - - - - - - - - - - - - -
     
    10841154
    10851155<xsl:template match="method" mode="public">
     1156    <xsl:param name="target"/>
     1157
     1158    <xsl:call-template name="emitTargetBegin">
     1159        <xsl:with-param name="target" select="$target"/>
     1160    </xsl:call-template>
     1161
    10861162    <xsl:variable name="methodindent">
    10871163      <xsl:call-template name="tospace">
     
    11071183    <xsl:text>);
    11081184</xsl:text>
     1185
     1186    <xsl:call-template name="emitTargetEnd">
     1187        <xsl:with-param name="target" select="$target"/>
     1188    </xsl:call-template>
    11091189</xsl:template>
    11101190
    11111191<xsl:template match="method" mode="wrapped">
     1192    <xsl:param name="target"/>
     1193
     1194    <xsl:call-template name="emitTargetBegin">
     1195        <xsl:with-param name="target" select="$target"/>
     1196    </xsl:call-template>
     1197
    11121198    <xsl:variable name="methodindent">
    11131199        <xsl:call-template name="tospace">
     
    11471233    <xsl:text>) = 0;
    11481234</xsl:text>
     1235
     1236    <xsl:call-template name="emitTargetEnd">
     1237        <xsl:with-param name="target" select="$target"/>
     1238    </xsl:call-template>
    11491239</xsl:template>
    11501240
    11511241<xsl:template match="method" mode="code">
    11521242    <xsl:param name="topclass"/>
     1243    <xsl:param name="target"/>
     1244
     1245    <xsl:call-template name="emitTargetBegin">
     1246        <xsl:with-param name="target" select="$target"/>
     1247    </xsl:call-template>
    11531248
    11541249    <xsl:variable name="methodindent">
     
    12991394    return hrc;
    13001395}
    1301 
    1302 </xsl:text>
     1396</xsl:text>
     1397
     1398    <xsl:call-template name="emitTargetEnd">
     1399        <xsl:with-param name="target" select="$target"/>
     1400    </xsl:call-template>
     1401
     1402    <xsl:text>
     1403</xsl:text>
     1404</xsl:template>
     1405
     1406<xsl:template name="emitIf">
     1407    <xsl:param name="passmode"/>
     1408    <xsl:param name="target"/>
     1409    <xsl:param name="topclass"/>
     1410    <xsl:param name="emitmode"/>
     1411
     1412    <xsl:if test="($target = 'xpidl') or ($target = 'midl')">
     1413        <xsl:choose>
     1414            <xsl:when test="$filelistonly=''">
     1415                <xsl:choose>
     1416                    <xsl:when test="$passmode='public'">
     1417                        <xsl:choose>
     1418                            <xsl:when test="$emitmode='method'">
     1419                                <xsl:apply-templates select="method" mode="public">
     1420                                    <xsl:with-param name="target" select="$target"/>
     1421                                </xsl:apply-templates>
     1422                            </xsl:when>
     1423                            <xsl:when test="$emitmode='attribute'">
     1424                                <xsl:apply-templates select="attribute" mode="public">
     1425                                    <xsl:with-param name="target" select="$target"/>
     1426                                </xsl:apply-templates>
     1427                            </xsl:when>
     1428                            <xsl:otherwise/>
     1429                        </xsl:choose>
     1430                    </xsl:when>
     1431                    <xsl:when test="$passmode='wrapped'">
     1432                        <xsl:choose>
     1433                            <xsl:when test="$emitmode='method'">
     1434                                <xsl:apply-templates select="method" mode="wrapped">
     1435                                    <xsl:with-param name="target" select="$target"/>
     1436                                </xsl:apply-templates>
     1437                            </xsl:when>
     1438                            <xsl:when test="$emitmode='attribute'">
     1439                                <xsl:apply-templates select="attribute" mode="wrapped">
     1440                                    <xsl:with-param name="target" select="$target"/>
     1441                                </xsl:apply-templates>
     1442                            </xsl:when>
     1443                            <xsl:otherwise/>
     1444                        </xsl:choose>
     1445                    </xsl:when>
     1446                    <xsl:when test="$passmode='code'">
     1447                        <xsl:choose>
     1448                            <xsl:when test="$emitmode='method'">
     1449                                <xsl:apply-templates select="method" mode="code">
     1450                                    <xsl:with-param name="target" select="$target"/>
     1451                                    <xsl:with-param name="topclass" select="$topclass"/>
     1452                                </xsl:apply-templates>
     1453                            </xsl:when>
     1454                            <xsl:when test="$emitmode='attribute'">
     1455                                <xsl:apply-templates select="attribute" mode="code">
     1456                                    <xsl:with-param name="target" select="$target"/>
     1457                                    <xsl:with-param name="topclass" select="$topclass"/>
     1458                                </xsl:apply-templates>
     1459                            </xsl:when>
     1460                            <xsl:otherwise/>
     1461                        </xsl:choose>
     1462                    </xsl:when>
     1463                    <xsl:otherwise/>
     1464                </xsl:choose>
     1465            </xsl:when>
     1466            <xsl:otherwise>
     1467                <xsl:apply-templates/>
     1468            </xsl:otherwise>
     1469        </xsl:choose>
     1470    </xsl:if>
     1471</xsl:template>
     1472
     1473<xsl:template match="if" mode="public">
     1474    <xsl:param name="emitmode"/>
     1475
     1476    <xsl:call-template name="emitIf">
     1477        <xsl:with-param name="passmode" select="'public'"/>
     1478        <xsl:with-param name="target" select="@target"/>
     1479        <xsl:with-param name="emitmode" select="$emitmode"/>
     1480    </xsl:call-template>
     1481</xsl:template>
     1482
     1483<xsl:template match="if" mode="wrapped">
     1484    <xsl:param name="emitmode"/>
     1485
     1486    <xsl:call-template name="emitIf">
     1487        <xsl:with-param name="passmode" select="'wrapped'"/>
     1488        <xsl:with-param name="target" select="@target"/>
     1489        <xsl:with-param name="emitmode" select="$emitmode"/>
     1490    </xsl:call-template>
     1491</xsl:template>
     1492
     1493<xsl:template match="if" mode="code">
     1494    <xsl:param name="topclass"/>
     1495    <xsl:param name="emitmode"/>
     1496
     1497    <xsl:call-template name="emitIf">
     1498        <xsl:with-param name="passmode" select="'code'"/>
     1499        <xsl:with-param name="target" select="@target"/>
     1500        <xsl:with-param name="emitmode" select="$emitmode"/>
     1501        <xsl:with-param name="topclass" select="$topclass"/>
     1502    </xsl:call-template>
    13031503</xsl:template>
    13041504
     
    13371537    <xsl:choose>
    13381538        <xsl:when test="$pmode='public'">
    1339             <xsl:apply-templates select="$iface/method" mode="public"/>
     1539            <xsl:apply-templates select="$iface/method | $iface/if" mode="public">
     1540                <xsl:with-param name="emitmode" select="'method'"/>
     1541            </xsl:apply-templates>
    13401542        </xsl:when>
    13411543        <xsl:when test="$pmode='wrapped'">
    1342             <xsl:apply-templates select="$iface/method" mode="wrapped"/>
     1544            <xsl:apply-templates select="$iface/method | $iface/if" mode="wrapped">
     1545                <xsl:with-param name="emitmode" select="'method'"/>
     1546            </xsl:apply-templates>
    13431547        </xsl:when>
    13441548        <xsl:when test="$pmode='code'">
    1345             <xsl:apply-templates select="$iface/method" mode="code">
     1549            <xsl:apply-templates select="$iface/method | $iface/if" mode="code">
    13461550                <xsl:with-param name="topclass" select="$topclass"/>
     1551                <xsl:with-param name="emitmode" select="'method'"/>
    13471552            </xsl:apply-templates>
    13481553        </xsl:when>
  • trunk/src/VBox/Main/include/SessionImpl.h

    r52232 r52248  
    5151    void uninit();
    5252
    53 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
    54     STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IN_BSTR aTokenId);
    55 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    56     STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IToken *aToken);
    57 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    58 
    5953private:
    6054
     
    6963    HRESULT getPID(ULONG *aPid);
    7064    HRESULT getRemoteConsole(ComPtr<IConsole> &aConsole);
     65#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
     66    HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
     67                          LockType_T aLockType,
     68                          const com::Utf8Str &aTokenId);
     69#else
     70    HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
     71                          LockType_T aLockType,
     72                          const ComPtr<IToken> &aToken);
     73#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
    7174    HRESULT assignRemoteMachine(const ComPtr<IMachine> &aMachine,
    7275                                const ComPtr<IConsole> &aConsole);
  • trunk/src/VBox/Main/src-client/SessionImpl.cpp

    r52232 r52248  
    268268
    269269#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
    270 STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
    271                                     IN_BSTR aTokenId)
    272 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    273 STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
    274                                     IToken *aToken)
    275 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    276 {
    277     LogFlowThisFuncEnter();
    278     LogFlowThisFunc(("aMachine=%p\n", aMachine));
    279 
    280     AutoCaller autoCaller(this);
    281     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    282 
     270HRESULT Session::assignMachine(const ComPtr<IMachine> &aMachine,
     271                          LockType_T aLockType,
     272                          const com::Utf8Str &aTokenId)
     273#else
     274HRESULT Session::assignMachine(const ComPtr<IMachine> &aMachine,
     275                          LockType_T aLockType,
     276                          const ComPtr<IToken> &aToken)
     277#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
     278{
    283279    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    284280
     
    297293        mState = SessionState_Spawning;
    298294
    299         LogFlowThisFuncLeave();
    300295        return S_OK;
    301296    }
     
    320315    Assert(!strTokenId.isEmpty());
    321316#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    322     AssertPtr(aToken);
     317    Assert(!aToken.isNull());
    323318#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
    324319    /* create the machine client token */
     
    366361#endif
    367362    }
    368 
    369     LogFlowThisFunc(("rc=%08X\n", rc));
    370     LogFlowThisFuncLeave();
    371363
    372364    return rc;
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