VirtualBox

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

Last change on this file since 42088 was 42088, checked in by vboxsync, 12 years ago

Build fix (XPCOM).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/** @file
2 *
3 * XPCOM module implementation functions
4 */
5
6/*
7 * Copyright (C) 2006-2009 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#include "GuestDirectoryImpl.h"
40#include "GuestDirEntryImpl.h"
41#include "GuestFileImpl.h"
42#include "GuestFsObjImpl.h"
43#include "GuestSessionImpl.h"
44#include "KeyboardImpl.h"
45#include "MachineDebuggerImpl.h"
46#include "MouseImpl.h"
47#include "NATEngineImpl.h"
48#include "NetworkAdapterImpl.h"
49#include "ProgressCombinedImpl.h"
50#include "ProgressImpl.h"
51#include "RemoteUSBDeviceImpl.h"
52#include "SessionImpl.h"
53#include "SharedFolderImpl.h"
54#include "USBDeviceImpl.h"
55#include "VirtualBoxClientImpl.h"
56
57#include "Logging.h"
58
59// XPCOM glue code unfolding
60
61NS_DECL_CLASSINFO(Guest)
62NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
63NS_DECL_CLASSINFO(GuestDirectory)
64NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestDirectory, IGuestDirectory)
65NS_DECL_CLASSINFO(GuestDirEntry)
66NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestDirEntry, IGuestDirEntry)
67NS_DECL_CLASSINFO(GuestFile)
68NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestFile, IGuestFile)
69NS_DECL_CLASSINFO(GuestFsObjInfo)
70NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestFsObjInfo, IGuestFsObjInfo)
71NS_DECL_CLASSINFO(GuestSession)
72NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestSession, IGuestSession)
73NS_DECL_CLASSINFO(Keyboard)
74NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
75NS_DECL_CLASSINFO(Mouse)
76NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
77NS_DECL_CLASSINFO(Display)
78NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
79NS_DECL_CLASSINFO(MachineDebugger)
80NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
81NS_DECL_CLASSINFO(Progress)
82NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
83NS_DECL_CLASSINFO(CombinedProgress)
84NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
85NS_DECL_CLASSINFO(OUSBDevice)
86NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
87NS_DECL_CLASSINFO(RemoteUSBDevice)
88NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteUSBDevice, IHostUSBDevice)
89NS_DECL_CLASSINFO(SharedFolder)
90NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
91NS_DECL_CLASSINFO(VRDEServerInfo)
92NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
93#ifdef VBOX_WITH_EXTPACK
94NS_DECL_CLASSINFO(ExtPackFile)
95NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackFile, IExtPackFile)
96NS_DECL_CLASSINFO(ExtPack)
97NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPack, IExtPack)
98NS_DECL_CLASSINFO(ExtPackManager)
99NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
100#endif
101NS_DECL_CLASSINFO(AdditionsFacility)
102NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AdditionsFacility, IAdditionsFacility)
103
104NS_DECL_CLASSINFO(Session)
105NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
106NS_DECL_CLASSINFO(Console)
107NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
108
109NS_DECL_CLASSINFO(VirtualBoxClient)
110NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
111
112/**
113 * Singleton class factory that holds a reference to the created instance
114 * (preventing it from being destroyed) until the module is explicitly
115 * unloaded by the XPCOM shutdown code.
116 *
117 * Suitable for IN-PROC components.
118 */
119class SessionClassFactory : public Session
120{
121public:
122 virtual ~SessionClassFactory() {
123 FinalRelease();
124 instance = 0;
125 }
126 static nsresult getInstance (Session **inst) {
127 int rv = NS_OK;
128 if (instance == 0) {
129 instance = new SessionClassFactory();
130 if (instance) {
131 instance->AddRef(); // protect FinalConstruct()
132 rv = instance->FinalConstruct();
133 if (NS_FAILED(rv))
134 instance->Release();
135 else
136 instance->AddRef(); // self-reference
137 } else {
138 rv = NS_ERROR_OUT_OF_MEMORY;
139 }
140 } else {
141 instance->AddRef();
142 }
143 *inst = instance;
144 return rv;
145 }
146 static nsresult releaseInstance () {
147 if (instance)
148 instance->Release();
149 return NS_OK;
150 }
151
152private:
153 static Session *instance;
154};
155
156/** @note this is for singleton; disabled for now */
157//
158//Session *SessionClassFactory::instance = 0;
159//
160//NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
161// Session, SessionClassFactory::getInstance
162//)
163
164NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session)
165
166NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(VirtualBoxClient)
167
168/**
169 * Component definition table.
170 * Lists all components defined in this module.
171 */
172static const nsModuleComponentInfo components[] =
173{
174 {
175 "Session component", // description
176 NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
177 SessionConstructor, // constructor function
178 NULL, // registration function
179 NULL, // deregistration function
180/** @note this is for singleton; disabled for now */
181// SessionClassFactory::releaseInstance,
182 NULL, // destructor function
183 NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
184 NULL, // language helper
185 &NS_CLASSINFO_NAME(Session) // global class info & flags
186 },
187 {
188 "VirtualBoxClient component", // description
189 NS_VIRTUALBOXCLIENT_CID, NS_VIRTUALBOXCLIENT_CONTRACTID, // CID/ContractID
190 VirtualBoxClientConstructor, // constructor function
191 NULL, // registration function
192 NULL, // deregistration function
193 NULL, // destructor function
194 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
195 NULL, // language helper
196 &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
197 },
198};
199
200NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
201/* 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