VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/xpcom/module.cpp@ 42852

Last change on this file since 42852 was 42852, checked in by vboxsync, 13 years ago

Main: fix QueryInterface method generation for interfaces which inherit from others

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1/** @file
2 *
3 * XPCOM module implementation functions
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* Make sure all the stdint.h macros are included - must come first! */
19#ifndef __STDC_LIMIT_MACROS
20# define __STDC_LIMIT_MACROS
21#endif
22#ifndef __STDC_CONSTANT_MACROS
23# define __STDC_CONSTANT_MACROS
24#endif
25
26#include <nsIGenericFactory.h>
27
28// generated file
29#include "VirtualBox_XPCOM.h"
30
31#include "AdditionsFacilityImpl.h"
32#include "ConsoleImpl.h"
33#include "ConsoleVRDPServer.h"
34#include "DisplayImpl.h"
35#ifdef VBOX_WITH_EXTPACK
36# include "ExtPackManagerImpl.h"
37#endif
38#include "GuestImpl.h"
39#ifdef VBOX_WITH_GUEST_CONTROL
40# include "GuestDirectoryImpl.h"
41# include "GuestDirEntryImpl.h"
42# include "GuestFileImpl.h"
43# include "GuestFsObjInfoImpl.h"
44# include "GuestProcessImpl.h"
45# include "GuestSessionImpl.h"
46#endif
47#include "KeyboardImpl.h"
48#include "MachineDebuggerImpl.h"
49#include "MouseImpl.h"
50#include "NATEngineImpl.h"
51#include "NetworkAdapterImpl.h"
52#include "ProgressCombinedImpl.h"
53#include "ProgressImpl.h"
54#include "RemoteUSBDeviceImpl.h"
55#include "SessionImpl.h"
56#include "SharedFolderImpl.h"
57#include "USBDeviceImpl.h"
58#include "VirtualBoxClientImpl.h"
59
60#include "Logging.h"
61
62// XPCOM glue code unfolding
63
64NS_DECL_CLASSINFO(Guest)
65NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
66#ifdef VBOX_WITH_GUEST_CONTROL
67NS_DECL_CLASSINFO(GuestDirectory)
68NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestDirectory, IGuestDirectory, IDirectory)
69NS_DECL_CLASSINFO(GuestDirEntry)
70NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestDirEntry, IGuestDirEntry)
71NS_DECL_CLASSINFO(GuestFile)
72NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFile, IGuestFile, IFile)
73NS_DECL_CLASSINFO(GuestFsObjInfo)
74NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFsObjInfo, IGuestFsObjInfo, IFsObjInfo)
75NS_DECL_CLASSINFO(GuestProcess)
76NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestProcess, IGuestProcess, IProcess)
77NS_DECL_CLASSINFO(GuestSession)
78NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestSession, IGuestSession)
79#endif
80NS_DECL_CLASSINFO(Keyboard)
81NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
82NS_DECL_CLASSINFO(Mouse)
83NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
84NS_DECL_CLASSINFO(Display)
85NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
86NS_DECL_CLASSINFO(MachineDebugger)
87NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
88NS_DECL_CLASSINFO(Progress)
89NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
90NS_DECL_CLASSINFO(CombinedProgress)
91NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
92NS_DECL_CLASSINFO(OUSBDevice)
93NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
94NS_DECL_CLASSINFO(RemoteUSBDevice)
95NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)
96NS_DECL_CLASSINFO(SharedFolder)
97NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
98NS_DECL_CLASSINFO(VRDEServerInfo)
99NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
100#ifdef VBOX_WITH_EXTPACK
101NS_DECL_CLASSINFO(ExtPackFile)
102NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)
103NS_DECL_CLASSINFO(ExtPack)
104NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPack, IExtPack, IExtPackBase)
105NS_DECL_CLASSINFO(ExtPackManager)
106NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
107#endif
108NS_DECL_CLASSINFO(AdditionsFacility)
109NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AdditionsFacility, IAdditionsFacility)
110
111NS_DECL_CLASSINFO(Session)
112NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
113NS_DECL_CLASSINFO(Console)
114NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
115
116NS_DECL_CLASSINFO(VirtualBoxClient)
117NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
118
119/**
120 * Singleton class factory that holds a reference to the created instance
121 * (preventing it from being destroyed) until the module is explicitly
122 * unloaded by the XPCOM shutdown code.
123 *
124 * Suitable for IN-PROC components.
125 */
126class SessionClassFactory : public Session
127{
128public:
129 virtual ~SessionClassFactory() {
130 FinalRelease();
131 instance = 0;
132 }
133 static nsresult getInstance (Session **inst) {
134 int rv = NS_OK;
135 if (instance == 0) {
136 instance = new SessionClassFactory();
137 if (instance) {
138 instance->AddRef(); // protect FinalConstruct()
139 rv = instance->FinalConstruct();
140 if (NS_FAILED(rv))
141 instance->Release();
142 else
143 instance->AddRef(); // self-reference
144 } else {
145 rv = NS_ERROR_OUT_OF_MEMORY;
146 }
147 } else {
148 instance->AddRef();
149 }
150 *inst = instance;
151 return rv;
152 }
153 static nsresult releaseInstance () {
154 if (instance)
155 instance->Release();
156 return NS_OK;
157 }
158
159private:
160 static Session *instance;
161};
162
163/** @note this is for singleton; disabled for now */
164//
165//Session *SessionClassFactory::instance = 0;
166//
167//NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
168// Session, SessionClassFactory::getInstance
169//)
170
171NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
172
173NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
174
175/**
176 * Component definition table.
177 * Lists all components defined in this module.
178 */
179static const nsModuleComponentInfo components[] =
180{
181 {
182 "Session component", // description
183 NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
184 SessionConstructor, // constructor function
185 NULL, // registration function
186 NULL, // deregistration function
187/** @note this is for singleton; disabled for now */
188// SessionClassFactory::releaseInstance,
189 NULL, // destructor function
190 NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
191 NULL, // language helper
192 &NS_CLASSINFO_NAME(Session) // global class info & flags
193 },
194 {
195 "VirtualBoxClient component", // description
196 NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
197 VirtualBoxClientConstructor, // constructor function
198 NULL, // registration function
199 NULL, // deregistration function
200 NULL, // destructor function
201 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
202 NULL, // language helper
203 &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
204 },
205};
206
207NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
208/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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