blob: 1a50231975471840aa0e47b6e16f722c5525ad1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* HBSecurityAccessToken.m $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
#import "HBSecurityAccessToken.h"
@interface HBSecurityAccessToken ()
@property (nonatomic, readonly) id<HBSecurityScope> object;
@property (nonatomic, readonly) BOOL accessed;
@end
@implementation HBSecurityAccessToken
- (instancetype)initWithObject:(id<HBSecurityScope>)object;
{
self = [super init];
if (self)
{
_object = object;
_accessed = [_object startAccessingSecurityScopedResource];
}
return self;
}
+ (instancetype)tokenWithObject:(id<HBSecurityScope>)object
{
return [[self alloc] initWithObject:object];
}
- (void)dealloc
{
if (_accessed)
{
[_object stopAccessingSecurityScopedResource];
}
}
@end
|