media/webrtc/signaling/include/SharedPtr.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/include/SharedPtr.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     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
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#pragma once
     1.9 +
    1.10 +#include <vector>
    1.11 +#include "base/linked_ptr.h"
    1.12 +#include "nsAutoPtr.h"
    1.13 +
    1.14 +#ifndef DECLARE_PTR
    1.15 +#define DECLARE_PTR(className)\
    1.16 +    class className;\
    1.17 +    typedef linked_ptr<className> className##Ptr;
    1.18 +#endif
    1.19 +
    1.20 +
    1.21 +#ifndef DECLARE_PTR_VECTOR
    1.22 +#define DECLARE_PTR_VECTOR(className)\
    1.23 +    DECLARE_PTR(className)\
    1.24 +    typedef std::vector<className##Ptr> className##Vtr;\
    1.25 +    typedef linked_ptr<className##Vtr> className##Vtr##Ptr;
    1.26 +#endif
    1.27 +
    1.28 +
    1.29 +#ifndef NULL_PTR
    1.30 +#define NULL_PTR(className) linked_ptr<className>()
    1.31 +#endif
    1.32 +
    1.33 +// NSPR Variations of the above, to help with migration
    1.34 +// from linked_ptr to nsRefPtr
    1.35 +#ifndef DECLARE_NS_PTR
    1.36 +#define DECLARE_NS_PTR(className)\
    1.37 +    class className;\
    1.38 +    typedef nsRefPtr<className> className##Ptr;
    1.39 +#endif
    1.40 +
    1.41 +
    1.42 +#ifndef DECLARE_NS_PTR_VECTOR
    1.43 +#define DECLARE_NS_PTR_VECTOR(className)\
    1.44 +    DECLARE_NS_PTR(className)\
    1.45 +    typedef std::vector<className##Ptr> className##Vtr;\
    1.46 +    typedef linked_ptr<className##Vtr> className##Vtr##Ptr;
    1.47 +#endif

mercurial