michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MEDIA_ENGINE_WRAPPER_H_ michael@0: #define MEDIA_ENGINE_WRAPPER_H_ michael@0: michael@0: #include michael@0: michael@0: michael@0: michael@0: namespace mozilla michael@0: { michael@0: /** michael@0: * A Custom scoped template to release a resoure of Type T michael@0: * with a function of Type F michael@0: * ScopedCustomReleasePtr ptr = michael@0: * webrtc::VoENetwork->GetInterface(voiceEngine); michael@0: * michael@0: */ michael@0: template michael@0: struct ScopedCustomReleaseTraits0 : public ScopedFreePtrTraits michael@0: { michael@0: static void release(T* ptr) michael@0: { michael@0: if(ptr) michael@0: { michael@0: (ptr)->Release(); michael@0: } michael@0: } michael@0: }; michael@0: michael@0: SCOPED_TEMPLATE(ScopedCustomReleasePtr, ScopedCustomReleaseTraits0) michael@0: }//namespace michael@0: michael@0: michael@0: #endif