Merge "Remove RefBase.h dependency on TextOutput.h"
diff --git a/include/utils/RefBase.h b/include/utils/RefBase.h
index c24c0db..f8d96cf 100644
--- a/include/utils/RefBase.h
+++ b/include/utils/RefBase.h
@@ -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 @@
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 @@
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
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index 0bd1af4..f934eec 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -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>
@@ -530,5 +531,20 @@
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
diff --git a/media/libstagefright/include/AMRExtractor.h b/media/libstagefright/include/AMRExtractor.h
index 589d837..4a1c827 100644
--- a/media/libstagefright/include/AMRExtractor.h
+++ b/media/libstagefright/include/AMRExtractor.h
@@ -18,6 +18,7 @@
#define AMR_EXTRACTOR_H_
+#include <utils/Errors.h>
#include <media/stagefright/MediaExtractor.h>
namespace android {
diff --git a/media/libstagefright/include/MP3Extractor.h b/media/libstagefright/include/MP3Extractor.h
index 728980e..ef71b8f 100644
--- a/media/libstagefright/include/MP3Extractor.h
+++ b/media/libstagefright/include/MP3Extractor.h
@@ -18,6 +18,7 @@
#define MP3_EXTRACTOR_H_
+#include <utils/Errors.h>
#include <media/stagefright/MediaExtractor.h>
namespace android {
diff --git a/media/libstagefright/include/OggExtractor.h b/media/libstagefright/include/OggExtractor.h
index a41f681..e97c8cd 100644
--- a/media/libstagefright/include/OggExtractor.h
+++ b/media/libstagefright/include/OggExtractor.h
@@ -18,6 +18,7 @@
#define OGG_EXTRACTOR_H_
+#include <utils/Errors.h>
#include <media/stagefright/MediaExtractor.h>
namespace android {
diff --git a/media/libstagefright/include/WAVExtractor.h b/media/libstagefright/include/WAVExtractor.h
index 9de197f..ce1f33a 100644
--- a/media/libstagefright/include/WAVExtractor.h
+++ b/media/libstagefright/include/WAVExtractor.h
@@ -18,6 +18,7 @@
#define WAV_EXTRACTOR_H_
+#include <utils/Errors.h>
#include <media/stagefright/MediaExtractor.h>
namespace android {
diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h
index 0218755..afff824 100644
--- a/media/libstagefright/include/avc_utils.h
+++ b/media/libstagefright/include/avc_utils.h
@@ -19,6 +19,7 @@
#define AVC_UTILS_H_
#include <media/stagefright/foundation/ABuffer.h>
+#include <utils/Errors.h>
namespace android {
diff --git a/media/libstagefright/mpeg2ts/ESQueue.h b/media/libstagefright/mpeg2ts/ESQueue.h
index d081995..153cfe6 100644
--- a/media/libstagefright/mpeg2ts/ESQueue.h
+++ b/media/libstagefright/mpeg2ts/ESQueue.h
@@ -19,6 +19,7 @@
#define ES_QUEUE_H_
#include <media/stagefright/foundation/ABase.h>
+#include <utils/Errors.h>
#include <utils/List.h>
#include <utils/RefBase.h>