Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a08ef493 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Remove RefBase.h dependency on TextOutput.h

Change-Id: I72cd6b98ef82b4868fe1c8ec87862cf43fb4ee73
parent 62021d21
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#define ANDROID_REF_BASE_H

#include <cutils/atomic.h>
#include <utils/TextOutput.h>

#include <stdint.h>
#include <sys/types.h>
@@ -27,6 +26,10 @@
// ---------------------------------------------------------------------------
namespace android {

class TextOutput;
TextOutput& printStrongPointer(TextOutput& to, const void* val);
TextOutput& printWeakPointer(TextOutput& to, const void* val);

template<typename T> class wp;

// ---------------------------------------------------------------------------
@@ -427,8 +430,7 @@ sp<T>::sp(T* p, weakref_type* refs)
template <typename T>
inline TextOutput& operator<<(TextOutput& to, const sp<T>& val)
{
    to << "sp<>(" << val.get() << ")";
    return to;
   return printStrongPointer(to, val.get());
}

// ---------------------------------------------------------------------------
@@ -585,8 +587,7 @@ void wp<T>::clear()
template <typename T>
inline TextOutput& operator<<(TextOutput& to, const wp<T>& val)
{
    to << "wp<>(" << val.unsafe_get() << ")";
    return to;
    return printWeakPointer(to, val.unsafe_get());
}

}; // namespace android
+17 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <utils/KeyedVector.h>
#include <utils/Log.h>
#include <utils/threads.h>
#include <utils/TextOutput.h>

#include <stdlib.h>
#include <stdio.h>
@@ -531,4 +532,19 @@ void RefBase::onLastWeakRef(const void* /*id*/)
{
}

// ---------------------------------------------------------------------------

TextOutput& printStrongPointer(TextOutput& to, const void* val)
{
    to << "sp<>(" << val << ")";
    return to;
}

TextOutput& printWeakPointer(TextOutput& to, const void* val)
{
    to << "wp<>(" << val << ")";
    return to;
}


}; // namespace android