media/webrtc/signaling/src/common/MediaEngineWrapper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/src/common/MediaEngineWrapper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 +  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef  MEDIA_ENGINE_WRAPPER_H_
     1.9 +#define MEDIA_ENGINE_WRAPPER_H_
    1.10 +
    1.11 +#include <mozilla/Scoped.h>
    1.12 +
    1.13 +
    1.14 +
    1.15 +namespace mozilla
    1.16 +{
    1.17 +/**
    1.18 + * A Custom scoped template to release a resoure of Type T
    1.19 + * with a function of Type F
    1.20 + * ScopedCustomReleasePtr<webrtc::VoENetwork> ptr =
    1.21 + *               webrtc::VoENetwork->GetInterface(voiceEngine);
    1.22 + *
    1.23 + */
    1.24 +template<typename T>
    1.25 +struct ScopedCustomReleaseTraits0 : public ScopedFreePtrTraits<T>
    1.26 +{
    1.27 +  static void release(T* ptr)
    1.28 +  {
    1.29 +    if(ptr)
    1.30 +    {
    1.31 +      (ptr)->Release();
    1.32 +    }
    1.33 +  }
    1.34 +};
    1.35 +
    1.36 +SCOPED_TEMPLATE(ScopedCustomReleasePtr, ScopedCustomReleaseTraits0)
    1.37 +}//namespace
    1.38 +
    1.39 +
    1.40 +#endif

mercurial