VirtualBox

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

Last change on this file since 21999 was 19817, checked in by vboxsync, 16 years ago

IFramebuffer cleanup next part:

  • removed obsolete internal framebuffer
  • removed IFramebuffer::setupInternalFramebuffer(), IFramebuffer::lockFramebuffer(), IFramebuffer::unlockFramebuffer(), IFramebuffer::registerExternalFramebuffer()
  • removed unused finished parameter of IFramebuffer::NotifyUpdate()
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/** @file
2 *
3 * XPCOM module implementation functions
4 */
5
6/*
7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22/* Make sure all the stdint.h macros are included - must come first! */
23#ifndef __STDC_LIMIT_MACROS
24# define __STDC_LIMIT_MACROS
25#endif
26#ifndef __STDC_CONSTANT_MACROS
27# define __STDC_CONSTANT_MACROS
28#endif
29
30#include <nsIGenericFactory.h>
31
32// generated file
33#include "VirtualBox_XPCOM.h"
34
35#include "GuestImpl.h"
36#include "KeyboardImpl.h"
37#include "MouseImpl.h"
38#include "DisplayImpl.h"
39#include "MachineDebuggerImpl.h"
40#include "USBDeviceImpl.h"
41#include "RemoteUSBDeviceImpl.h"
42#include "SharedFolderImpl.h"
43#include "ProgressImpl.h"
44#include "NetworkAdapterImpl.h"
45
46#include "SessionImpl.h"
47#include "ConsoleImpl.h"
48#include "ConsoleVRDPServer.h"
49
50#include "Logging.h"
51
52// XPCOM glue code unfolding
53
54NS_DECL_CLASSINFO(Guest)
55NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
56NS_DECL_CLASSINFO(Keyboard)
57NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
58NS_DECL_CLASSINFO(Mouse)
59NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
60NS_DECL_CLASSINFO(Display)
61NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Display, IDisplay)
62NS_DECL_CLASSINFO(MachineDebugger)
63NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
64NS_DECL_CLASSINFO(Progress)
65NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
66NS_DECL_CLASSINFO(CombinedProgress)
67NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
68NS_DECL_CLASSINFO(OUSBDevice)
69NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
70NS_DECL_CLASSINFO(RemoteUSBDevice)
71NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteUSBDevice, IHostUSBDevice)
72NS_DECL_CLASSINFO(SharedFolder)
73NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
74NS_DECL_CLASSINFO(RemoteDisplayInfo)
75NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteDisplayInfo, IRemoteDisplayInfo)
76
77NS_DECL_CLASSINFO(Session)
78NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
79NS_DECL_CLASSINFO(Console)
80NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
81
82/**
83 * Singleton class factory that holds a reference to the created instance
84 * (preventing it from being destroyed) until the module is explicitly
85 * unloaded by the XPCOM shutdown code.
86 *
87 * Suitable for IN-PROC components.
88 */
89class SessionClassFactory : public Session
90{
91public:
92 virtual ~SessionClassFactory() {
93 FinalRelease();
94 instance = 0;
95 }
96 static nsresult getInstance (Session **inst) {
97 int rv = NS_OK;
98 if (instance == 0) {
99 instance = new SessionClassFactory();
100 if (instance) {
101 instance->AddRef(); // protect FinalConstruct()
102 rv = instance->FinalConstruct();
103 if (NS_FAILED(rv))
104 instance->Release();
105 else
106 instance->AddRef(); // self-reference
107 } else {
108 rv = NS_ERROR_OUT_OF_MEMORY;
109 }
110 } else {
111 instance->AddRef();
112 }
113 *inst = instance;
114 return rv;
115 }
116 static nsresult releaseInstance () {
117 if (instance)
118 instance->Release();
119 return NS_OK;
120 }
121
122private:
123 static Session *instance;
124};
125
126/** @note this is for singleton; disabled for now */
127//
128//Session *SessionClassFactory::instance = 0;
129//
130//NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC (
131// Session, SessionClassFactory::getInstance
132//)
133
134NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC (Session)
135
136
137/**
138 * Component definition table.
139 * Lists all components defined in this module.
140 */
141static const nsModuleComponentInfo components[] =
142{
143 {
144 "Session component", // description
145 NS_SESSION_CID, NS_SESSION_CONTRACTID, // CID/ContractID
146 SessionConstructor, // constructor function
147 NULL, // registration function
148 NULL, // deregistration function
149/** @note this is for singleton; disabled for now */
150// SessionClassFactory::releaseInstance,
151 NULL, // destructor function
152 NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
153 NULL, // language helper
154 &NS_CLASSINFO_NAME(Session) // global class info & flags
155 }
156};
157
158NS_IMPL_NSGETMODULE (VirtualBox_Client_Module, components)
159/* 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