Changeset 62258 in vbox for trunk/src/VBox
- Timestamp:
- Jul 14, 2016 3:22:54 PM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r60765 r62258 34 34 { 35 35 public: 36 DECLARE_CLASSFACTORY ()36 DECLARE_CLASSFACTORY_SINGLETON(VirtualBoxClient) 37 37 38 38 // Do not use any ATL registry support. -
trunk/src/VBox/Main/src-client/xpcom/module.cpp
r56584 r62258 6 6 7 7 /* 8 * Copyright (C) 2006-201 5Oracle Corporation8 * Copyright (C) 2006-2016 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 62 62 * Suitable for IN-PROC components. 63 63 */ 64 class SessionClassFactory : public Session64 class VirtualBoxClientClassFactory : public VirtualBoxClient 65 65 { 66 66 public: 67 virtual ~SessionClassFactory() { 67 virtual ~VirtualBoxClientClassFactory() 68 { 68 69 FinalRelease(); 69 70 instance = 0; 70 71 } 71 static nsresult getInstance (Session **inst) { 72 static nsresult GetInstance(VirtualBoxClient **inst) 73 { 72 74 int rv = NS_OK; 73 if (instance == 0) { 74 instance = new SessionClassFactory(); 75 if (instance == 0) 76 { 77 instance = new VirtualBoxClientClassFactory(); 75 78 if (instance) { 76 79 instance->AddRef(); // protect FinalConstruct() … … 89 92 return rv; 90 93 } 91 static nsresult releaseInstance () { 94 static nsresult FactoryDestructor() 95 { 92 96 if (instance) 93 97 instance->Release(); … … 96 100 97 101 private: 98 static Session*instance;102 static VirtualBoxClient *instance; 99 103 }; 100 104 101 /** @note this is for singleton; disabled for now */ 102 // 103 //Session *SessionClassFactory::instance = 0; 104 // 105 //NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC ( 106 // Session, SessionClassFactory::getInstance 107 //) 105 VirtualBoxClient *VirtualBoxClientClassFactory::instance = nsnull; 106 108 107 109 108 NS_GENERIC_FACTORY_CONSTRUCTOR_WITH_RC(Session) 110 109 111 NS_GENERIC_FACTORY_ CONSTRUCTOR_WITH_RC(VirtualBoxClient)110 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR_WITH_RC(VirtualBoxClient, VirtualBoxClientClassFactory::GetInstance) 112 111 113 112 /** … … 123 122 NULL, // registration function 124 123 NULL, // deregistration function 125 /** @note this is for singleton; disabled for now */126 // SessionClassFactory::releaseInstance,127 124 NULL, // destructor function 128 125 NS_CI_INTERFACE_GETTER_NAME(SessionWrap), // interfaces function … … 136 133 NULL, // registration function 137 134 NULL, // deregistration function 138 NULL, // destructor function135 VirtualBoxClientClassFactory::FactoryDestructor, // destructor function 139 136 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClientWrap), // interfaces function 140 137 NULL, // language helper
Note:
See TracChangeset
for help on using the changeset viewer.