equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 // mecunittestrefcountowner.cpp |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "mecunittestrefcountowner.h" |
|
23 |
|
24 CMecUnitTestRefCountOwnerBase::CMecUnitTestRefCountOwnerBase(const TAny* aPtr) |
|
25 : iPtr(const_cast<TAny*>(aPtr)), iRefCount(0) |
|
26 { |
|
27 } |
|
28 |
|
29 CMecUnitTestRefCountOwnerBase::~CMecUnitTestRefCountOwnerBase() |
|
30 { |
|
31 } |
|
32 |
|
33 void CMecUnitTestRefCountOwnerBase::Close() |
|
34 { |
|
35 // LockedDec() returns the value prior to decrement |
|
36 if (User::LockedDec(iRefCount) == 1) |
|
37 { |
|
38 DeletePtr(); |
|
39 delete this; |
|
40 } |
|
41 } |
|
42 |
|
43 void CMecUnitTestRefCountOwnerBase::Open() |
|
44 { |
|
45 // LockedInc() returns the value prior to increment |
|
46 User::LockedInc(iRefCount); |
|
47 } |
|
48 |