rtc_stats: Update code to remove chromium style warnings suppression.

The warning previously suppressed made it possible to define tings like
constructors in the header, and "complex" objects did not need to have
an explicit out-of-line copy constructor, destructor, etc.

To be able to not suppress this warning, the RTCStats macro was split
into a WEBRTC_RTCSTATS_DECL() and WEBRTC_RTCSTATS_IMPL() for .h and .cc
respectively. Some copy constructors are also defined.

BUG=chromium:627816

Review-Url: https://codereview.webrtc.org/2373503002
Cr-Original-Commit-Position: refs/heads/master@{#14545}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: fc5e0504ea0dd341046779881908d4640617a2f0
diff --git a/api/stats/rtcstats.h b/api/stats/rtcstats.h
index 988291b..6917548 100644
--- a/api/stats/rtcstats.h
+++ b/api/stats/rtcstats.h
@@ -91,14 +91,15 @@
   int64_t timestamp_us_;
 };
 
-// All |RTCStats| classes should use this macro in a public section of the class
-// definition.
+// All |RTCStats| classes should use these macros.
+// |WEBRTC_RTCSTATS_DECL| is placed in a public section of the class definition.
+// |WEBRTC_RTCSTATS_IMPL| is placed outside the class definition (in a .cc).
 //
-// This macro declares the static |kType| and overrides methods as required by
-// subclasses of |RTCStats|: |copy|, |type|, and
+// These macros declare (in _DECL) and define (in _IMPL) the static |kType| and
+// overrides methods as required by subclasses of |RTCStats|: |copy|, |type| and
 // |MembersOfThisObjectAndAncestors|. The |...| argument is a list of addresses
-// to each member defined in the implementing class (list cannot be empty, must
-// have at least one new member).
+// to each member defined in the implementing class. The list must have at least
+// one member.
 //
 // (Since class names need to be known to implement these methods this cannot be
 // part of the base |RTCStats|. While these methods could be implemented using
@@ -112,34 +113,53 @@
 // rtcfoostats.h:
 //   class RTCFooStats : public RTCStats {
 //    public:
-//     RTCFooStats(const std::string& id, int64_t timestamp_us)
-//         : RTCStats(id, timestamp_us),
-//           foo("foo"),
-//           bar("bar") {
-//     }
+//     WEBRTC_RTCSTATS_DECL();
 //
-//     WEBRTC_RTCSTATS_IMPL(RTCStats, RTCFooStats,
-//         &foo,
-//         &bar);
+//     RTCFooStats(const std::string& id, int64_t timestamp_us);
 //
 //     RTCStatsMember<int32_t> foo;
 //     RTCStatsMember<int32_t> bar;
 //   };
 //
 // rtcfoostats.cc:
-//   const char RTCFooStats::kType[] = "foo-stats";
+//   WEBRTC_RTCSTATS_IMPL(RTCFooStats, RTCStats, "foo-stats"
+//       &foo,
+//       &bar);
 //
-#define WEBRTC_RTCSTATS_IMPL(parent_class, this_class, ...)                    \
+//   RTCFooStats::RTCFooStats(const std::string& id, int64_t timestamp_us)
+//       : RTCStats(id, timestamp_us),
+//         foo("foo"),
+//         bar("bar") {
+//   }
+//
+#define WEBRTC_RTCSTATS_DECL()                                                 \
  public:                                                                       \
   static const char kType[];                                                   \
-  std::unique_ptr<webrtc::RTCStats> copy() const override {                    \
-    return std::unique_ptr<webrtc::RTCStats>(new this_class(*this));           \
-  }                                                                            \
-  const char* type() const override { return this_class::kType; }              \
+                                                                               \
+  std::unique_ptr<webrtc::RTCStats> copy() const override;                     \
+  const char* type() const override;                                           \
+                                                                               \
  protected:                                                                    \
   std::vector<const webrtc::RTCStatsMemberInterface*>                          \
   MembersOfThisObjectAndAncestors(                                             \
-      size_t local_var_additional_capacity) const override {                   \
+      size_t local_var_additional_capacity) const override;                    \
+                                                                               \
+ public:
+
+#define WEBRTC_RTCSTATS_IMPL(this_class, parent_class, type_str, ...)          \
+  const char this_class::kType[] = type_str;                                   \
+                                                                               \
+  std::unique_ptr<webrtc::RTCStats> this_class::copy() const {                 \
+    return std::unique_ptr<webrtc::RTCStats>(new this_class(*this));           \
+  }                                                                            \
+                                                                               \
+  const char* this_class::type() const {                                       \
+    return this_class::kType;                                                  \
+  }                                                                            \
+                                                                               \
+  std::vector<const webrtc::RTCStatsMemberInterface*>                          \
+  this_class::MembersOfThisObjectAndAncestors(                                 \
+      size_t local_var_additional_capacity) const {                            \
     const webrtc::RTCStatsMemberInterface* local_var_members[] = {             \
       __VA_ARGS__                                                              \
     };                                                                         \
@@ -155,8 +175,7 @@
                                  &local_var_members[0],                        \
                                  &local_var_members[local_var_members_count]); \
     return local_var_members_vec;                                              \
-  }                                                                            \
- public:
+  }
 
 // Interface for |RTCStats| members, which have a name and a value of a type
 // defined in a subclass. Only the types listed in |Type| are supported, these