Make rtc_base/refcount.h self contained, not including refcountedobject.h.

The refcount.h file doesn't depend on anything from
refcountedobject.h. The motivation of this change to make it possible
to add additional declarations to refcount.h, and include it from
refcountedobject.h.

Bug: webrtc:8270
Change-Id: I24f6131f471e675570968d00065ff9b1f55e3373
Reviewed-on: https://webrtc-review.googlesource.com/5760
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20106}
diff --git a/api/audio_codecs/audio_decoder_factory_template.h b/api/audio_codecs/audio_decoder_factory_template.h
index eb13e9f..a1933aa 100644
--- a/api/audio_codecs/audio_decoder_factory_template.h
+++ b/api/audio_codecs/audio_decoder_factory_template.h
@@ -15,6 +15,7 @@
 #include <vector>
 
 #include "api/audio_codecs/audio_decoder_factory.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace webrtc {
diff --git a/api/audio_codecs/audio_encoder_factory_template.h b/api/audio_codecs/audio_encoder_factory_template.h
index 8df582e..252a9bd 100644
--- a/api/audio_codecs/audio_encoder_factory_template.h
+++ b/api/audio_codecs/audio_encoder_factory_template.h
@@ -15,6 +15,7 @@
 #include <vector>
 
 #include "api/audio_codecs/audio_encoder_factory.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace webrtc {
