|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef MEDIA_ENGINE_WRAPPER_H_ |
|
6 #define MEDIA_ENGINE_WRAPPER_H_ |
|
7 |
|
8 #include <mozilla/Scoped.h> |
|
9 |
|
10 |
|
11 |
|
12 namespace mozilla |
|
13 { |
|
14 /** |
|
15 * A Custom scoped template to release a resoure of Type T |
|
16 * with a function of Type F |
|
17 * ScopedCustomReleasePtr<webrtc::VoENetwork> ptr = |
|
18 * webrtc::VoENetwork->GetInterface(voiceEngine); |
|
19 * |
|
20 */ |
|
21 template<typename T> |
|
22 struct ScopedCustomReleaseTraits0 : public ScopedFreePtrTraits<T> |
|
23 { |
|
24 static void release(T* ptr) |
|
25 { |
|
26 if(ptr) |
|
27 { |
|
28 (ptr)->Release(); |
|
29 } |
|
30 } |
|
31 }; |
|
32 |
|
33 SCOPED_TEMPLATE(ScopedCustomReleasePtr, ScopedCustomReleaseTraits0) |
|
34 }//namespace |
|
35 |
|
36 |
|
37 #endif |