VirtualBox

source: vbox/trunk/src/VBox/Main/xpcom/module.cpp@ 34647

Last change on this file since 34647 was 34647, checked in by vboxsync, 14 years ago

Main/VirtualBoxClient: forgotten XPCOM specific component registry bits

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

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