VirtualBox

source: vbox/trunk/src/VBox/Main/include/TokenImpl.h@ 48297

Last change on this file since 48297 was 48297, checked in by vboxsync, 11 years ago

Main/Medium: redesign API level medium locking, needed conversions from MediaList to MediumLockLists in several places, forced cleanups elsewhere, too
Main/Token: introduced token objects for controlling the unlocking, will be used as a general concept in the future
Main/Snapshot: snapshot deletion needed significant cleanups as it was still using many shortcuts, directly calling the API to lock media instead of using lock lists. Now much better, and the online snapshot deletion is also a lot cleaner as it no longer passes unnecessary parameters around which are already known in the machine/snapshot code
Main/MediumLock: small improvements, now has a mode which skips locking already locked media, needed by the Snapshot code where we have overlapping lock lists and have to update the original one instead
Main/Console+Session+Machine: follow-up changes for the online snapshot merging parameter passing simplification, plus an unrelated lock order violation fix in Machine which happens only for inaccessible machines
Main/testcase: update correspondingly
doc: update SDK reference

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: TokenImpl.h 48297 2013-09-05 09:57:44Z vboxsync $ */
2
3/** @file
4 *
5 * Token COM class implementations: MachineToken and MediumLockToken
6 */
7
8/*
9 * Copyright (C) 2013 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef TOKEN_IMPL_H_
21#define TOKEN_IMPL_H_
22
23#include "TokenWrap.h"
24#include "MachineImpl.h"
25
26
27/**
28 * The MachineToken class automates cleanup of a SessionMachine object.
29 */
30class ATL_NO_VTABLE MachineToken :
31 public TokenWrap
32{
33public:
34
35 DECLARE_EMPTY_CTOR_DTOR(MachineToken)
36
37 HRESULT FinalConstruct();
38 void FinalRelease();
39
40 // public initializer/uninitializer for internal purposes only
41 HRESULT init(const ComObjPtr<SessionMachine> &pSessionMachine);
42 void uninit();
43
44private:
45
46 // wrapped IToken methods
47 HRESULT abandon(AutoCaller &aAutoCaller);
48 HRESULT dummy();
49
50 // data
51 struct Data
52 {
53 Data()
54 {
55 }
56
57 ComObjPtr<SessionMachine> pSessionMachine;
58 };
59
60 Data m;
61};
62
63
64class Medium;
65
66/**
67 * The MediumLockToken class automates cleanup of a Medium lock.
68 */
69class ATL_NO_VTABLE MediumLockToken :
70 public TokenWrap
71{
72public:
73
74 DECLARE_EMPTY_CTOR_DTOR(MediumLockToken)
75
76 HRESULT FinalConstruct();
77 void FinalRelease();
78
79 // public initializer/uninitializer for internal purposes only
80 HRESULT init(const ComObjPtr<Medium> &pMedium, bool fWrite);
81 void uninit();
82
83private:
84
85 // wrapped IToken methods
86 HRESULT abandon(AutoCaller &aAutoCaller);
87 HRESULT dummy();
88
89 // data
90 struct Data
91 {
92 Data() :
93 fWrite(false)
94 {
95 }
96
97 ComObjPtr<Medium> pMedium;
98 bool fWrite;
99 };
100
101 Data m;
102};
103
104
105#endif // TOKEN_IMPL_H_
106
107/* 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