diff --git a/api/proxy.h b/api/proxy.h
index c597165..175c6b7 100644
--- a/api/proxy.h
+++ b/api/proxy.h
@@ -56,6 +56,7 @@
 #include <utility>
 
 #include "rtc_base/event.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/thread.h"
 
 namespace webrtc {
diff --git a/api/stats/rtcstatsreport.h b/api/stats/rtcstatsreport.h
index 027041a..ee56b35 100644
--- a/api/stats/rtcstatsreport.h
+++ b/api/stats/rtcstatsreport.h
@@ -18,6 +18,7 @@
 
 #include "api/stats/rtcstats.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace webrtc {
diff --git a/api/statstypes.cc b/api/statstypes.cc
index f1a1130..940fb73 100644
--- a/api/statstypes.cc
+++ b/api/statstypes.cc
@@ -13,6 +13,7 @@
 #include <string.h>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/refcountedobject.h"
 
 // TODO(tommi): Could we have a static map of value name -> expected type
 // and use this to RTC_DCHECK on correct usage (somewhat strongly typed values)?
diff --git a/common_video/include/i420_buffer_pool.h b/common_video/include/i420_buffer_pool.h
index f43a948..863eb10 100644
--- a/common_video/include/i420_buffer_pool.h
+++ b/common_video/include/i420_buffer_pool.h
@@ -16,6 +16,7 @@
 
 #include "api/video/i420_buffer.h"
 #include "rtc_base/race_checker.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace webrtc {
 
diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
index a010619..6d0c37e 100644
--- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc
+++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
@@ -37,6 +37,7 @@
 #include "rtc_base/criticalsection.h"
 #include "rtc_base/md5digest.h"
 #include "rtc_base/platform_thread.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/thread_annotations.h"
 #include "system_wrappers/include/clock.h"
 #include "system_wrappers/include/event_wrapper.h"
diff --git a/modules/audio_coding/neteq/decoder_database_unittest.cc b/modules/audio_coding/neteq/decoder_database_unittest.cc
index be3c0b7..626420a 100644
--- a/modules/audio_coding/neteq/decoder_database_unittest.cc
+++ b/modules/audio_coding/neteq/decoder_database_unittest.cc
@@ -16,6 +16,7 @@
 #include <string>
 
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
+#include "rtc_base/refcountedobject.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 #include "test/mock_audio_decoder.h"
diff --git a/modules/audio_device/audio_device_impl.cc b/modules/audio_device/audio_device_impl.cc
index 820d5f6..31b05a9 100644
--- a/modules/audio_device/audio_device_impl.cc
+++ b/modules/audio_device/audio_device_impl.cc
@@ -15,6 +15,7 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/timeutils.h"
 #include "system_wrappers/include/metrics.h"
 
diff --git a/modules/audio_mixer/audio_mixer_impl.cc b/modules/audio_mixer/audio_mixer_impl.cc
index 51f6658..9ff5774 100644
--- a/modules/audio_mixer/audio_mixer_impl.cc
+++ b/modules/audio_mixer/audio_mixer_impl.cc
@@ -18,6 +18,7 @@
 #include "modules/audio_mixer/audio_frame_manipulator.h"
 #include "modules/audio_mixer/default_output_rate_calculator.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace webrtc {
 namespace {
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index 99cd082..fd469ea 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -32,6 +32,7 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/platform_file.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/trace_event.h"
 #if WEBRTC_INTELLIGIBILITY_ENHANCER
 #include "modules/audio_processing/intelligibility/intelligibility_enhancer.h"
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc
index 7cd2c95..2b1393f 100644
--- a/modules/audio_processing/audio_processing_unittest.cc
+++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -34,6 +34,7 @@
 #include "rtc_base/gtest_prod_util.h"
 #include "rtc_base/ignore_wundef.h"
 #include "rtc_base/protobuf_utils.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/safe_minmax.h"
 #include "rtc_base/task_queue.h"
 #include "rtc_base/thread.h"
diff --git a/modules/desktop_capture/shared_desktop_frame.h b/modules/desktop_capture/shared_desktop_frame.h
index 1f01220..f70508c 100644
--- a/modules/desktop_capture/shared_desktop_frame.h
+++ b/modules/desktop_capture/shared_desktop_frame.h
@@ -14,6 +14,7 @@
 #include "modules/desktop_capture/desktop_frame.h"
 #include "rtc_base/constructormagic.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace webrtc {
diff --git a/modules/video_capture/external/video_capture_external.cc b/modules/video_capture/external/video_capture_external.cc
index cd85071..3252178 100644
--- a/modules/video_capture/external/video_capture_external.cc
+++ b/modules/video_capture/external/video_capture_external.cc
@@ -10,6 +10,7 @@
 
 #include "modules/video_capture/video_capture_impl.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace webrtc {
 
diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc
index be8e64e..80810f2 100644
--- a/modules/video_capture/linux/video_capture_linux.cc
+++ b/modules/video_capture/linux/video_capture_linux.cc
@@ -25,6 +25,7 @@
 
 #include "media/base/videocommon.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 #include "rtc_base/logging.h"
 
diff --git a/modules/video_capture/objc/video_capture.mm b/modules/video_capture/objc/video_capture.mm
index 4f9c2f3..6dd2fd6 100644
--- a/modules/video_capture/objc/video_capture.mm
+++ b/modules/video_capture/objc/video_capture.mm
@@ -15,6 +15,7 @@
 #include "modules/video_capture/objc/device_info_objc.h"
 #include "modules/video_capture/objc/rtc_video_capture_objc.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 using namespace webrtc;
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index 4d67010..1f40ee7 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -18,6 +18,7 @@
 #include "modules/video_capture/video_capture_config.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/timeutils.h"
 #include "rtc_base/trace_event.h"
 #include "system_wrappers/include/clock.h"
diff --git a/modules/video_capture/windows/video_capture_factory_windows.cc b/modules/video_capture/windows/video_capture_factory_windows.cc
index 069f463..52a3cb5 100644
--- a/modules/video_capture/windows/video_capture_factory_windows.cc
+++ b/modules/video_capture/windows/video_capture_factory_windows.cc
@@ -11,6 +11,7 @@
 #include "modules/video_capture/windows/video_capture_ds.h"
 #include "modules/video_capture/windows/video_capture_mf.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace webrtc {
diff --git a/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc b/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
index 0e81923..a7a03e5 100644
--- a/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
+++ b/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
@@ -17,6 +17,7 @@
 
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace webrtc {
 
diff --git a/modules/video_coding/video_codec_initializer_unittest.cc b/modules/video_coding/video_codec_initializer_unittest.cc
index 99239c5..48bf466 100644
--- a/modules/video_coding/video_codec_initializer_unittest.cc
+++ b/modules/video_coding/video_codec_initializer_unittest.cc
@@ -13,6 +13,7 @@
 #include "common_types.h"  // NOLINT(build/include)
 #include "modules/video_coding/codecs/vp8/temporal_layers.h"
 #include "modules/video_coding/include/video_codec_initializer.h"
+#include "rtc_base/refcountedobject.h"
 #include "test/gtest.h"
 
 namespace webrtc {
diff --git a/pc/audiotrack.cc b/pc/audiotrack.cc
index 8e24f0b..4083991 100644
--- a/pc/audiotrack.cc
+++ b/pc/audiotrack.cc
@@ -11,6 +11,7 @@
 #include "pc/audiotrack.h"
 
 #include "rtc_base/checks.h"
+#include "rtc_base/refcountedobject.h"
 
 using rtc::scoped_refptr;
 
diff --git a/pc/mediastream.cc b/pc/mediastream.cc
index 0e24ee6..0d6fcda 100644
--- a/pc/mediastream.cc
+++ b/pc/mediastream.cc
@@ -11,6 +11,7 @@
 #include "pc/mediastream.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace webrtc {
 
diff --git a/pc/test/fakeaudiocapturemodule.cc b/pc/test/fakeaudiocapturemodule.cc
index ffee283..5a962df 100644
--- a/pc/test/fakeaudiocapturemodule.cc
+++ b/pc/test/fakeaudiocapturemodule.cc
@@ -12,6 +12,7 @@
 
 #include "rtc_base/checks.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/timeutils.h"
 
diff --git a/pc/videotrack.cc b/pc/videotrack.cc
index 00adb3d..718c0d6 100644
--- a/pc/videotrack.cc
+++ b/pc/videotrack.cc
@@ -9,6 +9,7 @@
  */
 
 #include "pc/videotrack.h"
+#include "rtc_base/refcountedobject.h"
 
 #include <string>
 
diff --git a/rtc_base/bind_unittest.cc b/rtc_base/bind_unittest.cc
index 7028ced..8703be4 100644
--- a/rtc_base/bind_unittest.cc
+++ b/rtc_base/bind_unittest.cc
@@ -14,6 +14,7 @@
 #include "rtc_base/gunit.h"
 
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace rtc {
 
diff --git a/rtc_base/callback.h b/rtc_base/callback.h
index 1472b25..0e035ad 100644
--- a/rtc_base/callback.h
+++ b/rtc_base/callback.h
@@ -13,7 +13,7 @@
  */
 
 // To generate callback.h from callback.h.pump, execute:
-// /home/build/google3/third_party/gtest/scripts/pump.py callback.h.pump
+// ../third_party/googletest/src/googletest/scripts/pump.py callback.h.pump
 
 // Callbacks are callable object containers. They can hold a function pointer
 // or a function object and behave like a value type. Internally, data is
@@ -63,6 +63,7 @@
 #define RTC_BASE_CALLBACK_H_
 
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace rtc {
diff --git a/rtc_base/callback.h.pump b/rtc_base/callback.h.pump
index 383fc19..2c40eab 100644
--- a/rtc_base/callback.h.pump
+++ b/rtc_base/callback.h.pump
@@ -9,7 +9,7 @@
  */
 
 // To generate callback.h from callback.h.pump, execute:
-// /home/build/google3/third_party/gtest/scripts/pump.py callback.h.pump
+// ../third_party/googletest/src/googletest/scripts/pump.py callback.h.pump
 
 // Callbacks are callable object containers. They can hold a function pointer
 // or a function object and behave like a value type. Internally, data is
@@ -58,6 +58,7 @@
 #define RTC_BASE_CALLBACK_H_
 
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace rtc {
diff --git a/rtc_base/copyonwritebuffer.h b/rtc_base/copyonwritebuffer.h
index bdfe393..c4bba87 100644
--- a/rtc_base/copyonwritebuffer.h
+++ b/rtc_base/copyonwritebuffer.h
@@ -17,6 +17,7 @@
 #include "rtc_base/buffer.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 
 namespace rtc {
diff --git a/rtc_base/refcount.h b/rtc_base/refcount.h
index a2664f0..f29d279 100644
--- a/rtc_base/refcount.h
+++ b/rtc_base/refcount.h
@@ -10,8 +10,6 @@
 #ifndef RTC_BASE_REFCOUNT_H_
 #define RTC_BASE_REFCOUNT_H_
 
-#include "rtc_base/refcountedobject.h"
-
 namespace rtc {
 
 // Reference count interface.
diff --git a/rtc_base/refcountedobject_unittest.cc b/rtc_base/refcountedobject_unittest.cc
index 688b921..143ca85 100644
--- a/rtc_base/refcountedobject_unittest.cc
+++ b/rtc_base/refcountedobject_unittest.cc
@@ -12,6 +12,7 @@
 
 #include "rtc_base/gunit.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace rtc {
 
diff --git a/rtc_base/rtccertificate.cc b/rtc_base/rtccertificate.cc
index 0c583b3..dd6f40a 100644
--- a/rtc_base/rtccertificate.cc
+++ b/rtc_base/rtccertificate.cc
@@ -13,6 +13,7 @@
 #include "rtc_base/rtccertificate.h"
 
 #include "rtc_base/checks.h"
+#include "rtc_base/refcountedobject.h"
 
 namespace rtc {
 
diff --git a/rtc_base/rtccertificategenerator.cc b/rtc_base/rtccertificategenerator.cc
index 1d99d10..cacff61 100644
--- a/rtc_base/rtccertificategenerator.cc
+++ b/rtc_base/rtccertificategenerator.cc
@@ -14,6 +14,7 @@
 #include <memory>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/sslidentity.h"
 
 namespace rtc {
diff --git a/rtc_base/rtccertificategenerator_unittest.cc b/rtc_base/rtccertificategenerator_unittest.cc
index c8e1ab3..4ff6880 100644
--- a/rtc_base/rtccertificategenerator_unittest.cc
+++ b/rtc_base/rtccertificategenerator_unittest.cc
@@ -16,6 +16,7 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/gunit.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/thread.h"
 
 namespace rtc {
diff --git a/rtc_base/weak_ptr.h b/rtc_base/weak_ptr.h
index 7c1c15c..4950dfc 100644
--- a/rtc_base/weak_ptr.h
+++ b/rtc_base/weak_ptr.h
@@ -16,6 +16,7 @@
 #include <utility>
 
 #include "rtc_base/refcount.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 #include "rtc_base/sequenced_task_checker.h"
 
diff --git a/test/encoder_settings.cc b/test/encoder_settings.cc
index a2549ab..673785d 100644
--- a/test/encoder_settings.cc
+++ b/test/encoder_settings.cc
@@ -15,6 +15,7 @@
 #include "modules/video_coding/codecs/h264/include/h264.h"
 #include "modules/video_coding/codecs/vp8/include/vp8.h"
 #include "modules/video_coding/codecs/vp9/include/vp9.h"
+#include "rtc_base/refcountedobject.h"
 #include "test/fake_decoder.h"
 
 namespace webrtc {
diff --git a/test/mock_audio_decoder_factory.h b/test/mock_audio_decoder_factory.h
index 6104b06..bc504d8 100644
--- a/test/mock_audio_decoder_factory.h
+++ b/test/mock_audio_decoder_factory.h
@@ -16,6 +16,7 @@
 
 #include "api/audio_codecs/audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
+#include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
 #include "test/gmock.h"
 
diff --git a/voice_engine/voe_base_unittest.cc b/voice_engine/voe_base_unittest.cc
index ef42fba..72f2e0a 100644
--- a/voice_engine/voe_base_unittest.cc
+++ b/voice_engine/voe_base_unittest.cc
@@ -12,6 +12,7 @@
 
 #include "modules/audio_device/include/fake_audio_device.h"
 #include "modules/audio_processing/include/mock_audio_processing.h"
+#include "rtc_base/refcountedobject.h"
 #include "test/gtest.h"
 
 namespace webrtc {