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

Commit e364df5a authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "Remove RefBase.h dependency on TextOutput.h"

parents a2b2e7dd a08ef493
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