1 | /* $Id: SupportErrorInfo.cpp 30714 2010-07-07 16:20:03Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * MS COM / XPCOM Abstraction Layer:
|
---|
5 | * SupportErrorInfo* class family implementations
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2008 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 | #include "VBox/com/SupportErrorInfo.h"
|
---|
21 |
|
---|
22 | #include "VBox/com/ptr.h"
|
---|
23 | #include "VBox/com/VirtualBoxErrorInfo.h"
|
---|
24 |
|
---|
25 | #include "../include/Logging.h"
|
---|
26 |
|
---|
27 | #include <iprt/thread.h>
|
---|
28 |
|
---|
29 | #if defined (VBOX_WITH_XPCOM)
|
---|
30 | # include <nsIServiceManager.h>
|
---|
31 | # include <nsIExceptionService.h>
|
---|
32 | #endif /* defined (VBOX_WITH_XPCOM) */
|
---|
33 |
|
---|
34 | namespace com
|
---|
35 | {
|
---|
36 |
|
---|
37 | // MultiResult methods
|
---|
38 | ////////////////////////////////////////////////////////////////////////////////
|
---|
39 |
|
---|
40 | RTTLS MultiResult::sCounter = NIL_RTTLS;
|
---|
41 |
|
---|
42 | /*static*/
|
---|
43 | void MultiResult::incCounter()
|
---|
44 | {
|
---|
45 | if (sCounter == NIL_RTTLS)
|
---|
46 | {
|
---|
47 | sCounter = RTTlsAlloc();
|
---|
48 | AssertReturnVoid(sCounter != NIL_RTTLS);
|
---|
49 | }
|
---|
50 |
|
---|
51 | uintptr_t counter = (uintptr_t)RTTlsGet(sCounter);
|
---|
52 | ++counter;
|
---|
53 | RTTlsSet(sCounter, (void*)counter);
|
---|
54 | }
|
---|
55 |
|
---|
56 | /*static*/
|
---|
57 | void MultiResult::decCounter()
|
---|
58 | {
|
---|
59 | uintptr_t counter = (uintptr_t)RTTlsGet(sCounter);
|
---|
60 | AssertReturnVoid(counter != 0);
|
---|
61 | --counter;
|
---|
62 | RTTlsSet(sCounter, (void*)counter);
|
---|
63 | }
|
---|
64 |
|
---|
65 | /*static*/
|
---|
66 | bool MultiResult::isMultiEnabled()
|
---|
67 | {
|
---|
68 | return ((uintptr_t)RTTlsGet(MultiResult::sCounter)) > 0;
|
---|
69 | }
|
---|
70 |
|
---|
71 | } /* namespace com */
|
---|
72 |
|
---|